@sentry/react 10.53.0 → 10.54.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 (70) hide show
  1. package/build/cjs/constants.js +3 -5
  2. package/build/cjs/constants.js.map +1 -1
  3. package/build/cjs/debug-build.js +0 -5
  4. package/build/cjs/debug-build.js.map +1 -1
  5. package/build/cjs/error.js +12 -72
  6. package/build/cjs/error.js.map +1 -1
  7. package/build/cjs/errorboundary.js +22 -77
  8. package/build/cjs/errorboundary.js.map +1 -1
  9. package/build/cjs/hoist-non-react-statics.js +16 -84
  10. package/build/cjs/hoist-non-react-statics.js.map +1 -1
  11. package/build/cjs/profiler.js +35 -110
  12. package/build/cjs/profiler.js.map +1 -1
  13. package/build/cjs/reactrouter-compat-utils/instrumentation.js +219 -690
  14. package/build/cjs/reactrouter-compat-utils/instrumentation.js.map +1 -1
  15. package/build/cjs/reactrouter-compat-utils/lazy-routes.js +24 -85
  16. package/build/cjs/reactrouter-compat-utils/lazy-routes.js.map +1 -1
  17. package/build/cjs/reactrouter-compat-utils/route-manifest.js +17 -95
  18. package/build/cjs/reactrouter-compat-utils/route-manifest.js.map +1 -1
  19. package/build/cjs/reactrouter-compat-utils/utils.js +48 -190
  20. package/build/cjs/reactrouter-compat-utils/utils.js.map +1 -1
  21. package/build/cjs/reactrouter.js +33 -113
  22. package/build/cjs/reactrouter.js.map +1 -1
  23. package/build/cjs/reactrouterv3.js +27 -59
  24. package/build/cjs/reactrouterv3.js.map +1 -1
  25. package/build/cjs/reactrouterv6.js +8 -41
  26. package/build/cjs/reactrouterv6.js.map +1 -1
  27. package/build/cjs/reactrouterv7.js +8 -41
  28. package/build/cjs/reactrouterv7.js.map +1 -1
  29. package/build/cjs/redux.js +60 -88
  30. package/build/cjs/redux.js.map +1 -1
  31. package/build/cjs/sdk.js +3 -7
  32. package/build/cjs/sdk.js.map +1 -1
  33. package/build/cjs/tanstackrouter.js +24 -64
  34. package/build/cjs/tanstackrouter.js.map +1 -1
  35. package/build/esm/constants.js +3 -5
  36. package/build/esm/constants.js.map +1 -1
  37. package/build/esm/debug-build.js +0 -5
  38. package/build/esm/debug-build.js.map +1 -1
  39. package/build/esm/error.js +12 -72
  40. package/build/esm/error.js.map +1 -1
  41. package/build/esm/errorboundary.js +22 -77
  42. package/build/esm/errorboundary.js.map +1 -1
  43. package/build/esm/hoist-non-react-statics.js +16 -84
  44. package/build/esm/hoist-non-react-statics.js.map +1 -1
  45. package/build/esm/package.json +1 -1
  46. package/build/esm/profiler.js +35 -110
  47. package/build/esm/profiler.js.map +1 -1
  48. package/build/esm/reactrouter-compat-utils/instrumentation.js +219 -690
  49. package/build/esm/reactrouter-compat-utils/instrumentation.js.map +1 -1
  50. package/build/esm/reactrouter-compat-utils/lazy-routes.js +24 -85
  51. package/build/esm/reactrouter-compat-utils/lazy-routes.js.map +1 -1
  52. package/build/esm/reactrouter-compat-utils/route-manifest.js +17 -95
  53. package/build/esm/reactrouter-compat-utils/route-manifest.js.map +1 -1
  54. package/build/esm/reactrouter-compat-utils/utils.js +48 -190
  55. package/build/esm/reactrouter-compat-utils/utils.js.map +1 -1
  56. package/build/esm/reactrouter.js +33 -113
  57. package/build/esm/reactrouter.js.map +1 -1
  58. package/build/esm/reactrouterv3.js +27 -59
  59. package/build/esm/reactrouterv3.js.map +1 -1
  60. package/build/esm/reactrouterv6.js +8 -41
  61. package/build/esm/reactrouterv6.js.map +1 -1
  62. package/build/esm/reactrouterv7.js +8 -41
  63. package/build/esm/reactrouterv7.js.map +1 -1
  64. package/build/esm/redux.js +60 -88
  65. package/build/esm/redux.js.map +1 -1
  66. package/build/esm/sdk.js +3 -7
  67. package/build/esm/sdk.js.map +1 -1
  68. package/build/esm/tanstackrouter.js +24 -64
  69. package/build/esm/tanstackrouter.js.map +1 -1
  70. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"tanstackrouter.js","sources":["../../src/tanstackrouter.ts"],"sourcesContent":["import {\n browserTracingIntegration as originalBrowserTracingIntegration,\n startBrowserTracingNavigationSpan,\n startBrowserTracingPageLoadSpan,\n WINDOW,\n} from '@sentry/browser';\nimport type { Integration } from '@sentry/core/browser';\nimport {\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n} from '@sentry/core/browser';\nimport type { VendoredTanstackRouter, VendoredTanstackRouterRouteMatch } from './vendor/tanstackrouter-types';\n\n/**\n * A custom browser tracing integration for TanStack Router.\n *\n * The minimum compatible version of `@tanstack/react-router` is `1.64.0`.\n *\n * @param router A TanStack Router `Router` instance that should be used for routing instrumentation.\n * @param options Sentry browser tracing configuration.\n */\nexport function tanstackRouterBrowserTracingIntegration(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n router: any, // This is `any` because we don't want any type mismatches if TanStack Router changes their types\n options: Parameters<typeof originalBrowserTracingIntegration>[0] = {},\n): Integration {\n const castRouterInstance: VendoredTanstackRouter = router;\n\n const browserTracingIntegrationInstance = originalBrowserTracingIntegration({\n ...options,\n instrumentNavigation: false,\n instrumentPageLoad: false,\n });\n\n const { instrumentPageLoad = true, instrumentNavigation = true } = options;\n\n return {\n ...browserTracingIntegrationInstance,\n afterAllSetup(client) {\n browserTracingIntegrationInstance.afterAllSetup(client);\n\n const initialWindowLocation = WINDOW.location;\n if (instrumentPageLoad && initialWindowLocation) {\n const matchedRoutes = castRouterInstance.matchRoutes(\n initialWindowLocation.pathname,\n castRouterInstance.options.parseSearch(initialWindowLocation.search),\n { preload: false, throwOnError: false },\n );\n\n const lastMatch = matchedRoutes[matchedRoutes.length - 1];\n // If we only match __root__, we ended up not matching any route at all, so\n // we fall back to the pathname.\n const routeMatch = lastMatch?.routeId !== '__root__' ? lastMatch : undefined;\n\n startBrowserTracingPageLoadSpan(client, {\n name: routeMatch ? routeMatch.routeId : initialWindowLocation.pathname,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.tanstack_router',\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: routeMatch ? 'route' : 'url',\n ...routeMatchToParamSpanAttributes(routeMatch),\n },\n });\n }\n\n if (instrumentNavigation) {\n // The onBeforeNavigate hook is called at the very beginning of a navigation and is only called once per navigation, even when the user is redirected\n castRouterInstance.subscribe('onBeforeNavigate', onBeforeNavigateArgs => {\n // onBeforeNavigate is called during pageloads. We can avoid creating navigation spans by:\n // 1. Checking if there's no fromLocation (initial pageload)\n // 2. Comparing the states of the to and from arguments\n if (\n !onBeforeNavigateArgs.fromLocation ||\n onBeforeNavigateArgs.toLocation.state === onBeforeNavigateArgs.fromLocation.state\n ) {\n return;\n }\n\n const matchedRoutesOnBeforeNavigate = castRouterInstance.matchRoutes(\n onBeforeNavigateArgs.toLocation.pathname,\n onBeforeNavigateArgs.toLocation.search,\n { preload: false, throwOnError: false },\n );\n\n const onBeforeNavigateLastMatch = matchedRoutesOnBeforeNavigate[matchedRoutesOnBeforeNavigate.length - 1];\n const onBeforeNavigateRouteMatch =\n onBeforeNavigateLastMatch?.routeId !== '__root__' ? onBeforeNavigateLastMatch : undefined;\n\n const navigationLocation = WINDOW.location;\n const navigationSpan = startBrowserTracingNavigationSpan(client, {\n name: onBeforeNavigateRouteMatch ? onBeforeNavigateRouteMatch.routeId : navigationLocation.pathname,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.tanstack_router',\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: onBeforeNavigateRouteMatch ? 'route' : 'url',\n },\n });\n\n // In case the user is redirected during navigation we want to update the span with the right value.\n const unsubscribeOnResolved = castRouterInstance.subscribe('onResolved', onResolvedArgs => {\n unsubscribeOnResolved();\n if (navigationSpan) {\n const matchedRoutesOnResolved = castRouterInstance.matchRoutes(\n onResolvedArgs.toLocation.pathname,\n onResolvedArgs.toLocation.search,\n { preload: false, throwOnError: false },\n );\n\n const onResolvedLastMatch = matchedRoutesOnResolved[matchedRoutesOnResolved.length - 1];\n const onResolvedRouteMatch =\n onResolvedLastMatch?.routeId !== '__root__' ? onResolvedLastMatch : undefined;\n\n if (onResolvedRouteMatch) {\n navigationSpan.updateName(onResolvedRouteMatch.routeId);\n navigationSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route');\n navigationSpan.setAttributes(routeMatchToParamSpanAttributes(onResolvedRouteMatch));\n }\n }\n });\n });\n }\n },\n };\n}\n\nfunction routeMatchToParamSpanAttributes(match: VendoredTanstackRouterRouteMatch | undefined): Record<string, string> {\n if (!match) {\n return {};\n }\n\n const paramAttributes: Record<string, string> = {};\n Object.entries(match.params).forEach(([key, value]) => {\n paramAttributes[`url.path.params.${key}`] = value; // TODO(v11): remove attribute which does not adhere to Sentry's semantic convention\n paramAttributes[`url.path.parameter.${key}`] = value;\n paramAttributes[`params.${key}`] = value; // params.[key] is an alias\n });\n\n return paramAttributes;\n}\n"],"names":["originalBrowserTracingIntegration","WINDOW","startBrowserTracingPageLoadSpan","SEMANTIC_ATTRIBUTE_SENTRY_OP","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","startBrowserTracingNavigationSpan"],"mappings":";;;;;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,uCAAuC;AACvD;AACA,EAAE,MAAM;AACR,EAAE,OAAO,GAA4D,EAAE;AACvE,EAAe;AACf,EAAE,MAAM,kBAAkB,GAA2B,MAAM;;AAE3D,EAAE,MAAM,iCAAA,GAAoCA,iCAAiC,CAAC;AAC9E,IAAI,GAAG,OAAO;AACd,IAAI,oBAAoB,EAAE,KAAK;AAC/B,IAAI,kBAAkB,EAAE,KAAK;AAC7B,GAAG,CAAC;;AAEJ,E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sourcesContent":["import {\n browserTracingIntegration as originalBrowserTracingIntegration,\n startBrowserTracingNavigationSpan,\n startBrowserTracingPageLoadSpan,\n WINDOW,\n} from '@sentry/browser';\nimport type { Integration } from '@sentry/core/browser';\nimport {\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n} from '@sentry/core/browser';\nimport type { VendoredTanstackRouter, VendoredTanstackRouterRouteMatch } from './vendor/tanstackrouter-types';\n\n/**\n * A custom browser tracing integration for TanStack Router.\n *\n * The minimum compatible version of `@tanstack/react-router` is `1.64.0`.\n *\n * @param router A TanStack Router `Router` instance that should be used for routing instrumentation.\n * @param options Sentry browser tracing configuration.\n */\nexport function tanstackRouterBrowserTracingIntegration(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n router: any, // This is `any` because we don't want any type mismatches if TanStack Router changes their types\n options: Parameters<typeof originalBrowserTracingIntegration>[0] = {},\n): Integration {\n const castRouterInstance: VendoredTanstackRouter = router;\n\n const browserTracingIntegrationInstance = originalBrowserTracingIntegration({\n ...options,\n instrumentNavigation: false,\n instrumentPageLoad: false,\n });\n\n const { instrumentPageLoad = true, instrumentNavigation = true } = options;\n\n return {\n ...browserTracingIntegrationInstance,\n afterAllSetup(client) {\n browserTracingIntegrationInstance.afterAllSetup(client);\n\n const initialWindowLocation = WINDOW.location;\n if (instrumentPageLoad && initialWindowLocation) {\n const matchedRoutes = castRouterInstance.matchRoutes(\n initialWindowLocation.pathname,\n castRouterInstance.options.parseSearch(initialWindowLocation.search),\n { preload: false, throwOnError: false },\n );\n\n const lastMatch = matchedRoutes[matchedRoutes.length - 1];\n // If we only match __root__, we ended up not matching any route at all, so\n // we fall back to the pathname.\n const routeMatch = lastMatch?.routeId !== '__root__' ? lastMatch : undefined;\n\n startBrowserTracingPageLoadSpan(client, {\n name: routeMatch ? routeMatch.routeId : initialWindowLocation.pathname,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.tanstack_router',\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: routeMatch ? 'route' : 'url',\n ...routeMatchToParamSpanAttributes(routeMatch),\n },\n });\n }\n\n if (instrumentNavigation) {\n // The onBeforeNavigate hook is called at the very beginning of a navigation and is only called once per navigation, even when the user is redirected\n castRouterInstance.subscribe('onBeforeNavigate', onBeforeNavigateArgs => {\n // onBeforeNavigate is called during pageloads. We can avoid creating navigation spans by:\n // 1. Checking if there's no fromLocation (initial pageload)\n // 2. Comparing the states of the to and from arguments\n if (\n !onBeforeNavigateArgs.fromLocation ||\n onBeforeNavigateArgs.toLocation.state === onBeforeNavigateArgs.fromLocation.state\n ) {\n return;\n }\n\n const matchedRoutesOnBeforeNavigate = castRouterInstance.matchRoutes(\n onBeforeNavigateArgs.toLocation.pathname,\n onBeforeNavigateArgs.toLocation.search,\n { preload: false, throwOnError: false },\n );\n\n const onBeforeNavigateLastMatch = matchedRoutesOnBeforeNavigate[matchedRoutesOnBeforeNavigate.length - 1];\n const onBeforeNavigateRouteMatch =\n onBeforeNavigateLastMatch?.routeId !== '__root__' ? onBeforeNavigateLastMatch : undefined;\n\n const navigationLocation = WINDOW.location;\n const navigationSpan = startBrowserTracingNavigationSpan(client, {\n name: onBeforeNavigateRouteMatch ? onBeforeNavigateRouteMatch.routeId : navigationLocation.pathname,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.tanstack_router',\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: onBeforeNavigateRouteMatch ? 'route' : 'url',\n },\n });\n\n // In case the user is redirected during navigation we want to update the span with the right value.\n const unsubscribeOnResolved = castRouterInstance.subscribe('onResolved', onResolvedArgs => {\n unsubscribeOnResolved();\n if (navigationSpan) {\n const matchedRoutesOnResolved = castRouterInstance.matchRoutes(\n onResolvedArgs.toLocation.pathname,\n onResolvedArgs.toLocation.search,\n { preload: false, throwOnError: false },\n );\n\n const onResolvedLastMatch = matchedRoutesOnResolved[matchedRoutesOnResolved.length - 1];\n const onResolvedRouteMatch =\n onResolvedLastMatch?.routeId !== '__root__' ? onResolvedLastMatch : undefined;\n\n if (onResolvedRouteMatch) {\n navigationSpan.updateName(onResolvedRouteMatch.routeId);\n navigationSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route');\n navigationSpan.setAttributes(routeMatchToParamSpanAttributes(onResolvedRouteMatch));\n }\n }\n });\n });\n }\n },\n };\n}\n\nfunction routeMatchToParamSpanAttributes(match: VendoredTanstackRouterRouteMatch | undefined): Record<string, string> {\n if (!match) {\n return {};\n }\n\n const paramAttributes: Record<string, string> = {};\n Object.entries(match.params).forEach(([key, value]) => {\n paramAttributes[`url.path.params.${key}`] = value; // TODO(v11): remove attribute which does not adhere to Sentry's semantic convention\n paramAttributes[`url.path.parameter.${key}`] = value;\n paramAttributes[`params.${key}`] = value; // params.[key] is an alias\n });\n\n return paramAttributes;\n}\n"],"names":["originalBrowserTracingIntegration","WINDOW","startBrowserTracingPageLoadSpan","SEMANTIC_ATTRIBUTE_SENTRY_OP","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","startBrowserTracingNavigationSpan"],"mappings":";;;;;AAsBO,SAAS,uCAAA,CAEd,MAAA,EACA,OAAA,GAAmE,EAAC,EACvD;AACb,EAAA,MAAM,kBAAA,GAA6C,MAAA;AAEnD,EAAA,MAAM,oCAAoCA,iCAAA,CAAkC;AAAA,IAC1E,GAAG,OAAA;AAAA,IACH,oBAAA,EAAsB,KAAA;AAAA,IACtB,kBAAA,EAAoB;AAAA,GACrB,CAAA;AAED,EAAA,MAAM,EAAE,kBAAA,GAAqB,IAAA,EAAM,oBAAA,GAAuB,MAAK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AA;AAEtE,cAAA,IAAI,oBAAA,EAAsB;AACxB,gBAAA,cAAA,CAAe,UAAA,CAAW,qBAAqB,OAAO,CAAA;AACtD,gBAAA,cAAA,CAAe,YAAA,CAAaA,4CAAkC,OAAO,CAAA;AACrE,gBAAA,cAAA,CAAe,aAAA,CAAc,+BAAA,CAAgC,oBAAoB,CAAC,CAAA;AAAA,cACpF;AAAA,YACF;AAAA,UACF,CAAC,CAAA;AAAA,QACH,CAAC,CAAA;AAAA,MACH;AAAA,IACF;AAAA,GACF;AACF;AAEA,SAAS,gCAAgC,KAAA,EAA6E;AACpH,EAAA,IAAI,CAAC,KAAA,EAAO;AACV,IAAA,OAAO,EAAC;AAAA,EACV;AAEA,EAAA,MAAM,kBAA0C,EAAC;AACjD,EAAA,MAAA,CAAO,OAAA,CAAQ,MAAM,MAAM,CAAA,CAAE,QAAQ,CAAC,CAAC,GAAA,EAAK,KAAK,CAAA,KAAM;AACrD,IAAA,eAAA,CAAgB,CAAA,gBAAA,EAAmB,GAAG,CAAA,CAAE,CAAA,GAAI,KAAA;AAC5C,IAAA,eAAA,CAAgB,CAAA,mBAAA,EAAsB,GAAG,CAAA,CAAE,CAAA,GAAI,KAAA;AAC/C,IAAA,eAAA,CAAgB,CAAA,OAAA,EAAU,GAAG,CAAA,CAAE,CAAA,GAAI,KAAA;AAAA,EACrC,CAAC,CAAA;AAED,EAAA,OAAO,eAAA;AACT;;;;"}
