@depup/sentry__react 10.44.0-depup.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 (140) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +25 -0
  3. package/build/cjs/constants.js +12 -0
  4. package/build/cjs/constants.js.map +1 -0
  5. package/build/cjs/debug-build.js +11 -0
  6. package/build/cjs/debug-build.js.map +1 -0
  7. package/build/cjs/error.js +113 -0
  8. package/build/cjs/error.js.map +1 -0
  9. package/build/cjs/errorboundary.js +170 -0
  10. package/build/cjs/errorboundary.js.map +1 -0
  11. package/build/cjs/hoist-non-react-statics.js +159 -0
  12. package/build/cjs/hoist-non-react-statics.js.map +1 -0
  13. package/build/cjs/index.js +51 -0
  14. package/build/cjs/index.js.map +1 -0
  15. package/build/cjs/profiler.js +226 -0
  16. package/build/cjs/profiler.js.map +1 -0
  17. package/build/cjs/reactrouter-compat-utils/instrumentation.js +1295 -0
  18. package/build/cjs/reactrouter-compat-utils/instrumentation.js.map +1 -0
  19. package/build/cjs/reactrouter-compat-utils/lazy-routes.js +160 -0
  20. package/build/cjs/reactrouter-compat-utils/lazy-routes.js.map +1 -0
  21. package/build/cjs/reactrouter-compat-utils/route-manifest.js +194 -0
  22. package/build/cjs/reactrouter-compat-utils/route-manifest.js.map +1 -0
  23. package/build/cjs/reactrouter-compat-utils/utils.js +336 -0
  24. package/build/cjs/reactrouter-compat-utils/utils.js.map +1 -0
  25. package/build/cjs/reactrouter.js +236 -0
  26. package/build/cjs/reactrouter.js.map +1 -0
  27. package/build/cjs/reactrouterv3.js +130 -0
  28. package/build/cjs/reactrouterv3.js.map +1 -0
  29. package/build/cjs/reactrouterv6.js +61 -0
  30. package/build/cjs/reactrouterv6.js.map +1 -0
  31. package/build/cjs/reactrouterv7.js +61 -0
  32. package/build/cjs/reactrouterv7.js.map +1 -0
  33. package/build/cjs/redux.js +106 -0
  34. package/build/cjs/redux.js.map +1 -0
  35. package/build/cjs/sdk.js +21 -0
  36. package/build/cjs/sdk.js.map +1 -0
  37. package/build/cjs/tanstackrouter.js +134 -0
  38. package/build/cjs/tanstackrouter.js.map +1 -0
  39. package/build/esm/constants.js +8 -0
  40. package/build/esm/constants.js.map +1 -0
  41. package/build/esm/debug-build.js +9 -0
  42. package/build/esm/debug-build.js.map +1 -0
  43. package/build/esm/error.js +108 -0
  44. package/build/esm/error.js.map +1 -0
  45. package/build/esm/errorboundary.js +166 -0
  46. package/build/esm/errorboundary.js.map +1 -0
  47. package/build/esm/hoist-non-react-statics.js +157 -0
  48. package/build/esm/hoist-non-react-statics.js.map +1 -0
  49. package/build/esm/index.js +12 -0
  50. package/build/esm/index.js.map +1 -0
  51. package/build/esm/package.json +1 -0
  52. package/build/esm/profiler.js +221 -0
  53. package/build/esm/profiler.js.map +1 -0
  54. package/build/esm/reactrouter-compat-utils/instrumentation.js +1281 -0
  55. package/build/esm/reactrouter-compat-utils/instrumentation.js.map +1 -0
  56. package/build/esm/reactrouter-compat-utils/lazy-routes.js +156 -0
  57. package/build/esm/reactrouter-compat-utils/lazy-routes.js.map +1 -0
  58. package/build/esm/reactrouter-compat-utils/route-manifest.js +191 -0
  59. package/build/esm/reactrouter-compat-utils/route-manifest.js.map +1 -0
  60. package/build/esm/reactrouter-compat-utils/utils.js +320 -0
  61. package/build/esm/reactrouter-compat-utils/utils.js.map +1 -0
  62. package/build/esm/reactrouter.js +232 -0
  63. package/build/esm/reactrouter.js.map +1 -0
  64. package/build/esm/reactrouterv3.js +128 -0
  65. package/build/esm/reactrouterv3.js.map +1 -0
  66. package/build/esm/reactrouterv6.js +55 -0
  67. package/build/esm/reactrouterv6.js.map +1 -0
  68. package/build/esm/reactrouterv7.js +55 -0
  69. package/build/esm/reactrouterv7.js.map +1 -0
  70. package/build/esm/redux.js +104 -0
  71. package/build/esm/redux.js.map +1 -0
  72. package/build/esm/sdk.js +19 -0
  73. package/build/esm/sdk.js.map +1 -0
  74. package/build/esm/tanstackrouter.js +132 -0
  75. package/build/esm/tanstackrouter.js.map +1 -0
  76. package/build/types/constants.d.ts +4 -0
  77. package/build/types/constants.d.ts.map +1 -0
  78. package/build/types/debug-build.d.ts +7 -0
  79. package/build/types/debug-build.d.ts.map +1 -0
  80. package/build/types/error.d.ts +41 -0
  81. package/build/types/error.d.ts.map +1 -0
  82. package/build/types/errorboundary.d.ts +87 -0
  83. package/build/types/errorboundary.d.ts.map +1 -0
  84. package/build/types/hoist-non-react-statics.d.ts +21 -0
  85. package/build/types/hoist-non-react-statics.d.ts.map +1 -0
  86. package/build/types/index.d.ts +13 -0
  87. package/build/types/index.d.ts.map +1 -0
  88. package/build/types/profiler.d.ts +56 -0
  89. package/build/types/profiler.d.ts.map +1 -0
  90. package/build/types/reactrouter-compat-utils/index.d.ts +5 -0
  91. package/build/types/reactrouter-compat-utils/index.d.ts.map +1 -0
  92. package/build/types/reactrouter-compat-utils/instrumentation.d.ts +117 -0
  93. package/build/types/reactrouter-compat-utils/instrumentation.d.ts.map +1 -0
  94. package/build/types/reactrouter-compat-utils/lazy-routes.d.ts +18 -0
  95. package/build/types/reactrouter-compat-utils/lazy-routes.d.ts.map +1 -0
  96. package/build/types/reactrouter-compat-utils/route-manifest.d.ts +13 -0
  97. package/build/types/reactrouter-compat-utils/route-manifest.d.ts.map +1 -0
  98. package/build/types/reactrouter-compat-utils/utils.d.ts +71 -0
  99. package/build/types/reactrouter-compat-utils/utils.d.ts.map +1 -0
  100. package/build/types/reactrouter.d.ts +41 -0
  101. package/build/types/reactrouter.d.ts.map +1 -0
  102. package/build/types/reactrouterv3.d.ts +29 -0
  103. package/build/types/reactrouterv3.d.ts.map +1 -0
  104. package/build/types/reactrouterv6.d.ts +32 -0
  105. package/build/types/reactrouterv6.d.ts.map +1 -0
  106. package/build/types/reactrouterv7.d.ts +32 -0
  107. package/build/types/reactrouterv7.d.ts.map +1 -0
  108. package/build/types/redux.d.ts +38 -0
  109. package/build/types/redux.d.ts.map +1 -0
  110. package/build/types/sdk.d.ts +7 -0
  111. package/build/types/sdk.d.ts.map +1 -0
  112. package/build/types/tanstackrouter.d.ts +13 -0
  113. package/build/types/tanstackrouter.d.ts.map +1 -0
  114. package/build/types/types.d.ts +163 -0
  115. package/build/types/types.d.ts.map +1 -0
  116. package/build/types/vendor/tanstackrouter-types.d.ts +36 -0
  117. package/build/types/vendor/tanstackrouter-types.d.ts.map +1 -0
  118. package/build/types-ts3.8/constants.d.ts +4 -0
  119. package/build/types-ts3.8/debug-build.d.ts +7 -0
  120. package/build/types-ts3.8/error.d.ts +41 -0
  121. package/build/types-ts3.8/errorboundary.d.ts +87 -0
  122. package/build/types-ts3.8/hoist-non-react-statics.d.ts +21 -0
  123. package/build/types-ts3.8/index.d.ts +13 -0
  124. package/build/types-ts3.8/profiler.d.ts +56 -0
  125. package/build/types-ts3.8/reactrouter-compat-utils/index.d.ts +5 -0
  126. package/build/types-ts3.8/reactrouter-compat-utils/instrumentation.d.ts +117 -0
  127. package/build/types-ts3.8/reactrouter-compat-utils/lazy-routes.d.ts +18 -0
  128. package/build/types-ts3.8/reactrouter-compat-utils/route-manifest.d.ts +13 -0
  129. package/build/types-ts3.8/reactrouter-compat-utils/utils.d.ts +77 -0
  130. package/build/types-ts3.8/reactrouter.d.ts +41 -0
  131. package/build/types-ts3.8/reactrouterv3.d.ts +29 -0
  132. package/build/types-ts3.8/reactrouterv6.d.ts +32 -0
  133. package/build/types-ts3.8/reactrouterv7.d.ts +32 -0
  134. package/build/types-ts3.8/redux.d.ts +38 -0
  135. package/build/types-ts3.8/sdk.d.ts +7 -0
  136. package/build/types-ts3.8/tanstackrouter.d.ts +13 -0
  137. package/build/types-ts3.8/types.d.ts +163 -0
  138. package/build/types-ts3.8/vendor/tanstackrouter-types.d.ts +36 -0
  139. package/changes.json +5 -0
  140. package/package.json +108 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Functional Software, Inc. dba Sentry
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9
+ of the Software, and to permit persons to whom the Software is furnished to do
10
+ so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # @depup/sentry__react
2
+
3
+ > Dependency-bumped version of [@sentry/react](https://www.npmjs.com/package/@sentry/react)
4
+
5
+ Generated by [DepUp](https://github.com/depup/npm) -- all production
6
+ dependencies bumped to latest versions.
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ npm install @depup/sentry__react
12
+ ```
13
+
14
+ | Field | Value |
15
+ |-------|-------|
16
+ | Original | [@sentry/react](https://www.npmjs.com/package/@sentry/react) @ 10.44.0 |
17
+ | Processed | 2026-03-18 |
18
+ | Smoke test | failed |
19
+ | Deps updated | 0 |
20
+
21
+ ---
22
+
23
+ Source: https://github.com/depup/npm | Original: https://www.npmjs.com/package/@sentry/react
24
+
25
+ License inherited from the original package.
@@ -0,0 +1,12 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ const REACT_RENDER_OP = 'ui.react.render';
4
+
5
+ const REACT_UPDATE_OP = 'ui.react.update';
6
+
7
+ const 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
@@ -0,0 +1 @@
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":";;AAAO,MAAM,eAAA,GAAkB;;AAExB,MAAM,eAAA,GAAkB;;AAExB,MAAM,cAAA,GAAiB;;;;;;"}
@@ -0,0 +1,11 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ /**
4
+ * This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.
5
+ *
6
+ * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.
7
+ */
8
+ const DEBUG_BUILD = (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__);
9
+
10
+ exports.DEBUG_BUILD = DEBUG_BUILD;
11
+ //# sourceMappingURL=debug-build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-build.js","sources":["../../src/debug-build.ts"],"sourcesContent":["declare const __DEBUG_BUILD__: boolean;\n\n/**\n * This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.\n *\n * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.\n */\nexport const DEBUG_BUILD = __DEBUG_BUILD__;\n"],"names":[],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACO,MAAM,WAAA,IAAc,OAAA,gBAAA,KAAA,WAAA,IAAA,gBAAA;;;;"}
@@ -0,0 +1,113 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ const browser = require('@sentry/browser');
4
+ const core = require('@sentry/core');
5
+ const React = require('react');
6
+
7
+ /**
8
+ * See if React major version is 17+ by parsing version string.
9
+ */
10
+ function isAtLeastReact17(reactVersion) {
11
+ const reactMajor = reactVersion.match(/^([^.]+)/);
12
+ return reactMajor !== null && parseInt(reactMajor[0]) >= 17;
13
+ }
14
+
15
+ /**
16
+ * Recurse through `error.cause` chain to set cause on an error.
17
+ */
18
+ function setCause(error, cause) {
19
+ const seenErrors = new WeakSet();
20
+
21
+ function recurse(error, cause) {
22
+ // If we've already seen the error, there is a recursive loop somewhere in the error's
23
+ // cause chain. Let's just bail out then to prevent a stack overflow.
24
+ if (seenErrors.has(error)) {
25
+ return;
26
+ }
27
+ if (error.cause) {
28
+ seenErrors.add(error);
29
+ return recurse(error.cause, cause);
30
+ }
31
+ error.cause = cause;
32
+ }
33
+
34
+ recurse(error, cause);
35
+ }
36
+
37
+ /**
38
+ * Captures an error that was thrown by a React ErrorBoundary or React root.
39
+ *
40
+ * @param error The error to capture.
41
+ * @param errorInfo The errorInfo provided by React.
42
+ * @param hint Optional additional data to attach to the Sentry event.
43
+ * @returns the id of the captured Sentry event.
44
+ */
45
+ function captureReactException(
46
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
47
+ error,
48
+ { componentStack },
49
+ hint,
50
+ ) {
51
+ // If on React version >= 17, create stack trace from componentStack param and links
52
+ // to to the original error using `error.cause` otherwise relies on error param for stacktrace.
53
+ // Linking errors requires the `LinkedErrors` integration be enabled.
54
+ // See: https://reactjs.org/blog/2020/08/10/react-v17-rc.html#native-component-stacks
55
+ //
56
+ // Although `componentDidCatch` is typed to accept an `Error` object, it can also be invoked
57
+ // with non-error objects. This is why we need to check if the error is an error-like object.
58
+ // See: https://github.com/getsentry/sentry-javascript/issues/6167
59
+ if (isAtLeastReact17(React.version) && core.isError(error) && componentStack) {
60
+ const errorBoundaryError = new Error(error.message);
61
+ errorBoundaryError.name = `React ErrorBoundary ${error.name}`;
62
+ errorBoundaryError.stack = componentStack;
63
+
64
+ // Using the `LinkedErrors` integration to link the errors together.
65
+ setCause(error, errorBoundaryError);
66
+ }
67
+
68
+ return browser.withScope(scope => {
69
+ scope.setContext('react', { componentStack });
70
+ return browser.captureException(error, hint);
71
+ });
72
+ }
73
+
74
+ /**
75
+ * Creates an error handler that can be used with the `onCaughtError`, `onUncaughtError`,
76
+ * and `onRecoverableError` options in `createRoot` and `hydrateRoot` React DOM methods.
77
+ *
78
+ * @param callback An optional callback that will be called after the error is captured.
79
+ * Use this to add custom handling for errors.
80
+ *
81
+ * @example
82
+ *
83
+ * ```JavaScript
84
+ * const root = createRoot(container, {
85
+ * onCaughtError: Sentry.reactErrorHandler(),
86
+ * onUncaughtError: Sentry.reactErrorHandler((error, errorInfo) => {
87
+ * console.warn('Caught error', error, errorInfo.componentStack);
88
+ * });
89
+ * });
90
+ * ```
91
+ */
92
+ function reactErrorHandler(
93
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
94
+ callback,
95
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
96
+ ) {
97
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
98
+ return (error, errorInfo) => {
99
+ const hasCallback = !!callback;
100
+ const eventId = captureReactException(error, errorInfo, {
101
+ mechanism: { handled: hasCallback, type: 'auto.function.react.error_handler' },
102
+ });
103
+ if (hasCallback) {
104
+ callback(error, errorInfo, eventId);
105
+ }
106
+ };
107
+ }
108
+
109
+ exports.captureReactException = captureReactException;
110
+ exports.isAtLeastReact17 = isAtLeastReact17;
111
+ exports.reactErrorHandler = reactErrorHandler;
112
+ exports.setCause = setCause;
113
+ //# sourceMappingURL=error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.js","sources":["../../src/error.ts"],"sourcesContent":["import { captureException, withScope } from '@sentry/browser';\nimport { isError } from '@sentry/core';\nimport type { ErrorInfo } from 'react';\nimport { version } from 'react';\n\n/**\n * See if React major version is 17+ by parsing version string.\n */\nexport function isAtLeastReact17(reactVersion: string): boolean {\n const reactMajor = reactVersion.match(/^([^.]+)/);\n return reactMajor !== null && parseInt(reactMajor[0]) >= 17;\n}\n\n/**\n * Recurse through `error.cause` chain to set cause on an error.\n */\nexport function setCause(error: Error & { cause?: Error }, cause: Error): void {\n const seenErrors = new WeakSet();\n\n function recurse(error: Error & { cause?: Error }, cause: Error): void {\n // If we've already seen the error, there is a recursive loop somewhere in the error's\n // cause chain. Let's just bail out then to prevent a stack overflow.\n if (seenErrors.has(error)) {\n return;\n }\n if (error.cause) {\n seenErrors.add(error);\n return recurse(error.cause, cause);\n }\n error.cause = cause;\n }\n\n recurse(error, cause);\n}\n\n/**\n * Captures an error that was thrown by a React ErrorBoundary or React root.\n *\n * @param error The error to capture.\n * @param errorInfo The errorInfo provided by React.\n * @param hint Optional additional data to attach to the Sentry event.\n * @returns the id of the captured Sentry event.\n */\nexport function captureReactException(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n error: any,\n { componentStack }: ErrorInfo,\n hint?: Parameters<typeof captureException>[1],\n): string {\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 // See: https://reactjs.org/blog/2020/08/10/react-v17-rc.html#native-component-stacks\n //\n // Although `componentDidCatch` is typed to accept an `Error` object, it can also be invoked\n // with non-error objects. This is why we need to check if the error is an error-like object.\n // See: https://github.com/getsentry/sentry-javascript/issues/6167\n if (isAtLeastReact17(version) && isError(error) && componentStack) {\n const errorBoundaryError = new Error(error.message);\n errorBoundaryError.name = `React ErrorBoundary ${error.name}`;\n errorBoundaryError.stack = componentStack;\n\n // Using the `LinkedErrors` integration to link the errors together.\n setCause(error, errorBoundaryError);\n }\n\n return withScope(scope => {\n scope.setContext('react', { componentStack });\n return captureException(error, hint);\n });\n}\n\n/**\n * Creates an error handler that can be used with the `onCaughtError`, `onUncaughtError`,\n * and `onRecoverableError` options in `createRoot` and `hydrateRoot` React DOM methods.\n *\n * @param callback An optional callback that will be called after the error is captured.\n * Use this to add custom handling for errors.\n *\n * @example\n *\n * ```JavaScript\n * const root = createRoot(container, {\n * onCaughtError: Sentry.reactErrorHandler(),\n * onUncaughtError: Sentry.reactErrorHandler((error, errorInfo) => {\n * console.warn('Caught error', error, errorInfo.componentStack);\n * });\n * });\n * ```\n */\nexport function reactErrorHandler(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n callback?: (error: any, errorInfo: ErrorInfo, eventId: string) => void,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): (error: any, errorInfo: ErrorInfo) => void {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (error: any, errorInfo: ErrorInfo) => {\n const hasCallback = !!callback;\n const eventId = captureReactException(error, errorInfo, {\n mechanism: { handled: hasCallback, type: 'auto.function.react.error_handler' },\n });\n if (hasCallback) {\n callback(error, errorInfo, eventId);\n }\n };\n}\n"],"names":["version","isError","withScope","captureException"],"mappings":";;;;;;AAKA;AACA;AACA;AACO,SAAS,gBAAgB,CAAC,YAAY,EAAmB;AAChE,EAAE,MAAM,aAAa,YAAY,CAAC,KAAK,CAAC,UAAU,CAAC;AACnD,EAAE,OAAO,UAAA,KAAe,IAAA,IAAQ,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA,IAAK,EAAE;AAC7D;;AAEA;AACA;AACA;AACO,SAAS,QAAQ,CAAC,KAAK,EAA6B,KAAK,EAAe;AAC/E,EAAE,MAAM,UAAA,GAAa,IAAI,OAAO,EAAE;;AAElC,EAAE,SAAS,OAAO,CAAC,KAAK,EAA6B,KAAK,EAAe;AACzE;AACA;AACA,IAAI,IAAI,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;AAC/B,MAAM;AACN,IAAI;AACJ,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE;AACrB,MAAM,UAAU,CAAC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A,KAAA,EAAA,SAAA,EAAA;AACA,MAAA,SAAA,EAAA,EAAA,OAAA,EAAA,WAAA,EAAA,IAAA,EAAA,mCAAA,EAAA;AACA,KAAA,CAAA;AACA,IAAA,IAAA,WAAA,EAAA;AACA,MAAA,QAAA,CAAA,KAAA,EAAA,SAAA,EAAA,OAAA,CAAA;AACA,IAAA;AACA,EAAA,CAAA;AACA;;;;;;;"}
@@ -0,0 +1,170 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ const browser = require('@sentry/browser');
4
+ const core = require('@sentry/core');
5
+ const React = require('react');
6
+ const debugBuild = require('./debug-build.js');
7
+ const error = require('./error.js');
8
+ const hoistNonReactStatics = require('./hoist-non-react-statics.js');
9
+
10
+ const UNKNOWN_COMPONENT = 'unknown';
11
+
12
+ const INITIAL_STATE = {
13
+ componentStack: null,
14
+ error: null,
15
+ eventId: null,
16
+ };
17
+
18
+ /**
19
+ * A ErrorBoundary component that logs errors to Sentry.
20
+ * NOTE: If you are a Sentry user, and you are seeing this stack frame, it means the
21
+ * Sentry React SDK ErrorBoundary caught an error invoking your application code. This
22
+ * is expected behavior and NOT indicative of a bug with the Sentry React SDK.
23
+ */
24
+ class ErrorBoundary extends React.Component {
25
+
26
+ constructor(props) {
27
+ super(props);
28
+
29
+ this.state = INITIAL_STATE;
30
+ this._openFallbackReportDialog = true;
31
+
32
+ const client = browser.getClient();
33
+ if (client && props.showDialog) {
34
+ this._openFallbackReportDialog = false;
35
+ this._cleanupHook = client.on('afterSendEvent', event => {
36
+ if (!event.type && this._lastEventId && event.event_id === this._lastEventId) {
37
+ browser.showReportDialog({ ...props.dialogOptions, eventId: this._lastEventId });
38
+ }
39
+ });
40
+ }
41
+ }
42
+
43
+ componentDidCatch(error$1, errorInfo) {
44
+ const { componentStack } = errorInfo;
45
+ const { beforeCapture, onError, showDialog, dialogOptions } = this.props;
46
+ browser.withScope(scope => {
47
+ if (beforeCapture) {
48
+ beforeCapture(scope, error$1, componentStack);
49
+ }
50
+
51
+ const handled = this.props.handled != null ? this.props.handled : !!this.props.fallback;
52
+ const eventId = error.captureReactException(error$1, errorInfo, {
53
+ mechanism: { handled, type: 'auto.function.react.error_boundary' },
54
+ });
55
+
56
+ if (onError) {
57
+ onError(error$1, componentStack, eventId);
58
+ }
59
+ if (showDialog) {
60
+ this._lastEventId = eventId;
61
+ if (this._openFallbackReportDialog) {
62
+ browser.showReportDialog({ ...dialogOptions, eventId });
63
+ }
64
+ }
65
+
66
+ // componentDidCatch is used over getDerivedStateFromError
67
+ // so that componentStack is accessible through state.
68
+ this.setState({ error: error$1, componentStack, eventId });
69
+ });
70
+ }
71
+
72
+ componentDidMount() {
73
+ const { onMount } = this.props;
74
+ if (onMount) {
75
+ onMount();
76
+ }
77
+ }
78
+
79
+ componentWillUnmount() {
80
+ const { error, componentStack, eventId } = this.state;
81
+ const { onUnmount } = this.props;
82
+ if (onUnmount) {
83
+ if (this.state === INITIAL_STATE) {
84
+ // If the error boundary never encountered an error, call onUnmount with null values
85
+ onUnmount(null, null, null);
86
+ } else {
87
+ // `componentStack` and `eventId` are guaranteed to be non-null here because `onUnmount` is only called
88
+ // when the error boundary has already encountered an error.
89
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
90
+ onUnmount(error, componentStack, eventId);
91
+ }
92
+ }
93
+
94
+ if (this._cleanupHook) {
95
+ this._cleanupHook();
96
+ this._cleanupHook = undefined;
97
+ }
98
+ }
99
+
100
+ resetErrorBoundary() {
101
+ const { onReset } = this.props;
102
+ const { error, componentStack, eventId } = this.state;
103
+ if (onReset) {
104
+ // `componentStack` and `eventId` are guaranteed to be non-null here because `onReset` is only called
105
+ // when the error boundary has already encountered an error.
106
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
107
+ onReset(error, componentStack, eventId);
108
+ }
109
+ this.setState(INITIAL_STATE);
110
+ }
111
+
112
+ render() {
113
+ const { fallback, children } = this.props;
114
+ const state = this.state;
115
+
116
+ // `componentStack` is only null in the initial state, when no error has been captured.
117
+ // If an error has been captured, `componentStack` will be a string.
118
+ // We cannot check `state.error` because null can be thrown as an error.
119
+ if (state.componentStack === null) {
120
+ return typeof children === 'function' ? children() : children;
121
+ }
122
+
123
+ const element =
124
+ typeof fallback === 'function'
125
+ ? React.createElement(fallback, {
126
+ error: state.error,
127
+ componentStack: state.componentStack,
128
+ resetError: () => this.resetErrorBoundary(),
129
+ eventId: state.eventId,
130
+ })
131
+ : fallback;
132
+
133
+ if (React.isValidElement(element)) {
134
+ return element;
135
+ }
136
+
137
+ if (fallback) {
138
+ debugBuild.DEBUG_BUILD && core.debug.warn('fallback did not produce a valid ReactElement');
139
+ }
140
+
141
+ // Fail gracefully if no fallback provided or is not valid
142
+ return null;
143
+ }
144
+ }
145
+
146
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
147
+ function withErrorBoundary(
148
+ WrappedComponent,
149
+ errorBoundaryOptions,
150
+ ) {
151
+ const componentDisplayName = WrappedComponent.displayName || WrappedComponent.name || UNKNOWN_COMPONENT;
152
+
153
+ const Wrapped = React.memo((props) => (
154
+ React.createElement(ErrorBoundary, { ...errorBoundaryOptions,}
155
+ , React.createElement(WrappedComponent, { ...props,} )
156
+ )
157
+ )) ;
158
+
159
+ Wrapped.displayName = `errorBoundary(${componentDisplayName})`;
160
+
161
+ // Copy over static methods from Wrapped component to Profiler HOC
162
+ // See: https://reactjs.org/docs/higher-order-components.html#static-methods-must-be-copied-over
163
+ hoistNonReactStatics.hoistNonReactStatics(Wrapped, WrappedComponent);
164
+ return Wrapped;
165
+ }
166
+
167
+ exports.ErrorBoundary = ErrorBoundary;
168
+ exports.UNKNOWN_COMPONENT = UNKNOWN_COMPONENT;
169
+ exports.withErrorBoundary = withErrorBoundary;
170
+ //# sourceMappingURL=errorboundary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errorboundary.js","sources":["../../src/errorboundary.tsx"],"sourcesContent":["import type { ReportDialogOptions } from '@sentry/browser';\nimport { getClient, showReportDialog, withScope } from '@sentry/browser';\nimport type { Scope } from '@sentry/core';\nimport { debug } from '@sentry/core';\nimport * as React from 'react';\nimport { DEBUG_BUILD } from './debug-build';\nimport { captureReactException } from './error';\nimport { hoistNonReactStatics } from './hoist-non-react-statics';\n\nexport const UNKNOWN_COMPONENT = 'unknown';\n\nexport type FallbackRender = (errorData: {\n error: unknown;\n componentStack: string;\n eventId: string;\n resetError(): void;\n}) => React.ReactElement;\n\ntype OnUnmountType = {\n (error: null, componentStack: null, eventId: null): void;\n (error: unknown, componentStack: string, eventId: string): void;\n};\n\nexport type ErrorBoundaryProps = {\n children?: React.ReactNode | (() => React.ReactNode);\n /** If a Sentry report dialog should be rendered on error */\n showDialog?: boolean | undefined;\n /**\n * Options to be passed into the Sentry report dialog.\n * No-op if {@link showDialog} is false.\n */\n dialogOptions?: ReportDialogOptions | undefined;\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 | undefined;\n /**\n * If set to `true` or `false`, the error `handled` property will be set to the given value.\n * If unset, the default behaviour is to rely on the presence of the `fallback` prop to determine\n * if the error was handled or not.\n */\n handled?: boolean | undefined;\n /** Called when the error boundary encounters an error */\n onError?: ((error: unknown, componentStack: string, eventId: string) => void) | undefined;\n /** Called on componentDidMount() */\n onMount?: (() => void) | undefined;\n /**\n * Called when the error boundary resets due to a reset call from the\n * fallback render props function.\n */\n onReset?: ((error: unknown, componentStack: string, eventId: string) => void) | undefined;\n /**\n * Called on componentWillUnmount() with the error, componentStack, and eventId.\n *\n * If the error boundary never encountered an error, the error\n * componentStack, and eventId will be null.\n */\n onUnmount?: OnUnmountType | undefined;\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: unknown, componentStack: string) => void) | undefined;\n};\n\ntype ErrorBoundaryState =\n | {\n componentStack: null;\n error: null;\n eventId: null;\n }\n | {\n componentStack: React.ErrorInfo['componentStack'];\n error: unknown;\n eventId: string;\n };\n\nconst INITIAL_STATE: ErrorBoundaryState = {\n componentStack: null,\n error: null,\n eventId: null,\n};\n\n/**\n * A ErrorBoundary component that logs errors to Sentry.\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;\n\n private readonly _openFallbackReportDialog: boolean;\n\n private _lastEventId?: string;\n private _cleanupHook?: () => void;\n\n public constructor(props: ErrorBoundaryProps) {\n super(props);\n\n this.state = INITIAL_STATE;\n this._openFallbackReportDialog = true;\n\n const client = getClient();\n if (client && props.showDialog) {\n this._openFallbackReportDialog = false;\n this._cleanupHook = client.on('afterSendEvent', event => {\n if (!event.type && this._lastEventId && event.event_id === this._lastEventId) {\n showReportDialog({ ...props.dialogOptions, eventId: this._lastEventId });\n }\n });\n }\n }\n\n public componentDidCatch(error: unknown, errorInfo: React.ErrorInfo): void {\n const { componentStack } = errorInfo;\n const { beforeCapture, onError, showDialog, dialogOptions } = this.props;\n withScope(scope => {\n if (beforeCapture) {\n beforeCapture(scope, error, componentStack);\n }\n\n const handled = this.props.handled != null ? this.props.handled : !!this.props.fallback;\n const eventId = captureReactException(error, errorInfo, {\n mechanism: { handled, type: 'auto.function.react.error_boundary' },\n });\n\n if (onError) {\n onError(error, componentStack, eventId);\n }\n if (showDialog) {\n this._lastEventId = eventId;\n if (this._openFallbackReportDialog) {\n showReportDialog({ ...dialogOptions, eventId });\n }\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 if (this.state === INITIAL_STATE) {\n // If the error boundary never encountered an error, call onUnmount with null values\n onUnmount(null, null, null);\n } else {\n // `componentStack` and `eventId` are guaranteed to be non-null here because `onUnmount` is only called\n // when the error boundary has already encountered an error.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n onUnmount(error, componentStack!, eventId!);\n }\n }\n\n if (this._cleanupHook) {\n this._cleanupHook();\n this._cleanupHook = undefined;\n }\n }\n\n public resetErrorBoundary(): void {\n const { onReset } = this.props;\n const { error, componentStack, eventId } = this.state;\n if (onReset) {\n // `componentStack` and `eventId` are guaranteed to be non-null here because `onReset` is only called\n // when the error boundary has already encountered an error.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\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 state = this.state;\n\n // `componentStack` is only null in the initial state, when no error has been captured.\n // If an error has been captured, `componentStack` will be a string.\n // We cannot check `state.error` because null can be thrown as an error.\n if (state.componentStack === null) {\n return typeof children === 'function' ? children() : children;\n }\n\n const element =\n typeof fallback === 'function'\n ? React.createElement(fallback, {\n error: state.error,\n componentStack: state.componentStack,\n resetError: () => this.resetErrorBoundary(),\n eventId: state.eventId,\n })\n : fallback;\n\n if (React.isValidElement(element)) {\n return element;\n }\n\n if (fallback) {\n DEBUG_BUILD && debug.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\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 const componentDisplayName = WrappedComponent.displayName || WrappedComponent.name || UNKNOWN_COMPONENT;\n\n const Wrapped = React.memo((props: P) => (\n <ErrorBoundary {...errorBoundaryOptions}>\n <WrappedComponent {...props} />\n </ErrorBoundary>\n )) as unknown as React.FC<P>;\n\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":["getClient","showReportDialog","error","withScope","captureReactException","DEBUG_BUILD","debug","hoistNonReactStatics"],"mappings":";;;;;;;;;AASO,MAAM,iBAAA,GAAoB;;AAsEjC,MAAM,aAAa,GAAuB;AAC1C,EAAE,cAAc,EAAE,IAAI;AACtB,EAAE,KAAK,EAAE,IAAI;AACb,EAAE,OAAO,EAAE,IAAI;AACf,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,aAAA,SAAsB,KAAK,CAAC,SAAS,CAAyC;;AAQpF,GAAS,WAAW,CAAC,KAAK,EAAsB;AAChD,IAAI,KAAK,CAAC,KAAK,CAAC;;AAEhB,IAAI,IAAI,CAAC,KAAA,GAAQ,aAAa;AAC9B,IAAI,IAAI,CAAC,yBAAA,GAA4B,IAAI;;AAEzC,IAAI,MAAM,MAAA,GAASA,iBAAS,EAAE;AAC9B,IAAI,IAAI,MAAA,IAAU,KAAK,CAAC,UAAU,EAAE;AACpC,MAAM,IAAI,CAAC,yBAAA,GAA4B,KAAK;AAC5C,MAAM,IAAI,CAAC,YAAA,GAAe,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,KAAA,IAAS;AAC/D,QAAQ,IAAI,CAAC,KAAK,CAAC,IAAA,IAAQ,IAAI,CAAC,YAAA,IAAgB,KAAK,CAAC,QAAA,KAAa,IAAI,CAAC,YAAY,EAAE;AACtF,UAAUC,wBAAgB,CAAC,EAAE,GAAG,KAAK,CAAC,aAAa,EAAE,OAAO,EAAE,IAAI,CAAC,YAAA,EAAc,CAAC;AAClF,QAAQ;AACR,MA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
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ /**
4
+ * React statics that should not be hoisted
5
+ */
6
+ const REACT_STATICS = {
7
+ childContextTypes: true,
8
+ contextType: true,
9
+ contextTypes: true,
10
+ defaultProps: true,
11
+ displayName: true,
12
+ getDefaultProps: true,
13
+ getDerivedStateFromError: true,
14
+ getDerivedStateFromProps: true,
15
+ mixins: true,
16
+ propTypes: true,
17
+ type: true,
18
+ } ;
19
+
20
+ /**
21
+ * Known JavaScript function statics that should not be hoisted
22
+ */
23
+ const KNOWN_STATICS = {
24
+ name: true,
25
+ length: true,
26
+ prototype: true,
27
+ caller: true,
28
+ callee: true,
29
+ arguments: true,
30
+ arity: true,
31
+ } ;
32
+
33
+ /**
34
+ * Statics specific to ForwardRef components
35
+ */
36
+ const FORWARD_REF_STATICS = {
37
+ $$typeof: true,
38
+ render: true,
39
+ defaultProps: true,
40
+ displayName: true,
41
+ propTypes: true,
42
+ } ;
43
+
44
+ /**
45
+ * Statics specific to Memo components
46
+ */
47
+ const MEMO_STATICS = {
48
+ $$typeof: true,
49
+ compare: true,
50
+ defaultProps: true,
51
+ displayName: true,
52
+ propTypes: true,
53
+ type: true,
54
+ } ;
55
+
56
+ /**
57
+ * Inlined react-is utilities
58
+ * We only need to detect ForwardRef and Memo types
59
+ */
60
+ const ForwardRefType = Symbol.for('react.forward_ref');
61
+ const MemoType = Symbol.for('react.memo');
62
+
63
+ /**
64
+ * Check if a component is a Memo component
65
+ */
66
+ function isMemo(component) {
67
+ return (
68
+ typeof component === 'object' && component !== null && (component ).$$typeof === MemoType
69
+ );
70
+ }
71
+
72
+ /**
73
+ * Map of React component types to their specific statics
74
+ */
75
+ const TYPE_STATICS = {};
76
+ TYPE_STATICS[ForwardRefType] = FORWARD_REF_STATICS;
77
+ TYPE_STATICS[MemoType] = MEMO_STATICS;
78
+
79
+ /**
80
+ * Get the appropriate statics object for a given component
81
+ */
82
+ function getStatics(component) {
83
+ // React v16.11 and below
84
+ if (isMemo(component)) {
85
+ return MEMO_STATICS;
86
+ }
87
+
88
+ // React v16.12 and above
89
+ const componentType = (component ).$$typeof;
90
+ return (componentType && TYPE_STATICS[componentType]) || REACT_STATICS;
91
+ }
92
+
93
+ const defineProperty = Object.defineProperty.bind(Object);
94
+ const getOwnPropertyNames = Object.getOwnPropertyNames.bind(Object);
95
+ const getOwnPropertySymbols = Object.getOwnPropertySymbols?.bind(Object);
96
+ const getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor.bind(Object);
97
+ const getPrototypeOf = Object.getPrototypeOf.bind(Object);
98
+ const objectPrototype = Object.prototype;
99
+
100
+ /**
101
+ * Copies non-react specific statics from a child component to a parent component.
102
+ * Similar to Object.assign, but copies all static properties from source to target,
103
+ * excluding React-specific statics and known JavaScript statics.
104
+ *
105
+ * @param targetComponent - The component to copy statics to
106
+ * @param sourceComponent - The component to copy statics from
107
+ * @param excludelist - An optional object of keys to exclude from hoisting
108
+ * @returns The target component with hoisted statics
109
+ */
110
+ function hoistNonReactStatics
111
+
112
+ (targetComponent, sourceComponent, excludelist) {
113
+ if (typeof sourceComponent !== 'string') {
114
+ // Don't hoist over string (html) components
115
+ if (objectPrototype) {
116
+ const inheritedComponent = getPrototypeOf(sourceComponent);
117
+
118
+ if (inheritedComponent && inheritedComponent !== objectPrototype) {
119
+ hoistNonReactStatics(targetComponent, inheritedComponent);
120
+ }
121
+ }
122
+
123
+ let keys = getOwnPropertyNames(sourceComponent);
124
+
125
+ if (getOwnPropertySymbols) {
126
+ keys = keys.concat(getOwnPropertySymbols(sourceComponent));
127
+ }
128
+
129
+ const targetStatics = getStatics(targetComponent);
130
+ const sourceStatics = getStatics(sourceComponent);
131
+
132
+ for (const key of keys) {
133
+ // Use key directly - String(key) throws for Symbols if minified to '' + key (#18966)
134
+ if (
135
+ !KNOWN_STATICS[key ] &&
136
+ true &&
137
+ !sourceStatics?.[key ] &&
138
+ !targetStatics?.[key ] &&
139
+ !getOwnPropertyDescriptor(targetComponent, key) // Don't overwrite existing properties
140
+ ) {
141
+ const descriptor = getOwnPropertyDescriptor(sourceComponent, key);
142
+
143
+ if (descriptor) {
144
+ try {
145
+ // Avoid failures from read-only properties
146
+ defineProperty(targetComponent, key, descriptor);
147
+ } catch (_e) {
148
+ // Silently ignore errors
149
+ }
150
+ }
151
+ }
152
+ }
153
+ }
154
+
155
+ return targetComponent;
156
+ }
157
+
158
+ exports.hoistNonReactStatics = hoistNonReactStatics;
159
+ //# sourceMappingURL=hoist-non-react-statics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hoist-non-react-statics.js","sources":["../../src/hoist-non-react-statics.ts"],"sourcesContent":["/**\n * Inlined implementation of hoist-non-react-statics\n * Original library: https://github.com/mridgway/hoist-non-react-statics\n * License: BSD-3-Clause\n * Copyright 2015, Yahoo! Inc.\n *\n * This is an inlined version to avoid ESM compatibility issues with the original package.\n */\n\nimport type * as React from 'react';\n\n/**\n * React statics that should not be hoisted\n */\nconst REACT_STATICS = {\n childContextTypes: true,\n contextType: true,\n contextTypes: true,\n defaultProps: true,\n displayName: true,\n getDefaultProps: true,\n getDerivedStateFromError: true,\n getDerivedStateFromProps: true,\n mixins: true,\n propTypes: true,\n type: true,\n} as const;\n\n/**\n * Known JavaScript function statics that should not be hoisted\n */\nconst KNOWN_STATICS = {\n name: true,\n length: true,\n prototype: true,\n caller: true,\n callee: true,\n arguments: true,\n arity: true,\n} as const;\n\n/**\n * Statics specific to ForwardRef components\n */\nconst FORWARD_REF_STATICS = {\n $$typeof: true,\n render: true,\n defaultProps: true,\n displayName: true,\n propTypes: true,\n} as const;\n\n/**\n * Statics specific to Memo components\n */\nconst MEMO_STATICS = {\n $$typeof: true,\n compare: true,\n defaultProps: true,\n displayName: true,\n propTypes: true,\n type: true,\n} as const;\n\n/**\n * Inlined react-is utilities\n * We only need to detect ForwardRef and Memo types\n */\nconst ForwardRefType = Symbol.for('react.forward_ref');\nconst MemoType = Symbol.for('react.memo');\n\n/**\n * Check if a component is a Memo component\n */\nfunction isMemo(component: unknown): boolean {\n return (\n typeof component === 'object' && component !== null && (component as { $$typeof?: symbol }).$$typeof === MemoType\n );\n}\n\n/**\n * Map of React component types to their specific statics\n */\nconst TYPE_STATICS: Record<symbol, Record<string, boolean>> = {};\nTYPE_STATICS[ForwardRefType] = FORWARD_REF_STATICS;\nTYPE_STATICS[MemoType] = MEMO_STATICS;\n\n/**\n * Get the appropriate statics object for a given component\n */\nfunction getStatics(component: React.ComponentType<unknown>): Record<string, boolean> {\n // React v16.11 and below\n if (isMemo(component)) {\n return MEMO_STATICS;\n }\n\n // React v16.12 and above\n const componentType = (component as { $$typeof?: symbol }).$$typeof;\n return (componentType && TYPE_STATICS[componentType]) || REACT_STATICS;\n}\n\nconst defineProperty = Object.defineProperty.bind(Object);\nconst getOwnPropertyNames = Object.getOwnPropertyNames.bind(Object);\nconst getOwnPropertySymbols = Object.getOwnPropertySymbols?.bind(Object);\nconst getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor.bind(Object);\nconst getPrototypeOf = Object.getPrototypeOf.bind(Object);\nconst objectPrototype = Object.prototype;\n\n/**\n * Copies non-react specific statics from a child component to a parent component.\n * Similar to Object.assign, but copies all static properties from source to target,\n * excluding React-specific statics and known JavaScript statics.\n *\n * @param targetComponent - The component to copy statics to\n * @param sourceComponent - The component to copy statics from\n * @param excludelist - An optional object of keys to exclude from hoisting\n * @returns The target component with hoisted statics\n */\nexport function hoistNonReactStatics<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n T extends React.ComponentType<any>,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n S extends React.ComponentType<any>,\n C extends Record<string, boolean> = Record<string, never>,\n>(targetComponent: T, sourceComponent: S, excludelist?: C): T {\n if (typeof sourceComponent !== 'string') {\n // Don't hoist over string (html) components\n if (objectPrototype) {\n const inheritedComponent = getPrototypeOf(sourceComponent);\n\n if (inheritedComponent && inheritedComponent !== objectPrototype) {\n hoistNonReactStatics(targetComponent, inheritedComponent, excludelist);\n }\n }\n\n let keys: (string | symbol)[] = getOwnPropertyNames(sourceComponent);\n\n if (getOwnPropertySymbols) {\n keys = keys.concat(getOwnPropertySymbols(sourceComponent));\n }\n\n const targetStatics = getStatics(targetComponent);\n const sourceStatics = getStatics(sourceComponent);\n\n for (const key of keys) {\n // Use key directly - String(key) throws for Symbols if minified to '' + key (#18966)\n if (\n !KNOWN_STATICS[key as keyof typeof KNOWN_STATICS] &&\n !excludelist?.[key as keyof C] &&\n !sourceStatics?.[key as string] &&\n !targetStatics?.[key as string] &&\n !getOwnPropertyDescriptor(targetComponent, key) // Don't overwrite existing properties\n ) {\n const descriptor = getOwnPropertyDescriptor(sourceComponent, key);\n\n if (descriptor) {\n try {\n // Avoid failures from read-only properties\n defineProperty(targetComponent, key, descriptor);\n } catch (_e) {\n // Silently ignore errors\n }\n }\n }\n }\n }\n\n return targetComponent;\n}\n"],"names":[],"mappings":";;AAWA;AACA;AACA;AACA,MAAM,gBAAgB;AACtB,EAAE,iBAAiB,EAAE,IAAI;AACzB,EAAE,WAAW,EAAE,IAAI;AACnB,EAAE,YAAY,EAAE,IAAI;AACpB,EAAE,YAAY,EAAE,IAAI;AACpB,EAAE,WAAW,EAAE,IAAI;AACnB,EAAE,eAAe,EAAE,IAAI;AACvB,EAAE,wBAAwB,EAAE,IAAI;AAChC,EAAE,wBAAwB,EAAE,IAAI;AAChC,EAAE,MAAM,EAAE,IAAI;AACd,EAAE,SAAS,EAAE,IAAI;AACjB,EAAE,IAAI,EAAE,IAAI;AACZ,CAAA;;AAEA;AACA;AACA;AACA,MAAM,gBAAgB;AACtB,EAAE,IAAI,EAAE,IAAI;AACZ,EAAE,MAAM,EAAE,IAAI;AACd,EAAE,SAAS,EAAE,IAAI;AACjB,EAAE,MAAM,EAAE,IAAI;AACd,EAAE,MAAM,EAAE,IAAI;AACd,EAAE,SAAS,EAAE,IAAI;AACjB,EAAE,KAAK,EAAE,IAAI;AACb,CAAA;;AAEA;AACA;AACA;AACA,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QAAQ,CAAC,wBAAwB,CAAC,eAAe,EAAE,GAAG,CAAA;AACtD,QAAQ;AACR,QAAQ,MAAM,aAAa,wBAAwB,CAAC,eAAe,EAAE,GAAG,CAAC;;AAEzE,QAAQ,IAAI,UAAU,EAAE;AACxB,UAAU,IAAI;AACd;AACA,YAAY,cAAc,CAAC,eAAe,EAAE,GAAG,EAAE,UAAU,CAAC;AAC5D,UAAU,CAAA,CAAE,OAAO,EAAE,EAAE;AACvB;AACA,UAAU;AACV,QAAQ;AACR,MAAM;AACN,IAAI;AACJ,EAAE;;AAEF,EAAE,OAAO,eAAe;AACxB;;;;"}
@@ -0,0 +1,51 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ const browser = require('@sentry/browser');
4
+ const sdk = require('./sdk.js');
5
+ const error = require('./error.js');
6
+ const profiler = require('./profiler.js');
7
+ const errorboundary = require('./errorboundary.js');
8
+ const redux = require('./redux.js');
9
+ const reactrouterv3 = require('./reactrouterv3.js');
10
+ const tanstackrouter = require('./tanstackrouter.js');
11
+ const reactrouter = require('./reactrouter.js');
12
+ const reactrouterv6 = require('./reactrouterv6.js');
13
+ const reactrouterv7 = require('./reactrouterv7.js');
14
+
15
+
16
+
17
+ exports.init = sdk.init;
18
+ exports.captureReactException = error.captureReactException;
19
+ exports.reactErrorHandler = error.reactErrorHandler;
20
+ exports.Profiler = profiler.Profiler;
21
+ exports.useProfiler = profiler.useProfiler;
22
+ exports.withProfiler = profiler.withProfiler;
23
+ exports.ErrorBoundary = errorboundary.ErrorBoundary;
24
+ exports.withErrorBoundary = errorboundary.withErrorBoundary;
25
+ exports.createReduxEnhancer = redux.createReduxEnhancer;
26
+ exports.reactRouterV3BrowserTracingIntegration = reactrouterv3.reactRouterV3BrowserTracingIntegration;
27
+ exports.tanstackRouterBrowserTracingIntegration = tanstackrouter.tanstackRouterBrowserTracingIntegration;
28
+ exports.reactRouterV4BrowserTracingIntegration = reactrouter.reactRouterV4BrowserTracingIntegration;
29
+ exports.reactRouterV5BrowserTracingIntegration = reactrouter.reactRouterV5BrowserTracingIntegration;
30
+ exports.withSentryRouting = reactrouter.withSentryRouting;
31
+ exports.reactRouterV6BrowserTracingIntegration = reactrouterv6.reactRouterV6BrowserTracingIntegration;
32
+ exports.withSentryReactRouterV6Routing = reactrouterv6.withSentryReactRouterV6Routing;
33
+ exports.wrapCreateBrowserRouterV6 = reactrouterv6.wrapCreateBrowserRouterV6;
34
+ exports.wrapCreateMemoryRouterV6 = reactrouterv6.wrapCreateMemoryRouterV6;
35
+ exports.wrapUseRoutesV6 = reactrouterv6.wrapUseRoutesV6;
36
+ exports.reactRouterV7BrowserTracingIntegration = reactrouterv7.reactRouterV7BrowserTracingIntegration;
37
+ exports.withSentryReactRouterV7Routing = reactrouterv7.withSentryReactRouterV7Routing;
38
+ exports.wrapCreateBrowserRouterV7 = reactrouterv7.wrapCreateBrowserRouterV7;
39
+ exports.wrapCreateMemoryRouterV7 = reactrouterv7.wrapCreateMemoryRouterV7;
40
+ exports.wrapUseRoutesV7 = reactrouterv7.wrapUseRoutesV7;
41
+ Object.prototype.hasOwnProperty.call(browser, '__proto__') &&
42
+ !Object.prototype.hasOwnProperty.call(exports, '__proto__') &&
43
+ Object.defineProperty(exports, '__proto__', {
44
+ enumerable: true,
45
+ value: browser['__proto__']
46
+ });
47
+
48
+ Object.keys(browser).forEach(k => {
49
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = browser[k];
50
+ });
51
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}