@@ -1,8 +1,6 @@
1
- const REACT_RENDER_OP = 'ui.react.render';
2
-
3
- const REACT_UPDATE_OP = 'ui.react.update';
4
-
5
- const REACT_MOUNT_OP = 'ui.react.mount';
1
+ const REACT_RENDER_OP = "ui.react.render";
2
+ const REACT_UPDATE_OP = "ui.react.update";
3
+ const REACT_MOUNT_OP = "ui.react.mount";
6
4
 
7
5
  export { REACT_MOUNT_OP, REACT_RENDER_OP, REACT_UPDATE_OP };
8
6
  //# sourceMappingURL=constants.js.map
@@ -1 +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;;;;"}
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;;;;"}
@@ -1,8 +1,3 @@
1
- /**
2
- * 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.
3
- *
4
- * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.
5
- */
6
1
  const DEBUG_BUILD = (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__);
7
2
 
8
3
  export { DEBUG_BUILD };
@@ -1 +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;;;;"}
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":"AAOO,MAAM,WAAA,IAAc,OAAA,gBAAA,KAAA,WAAA,IAAA,gBAAA;;;;"}
@@ -2,101 +2,41 @@ import { withScope, captureException } from '@sentry/browser';
2
2
  import { isError } from '@sentry/core/browser';
3
3
  import { version } from 'react';
4
4
 
5
- /**
6
- * See if React major version is 17+ by parsing version string.
7
- */
8
5
  function isAtLeastReact17(reactVersion) {
9
6
  const reactMajor = reactVersion.match(/^([^.]+)/);
10
7
  return reactMajor !== null && parseInt(reactMajor[0]) >= 17;
11
8
  }
12
-
13
- /**
14
- * Recurse through `error.cause` chain to set cause on an error.
15
- */
16
9
  function setCause(error, cause) {
17
- const seenErrors = new WeakSet();
18
-
19
- function recurse(error, cause) {
20
- // If we've already seen the error, there is a recursive loop somewhere in the error's
21
- // cause chain. Let's just bail out then to prevent a stack overflow.
22
- if (seenErrors.has(error)) {
10
+ const seenErrors = /* @__PURE__ */ new WeakSet();
11
+ function recurse(error2, cause2) {
12
+ if (seenErrors.has(error2)) {
23
13
  return;
24
14
  }
25
- if (error.cause) {
26
- seenErrors.add(error);
27
- return recurse(error.cause, cause);
15
+ if (error2.cause) {
16
+ seenErrors.add(error2);
17
+ return recurse(error2.cause, cause2);
28
18
  }
29
- error.cause = cause;
19
+ error2.cause = cause2;
30
20
  }
31
-
32
21
  recurse(error, cause);
33
22
  }
34
-
35
- /**
36
- * Captures an error that was thrown by a React ErrorBoundary or React root.
37
- *
38
- * @param error The error to capture.
39
- * @param errorInfo The errorInfo provided by React.
40
- * @param hint Optional additional data to attach to the Sentry event.
41
- * @returns the id of the captured Sentry event.
42
- */
43
- function captureReactException(
44
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
- error,
46
- { componentStack },
47
- hint,
48
- ) {
49
- // If on React version >= 17, create stack trace from componentStack param and links
50
- // to to the original error using `error.cause` otherwise relies on error param for stacktrace.
51
- // Linking errors requires the `LinkedErrors` integration be enabled.
52
- // See: https://reactjs.org/blog/2020/08/10/react-v17-rc.html#native-component-stacks
53
- //
54
- // Although `componentDidCatch` is typed to accept an `Error` object, it can also be invoked
55
- // with non-error objects. This is why we need to check if the error is an error-like object.
56
- // See: https://github.com/getsentry/sentry-javascript/issues/6167
23
+ function captureReactException(error, { componentStack }, hint) {
57
24
  if (isAtLeastReact17(version) && isError(error) && componentStack) {
58
25
  const errorBoundaryError = new Error(error.message);
59
26
  errorBoundaryError.name = `React ErrorBoundary ${error.name}`;
60
27
  errorBoundaryError.stack = componentStack;
61
-
62
- // Using the `LinkedErrors` integration to link the errors together.
63
28
  setCause(error, errorBoundaryError);
64
29
  }
65
-
66
- return withScope(scope => {
67
- scope.setContext('react', { componentStack });
30
+ return withScope((scope) => {
31
+ scope.setContext("react", { componentStack });
68
32
  return captureException(error, hint);
69
33
  });
70
34
  }
71
-
72
- /**
73
- * Creates an error handler that can be used with the `onCaughtError`, `onUncaughtError`,
74
- * and `onRecoverableError` options in `createRoot` and `hydrateRoot` React DOM methods.
75
- *
76
- * @param callback An optional callback that will be called after the error is captured.
77
- * Use this to add custom handling for errors.
78
- *
79
- * @example
80
- *
81
- * ```JavaScript
82
- * const root = createRoot(container, {
83
- * onCaughtError: Sentry.reactErrorHandler(),
84
- * onUncaughtError: Sentry.reactErrorHandler((error, errorInfo) => {
85
- * console.warn('Caught error', error, errorInfo.componentStack);
86
- * });
87
- * });
88
- * ```
89
- */
90
- function reactErrorHandler(
91
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
92
- callback,
93
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
94
- ) {
95
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
35
+ function reactErrorHandler(callback) {
96
36
  return (error, errorInfo) => {
97
37
  const hasCallback = !!callback;
98
38
  const eventId = captureReactException(error, errorInfo, {
99
- mechanism: { handled: hasCallback, type: 'auto.function.react.error_handler' },
39
+ mechanism: { handled: hasCallback, type: "auto.function.react.error_handler" }
100
40
  });
101
41
  if (hasCallback) {
102
42
  callback(error, errorInfo, eventId);
@@ -1 +1 @@
1
- {"version":3,"file":"error.js","sources":["../../src/error.ts"],"sourcesContent":["import { captureException, withScope } from '@sentry/browser';\nimport { isError } from '@sentry/core/browser';\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":[],"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/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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAA,iBAAA;AACA;AACA,EAAA,QAAA;AACA;AACA,EAAA;AACA;AACA,EAAA,OAAA,CAAA,KAAA,EAAA,SAAA,KAAA;AACA,IAAA,MAAA,WAAA,GAAA,CAAA,CAAA,QAAA;AACA,IAAA,MAAA,OAAA,GAAA,qBAAA,CAAA,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;;;;"}
1
+ {"version":3,"file":"error.js","sources":["../../src/error.ts"],"sourcesContent":["import { captureException, withScope } from '@sentry/browser';\nimport { isError } from '@sentry/core/browser';\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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A,CAAW,OAAA,EAAS,EAAE,cAAA,EAAgB,CAAA;AAC5C,IAAA,OAAO,gBAAA,CAAiB,OAAO,IAAI,CAAA;AAAA,EACrC,CAAC,CAAA;AACH;AAoBO,SAAS,kBAEd,QAAA,EAE4C;AAE5C,EAAA,OAAO,CAAC,OAAY,SAAA,KAAyB;AAC3C,IAAA,MAAM,WAAA,GAAc,CAAC,CAAC,QAAA;AACtB,IAAA,MAAM,OAAA,GAAU,qBAAA,CAAsB,KAAA,EAAO,SAAA,EAAW;AAAA,MACtD,SAAA,EAAW,EAAE,OAAA,EAAS,WAAA,EAAa,MAAM,mCAAA;AAAoC,KAC9E,CAAA;AACD,IAAA,IAAI,WAAA,EAAa;AACf,MAAA,QAAA,CAAS,KAAA,EAAO,WAAW,OAAO,CAAA;AAAA,IACpC;AAAA,EACF,CAAA;AACF;;;;"}
@@ -5,52 +5,38 @@ import { DEBUG_BUILD } from './debug-build.js';
5
5
  import { captureReactException } from './error.js';
6
6
  import { hoistNonReactStatics } from './hoist-non-react-statics.js';
7
7
 
8
- const UNKNOWN_COMPONENT = 'unknown';
9
-
8
+ const UNKNOWN_COMPONENT = "unknown";
10
9
  const INITIAL_STATE = {
11
10
  componentStack: null,
12
11
  error: null,
13
- eventId: null,
12
+ eventId: null
14
13
  };
15
-
16
- /**
17
- * A ErrorBoundary component that logs errors to Sentry.
18
- * NOTE: If you are a Sentry user, and you are seeing this stack frame, it means the
19
- * Sentry React SDK ErrorBoundary caught an error invoking your application code. This
20
- * is expected behavior and NOT indicative of a bug with the Sentry React SDK.
21
- */
22
14
  class ErrorBoundary extends React.Component {
23
-
24
- constructor(props) {
15
+ constructor(props) {
25
16
  super(props);
26
-
27
17
  this.state = INITIAL_STATE;
28
18
  this._openFallbackReportDialog = true;
29
-
30
19
  const client = getClient();
31
20
  if (client && props.showDialog) {
32
21
  this._openFallbackReportDialog = false;
33
- this._cleanupHook = client.on('afterSendEvent', event => {
22
+ this._cleanupHook = client.on("afterSendEvent", (event) => {
34
23
  if (!event.type && this._lastEventId && event.event_id === this._lastEventId) {
35
24
  showReportDialog({ ...props.dialogOptions, eventId: this._lastEventId });
36
25
  }
37
26
  });
38
27
  }
39
28
  }
40
-
41
- componentDidCatch(error, errorInfo) {
29
+ componentDidCatch(error, errorInfo) {
42
30
  const { componentStack } = errorInfo;
43
31
  const { beforeCapture, onError, showDialog, dialogOptions } = this.props;
44
- withScope(scope => {
32
+ withScope((scope) => {
45
33
  if (beforeCapture) {
46
34
  beforeCapture(scope, error, componentStack);
47
35
  }
48
-
49
36
  const handled = this.props.handled != null ? this.props.handled : !!this.props.fallback;
50
37
  const eventId = captureReactException(error, errorInfo, {
51
- mechanism: { handled, type: 'auto.function.react.error_boundary' },
38
+ mechanism: { handled, type: "auto.function.react.error_boundary" }
52
39
  });
53
-
54
40
  if (onError) {
55
41
  onError(error, componentStack, eventId);
56
42
  }
@@ -60,104 +46,63 @@ class ErrorBoundary extends React.Component {
60
46
  showReportDialog({ ...dialogOptions, eventId });
61
47
  }
62
48
  }
63
-
64
- // componentDidCatch is used over getDerivedStateFromError
65
- // so that componentStack is accessible through state.
66
49
  this.setState({ error, componentStack, eventId });
67
50
  });
68
51
  }
69
-
70
- componentDidMount() {
52
+ componentDidMount() {
71
53
  const { onMount } = this.props;
72
54
  if (onMount) {
73
55
  onMount();
74
56
  }
75
57
  }
76
-
77
- componentWillUnmount() {
58
+ componentWillUnmount() {
78
59
  const { error, componentStack, eventId } = this.state;
79
60
  const { onUnmount } = this.props;
80
61
  if (onUnmount) {
81
62
  if (this.state === INITIAL_STATE) {
82
- // If the error boundary never encountered an error, call onUnmount with null values
83
63
  onUnmount(null, null, null);
84
64
  } else {
85
- // `componentStack` and `eventId` are guaranteed to be non-null here because `onUnmount` is only called
86
- // when the error boundary has already encountered an error.
87
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
88
65
  onUnmount(error, componentStack, eventId);
89
66
  }
90
67
  }
91
-
92
68
  if (this._cleanupHook) {
93
69
  this._cleanupHook();
94
- this._cleanupHook = undefined;
70
+ this._cleanupHook = void 0;
95
71
  }
96
72
  }
97
-
98
- resetErrorBoundary() {
73
+ resetErrorBoundary() {
99
74
  const { onReset } = this.props;
100
75
  const { error, componentStack, eventId } = this.state;
101
76
  if (onReset) {
102
- // `componentStack` and `eventId` are guaranteed to be non-null here because `onReset` is only called
103
- // when the error boundary has already encountered an error.
104
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
105
77
  onReset(error, componentStack, eventId);
106
78
  }
107
79
  this.setState(INITIAL_STATE);
108
80
  }
109
-
110
- render() {
81
+ render() {
111
82
  const { fallback, children } = this.props;
112
83
  const state = this.state;
113
-
114
- // `componentStack` is only null in the initial state, when no error has been captured.
115
- // If an error has been captured, `componentStack` will be a string.
116
- // We cannot check `state.error` because null can be thrown as an error.
117
84
  if (state.componentStack === null) {
118
- return typeof children === 'function' ? children() : children;
85
+ return typeof children === "function" ? children() : children;
119
86
  }
120
-
121
- const element =
122
- typeof fallback === 'function'
123
- ? React.createElement(fallback, {
124
- error: state.error,
125
- componentStack: state.componentStack,
126
- resetError: () => this.resetErrorBoundary(),
127
- eventId: state.eventId,
128
- })
129
- : fallback;
130
-
87
+ const element = typeof fallback === "function" ? React.createElement(fallback, {
88
+ error: state.error,
89
+ componentStack: state.componentStack,
90
+ resetError: () => this.resetErrorBoundary(),
91
+ eventId: state.eventId
92
+ }) : fallback;
131
93
  if (React.isValidElement(element)) {
132
94
  return element;
133
95
  }
134
-
135
96
  if (fallback) {
136
- DEBUG_BUILD && debug.warn('fallback did not produce a valid ReactElement');
97
+ DEBUG_BUILD && debug.warn("fallback did not produce a valid ReactElement");
137
98
  }
138
-
139
- // Fail gracefully if no fallback provided or is not valid
140
99
  return null;
141
100
  }
142
101
  }
143
-
144
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
145
- function withErrorBoundary(
146
- WrappedComponent,
147
- errorBoundaryOptions,
148
- ) {
102
+ function withErrorBoundary(WrappedComponent, errorBoundaryOptions) {
149
103
  const componentDisplayName = WrappedComponent.displayName || WrappedComponent.name || UNKNOWN_COMPONENT;
150
-
151
- const Wrapped = React.memo((props) => (
152
- React.createElement(ErrorBoundary, { ...errorBoundaryOptions,}
153
- , React.createElement(WrappedComponent, { ...props,} )
154
- )
155
- )) ;
156
-
104
+ const Wrapped = React.memo((props) => /* @__PURE__ */ React.createElement(ErrorBoundary, { ...errorBoundaryOptions }, /* @__PURE__ */ React.createElement(WrappedComponent, { ...props })));
157
105
  Wrapped.displayName = `errorBoundary(${componentDisplayName})`;
158
-
159
- // Copy over static methods from Wrapped component to Profiler HOC
160
- // See: https://reactjs.org/docs/higher-order-components.html#static-methods-must-be-copied-over
161
106
  hoistNonReactStatics(Wrapped, WrappedComponent);
162
107
  return Wrapped;
163
108
  }
@@ -1 +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":[],"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,G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;AACf,EAAE,MAAM,oBAAA,GAAuB,gBAAgB,CAAC,WAAA,IAAe,gBAAgB,CAAC,IAAA,IAAQ,iBAAiB;;AAEzG,EAAE,MAAM,OAAA,GAAU,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK;AACnC,IAAI,KAAA,CAAA,aAAA,CAAC,aAAA,EAAA,EAAc,GAAI,oBAAoB;AAC3C,QAAM,KAAA,CAAA,aAAA,CAAC,gBAAA,EAAA,EAAiB,GAAI,KAAK;AACjC;AACA,GAAG,CAAA;;AAEH,EAAE,OAAO,CAAC,WAAA,GAAc,CAAC,cAAc,EAAE,oBAAoB,CAAC,CAAC,CAAC;;AAEhE;AACA;AACA,EAAE,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,CAAC;AACjD,EAAE,OAAO,OAAO;AAChB;;;;"}
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":[],"mappings":";;;;;;;AASO,MAAM,iBAAA,GAAoB;AAsEjC,MAAM,aAAA,GAAoC;AAAA,EACxC,cAAA,EAAgB,IAAA;AAAA,EAChB,KAAA,EAAO,IAAA;AAAA,EACP,OAAA,EAAS;AACX,CAAA;AAQA,MAAM,aAAA,SAAsB,MAAM,SAAA,CAAkD;AAAA,EAQ3E,YAAY,KAAA,EAA2B;AAC5C,IAAA,KAAA,CAAM,KAAK,CAAA;AAEX,IAAA,IAAA,CAAK,KAAA,GAAQ,aAAA;AACb,IAAA,IAAA,CAAK,yBAAA,GA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ACD,CAAA;AAED,EAAA,OAAA,CAAQ,WAAA,GAAc,iBAAiB,oBAAoB,CAAA,CAAA,CAAA;AAI3D,EAAA,oBAAA,CAAqB,SAAS,gBAAgB,CAAA;AAC9C,EAAA,OAAO,OAAA;AACT;;;;"}
@@ -1,6 +1,3 @@
1
- /**
2
- * React statics that should not be hoisted
3
- */
4
1
  const REACT_STATICS = {
5
2
  childContextTypes: true,
6
3
  contextType: true,
@@ -12,12 +9,8 @@ const REACT_STATICS = {
12
9
  getDerivedStateFromProps: true,
13
10
  mixins: true,
14
11
  propTypes: true,
15
- type: true,
16
- } ;
17
-
18
- /**
19
- * Known JavaScript function statics that should not be hoisted
20
- */
12
+ type: true
13
+ };
21
14
  const KNOWN_STATICS = {
22
15
  name: true,
23
16
  length: true,
@@ -25,131 +18,70 @@ const KNOWN_STATICS = {
25
18
  caller: true,
26
19
  callee: true,
27
20
  arguments: true,
28
- arity: true,
29
- } ;
30
-
31
- /**
32
- * Statics specific to ForwardRef components
33
- */
21
+ arity: true
22
+ };
34
23
  const FORWARD_REF_STATICS = {
35
24
  $$typeof: true,
36
25
  render: true,
37
26
  defaultProps: true,
38
27
  displayName: true,
39
- propTypes: true,
40
- } ;
41
-
42
- /**
43
- * Statics specific to Memo components
44
- */
28
+ propTypes: true
29
+ };
45
30
  const MEMO_STATICS = {
46
31
  $$typeof: true,
47
32
  compare: true,
48
33
  defaultProps: true,
49
34
  displayName: true,
50
35
  propTypes: true,
51
- type: true,
52
- } ;
53
-
54
- /**
55
- * Inlined react-is utilities
56
- * We only need to detect ForwardRef and Memo types
57
- */
58
- const ForwardRefType = Symbol.for('react.forward_ref');
59
- const MemoType = Symbol.for('react.memo');
60
-
61
- /**
62
- * Check if a component is a Memo component
63
- */
36
+ type: true
37
+ };
38
+ const ForwardRefType = /* @__PURE__ */ Symbol.for("react.forward_ref");
39
+ const MemoType = /* @__PURE__ */ Symbol.for("react.memo");
64
40
  function isMemo(component) {
65
- return (
66
- typeof component === 'object' && component !== null && (component ).$$typeof === MemoType
67
- );
41
+ return typeof component === "object" && component !== null && component.$$typeof === MemoType;
68
42
  }
69
-
70
- /**
71
- * Map of React component types to their specific statics
72
- */
73
43
  const TYPE_STATICS = {};
74
44
  TYPE_STATICS[ForwardRefType] = FORWARD_REF_STATICS;
75
45
  TYPE_STATICS[MemoType] = MEMO_STATICS;
76
-
77
- /**
78
- * Get the appropriate statics object for a given component
79
- */
80
46
  function getStatics(component) {
81
- // React v16.11 and below
82
47
  if (isMemo(component)) {
83
48
  return MEMO_STATICS;
84
49
  }
85
-
86
- // React v16.12 and above
87
- const componentType = (component ).$$typeof;
88
- return (componentType && TYPE_STATICS[componentType]) || REACT_STATICS;
50
+ const componentType = component.$$typeof;
51
+ return componentType && TYPE_STATICS[componentType] || REACT_STATICS;
89
52
  }
90
-
91
53
  const defineProperty = Object.defineProperty.bind(Object);
92
54
  const getOwnPropertyNames = Object.getOwnPropertyNames.bind(Object);
93
55
  const getOwnPropertySymbols = Object.getOwnPropertySymbols?.bind(Object);
94
56
  const getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor.bind(Object);
95
57
  const getPrototypeOf = Object.getPrototypeOf.bind(Object);
96
58
  const objectPrototype = Object.prototype;
97
-
98
- /**
99
- * Copies non-react specific statics from a child component to a parent component.
100
- * Similar to Object.assign, but copies all static properties from source to target,
101
- * excluding React-specific statics and known JavaScript statics.
102
- *
103
- * @param targetComponent - The component to copy statics to
104
- * @param sourceComponent - The component to copy statics from
105
- * @param excludelist - An optional object of keys to exclude from hoisting
106
- * @returns The target component with hoisted statics
107
- */
108
- function hoistNonReactStatics
109
-
110
- (targetComponent, sourceComponent, excludelist) {
111
- if (typeof sourceComponent !== 'string') {
112
- // Don't hoist over string (html) components
59
+ function hoistNonReactStatics(targetComponent, sourceComponent, excludelist) {
60
+ if (typeof sourceComponent !== "string") {
113
61
  if (objectPrototype) {
114
62
  const inheritedComponent = getPrototypeOf(sourceComponent);
115
-
116
63
  if (inheritedComponent && inheritedComponent !== objectPrototype) {
117
64
  hoistNonReactStatics(targetComponent, inheritedComponent);
118
65
  }
119
66
  }
120
-
121
67
  let keys = getOwnPropertyNames(sourceComponent);
122
-
123
68
  if (getOwnPropertySymbols) {
124
69
  keys = keys.concat(getOwnPropertySymbols(sourceComponent));
125
70
  }
126
-
127
71
  const targetStatics = getStatics(targetComponent);
128
72
  const sourceStatics = getStatics(sourceComponent);
129
-
130
73
  for (const key of keys) {
131
- // Use key directly - String(key) throws for Symbols if minified to '' + key (#18966)
132
- if (
133
- !KNOWN_STATICS[key ] &&
134
- true &&
135
- !sourceStatics?.[key ] &&
136
- !targetStatics?.[key ] &&
137
- !getOwnPropertyDescriptor(targetComponent, key) // Don't overwrite existing properties
138
- ) {
74
+ if (!KNOWN_STATICS[key] && true && !sourceStatics?.[key] && !targetStatics?.[key] && !getOwnPropertyDescriptor(targetComponent, key)) {
139
75
  const descriptor = getOwnPropertyDescriptor(sourceComponent, key);
140
-
141
76
  if (descriptor) {
142
77
  try {
143
- // Avoid failures from read-only properties
144
78
  defineProperty(targetComponent, key, descriptor);
145
79
  } catch (_e) {
146
- // Silently ignore errors
147
80
  }
148
81
  }
149
82
  }
150
83
  }
151
84
  }
152
-
153
85
  return targetComponent;
154
86
  }
155
87