@depup/sentry__react 10.75.2-depup.0 → 11.0.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 (119) hide show
  1. package/README.md +3 -3
  2. package/build/cjs/error.js +4 -10
  3. package/build/cjs/error.js.map +1 -1
  4. package/build/cjs/hoist-non-react-statics.js +1 -7
  5. package/build/cjs/hoist-non-react-statics.js.map +1 -1
  6. package/build/cjs/profiler.js +45 -19
  7. package/build/cjs/profiler.js.map +1 -1
  8. package/build/cjs/react-router.js +21 -0
  9. package/build/cjs/react-router.js.map +1 -0
  10. package/build/cjs/reactrouter-compat-utils/instrumentation.js +200 -192
  11. package/build/cjs/reactrouter-compat-utils/instrumentation.js.map +1 -1
  12. package/build/cjs/reactrouter-compat-utils/route-manifest.js +4 -4
  13. package/build/cjs/reactrouter-compat-utils/route-manifest.js.map +1 -1
  14. package/build/cjs/reactrouter-compat-utils/utils.js +34 -37
  15. package/build/cjs/reactrouter-compat-utils/utils.js.map +1 -1
  16. package/build/cjs/reactrouter.compat.js +0 -3
  17. package/build/cjs/reactrouter.compat.js.map +1 -1
  18. package/build/cjs/reactrouter.js +14 -8
  19. package/build/cjs/reactrouter.js.map +1 -1
  20. package/build/cjs/reactrouterv3.js +12 -9
  21. package/build/cjs/reactrouterv3.js.map +1 -1
  22. package/build/cjs/reactrouterv6.js +0 -3
  23. package/build/cjs/reactrouterv6.js.map +1 -1
  24. package/build/cjs/reactrouterv7.js +0 -3
  25. package/build/cjs/reactrouterv7.js.map +1 -1
  26. package/build/cjs/redux.js +6 -6
  27. package/build/cjs/redux.js.map +1 -1
  28. package/build/cjs/sdk.js +7 -7
  29. package/build/cjs/sdk.js.map +1 -1
  30. package/build/cjs/tanstackrouter.js +23 -13
  31. package/build/cjs/tanstackrouter.js.map +1 -1
  32. package/build/esm/error.js +3 -8
  33. package/build/esm/error.js.map +1 -1
  34. package/build/esm/hoist-non-react-statics.js +1 -7
  35. package/build/esm/hoist-non-react-statics.js.map +1 -1
  36. package/build/esm/package.json +1 -1
  37. package/build/esm/profiler.js +47 -21
  38. package/build/esm/profiler.js.map +1 -1
  39. package/build/esm/react-router.js +16 -0
  40. package/build/esm/react-router.js.map +1 -0
  41. package/build/esm/reactrouter-compat-utils/instrumentation.js +203 -195
  42. package/build/esm/reactrouter-compat-utils/instrumentation.js.map +1 -1
  43. package/build/esm/reactrouter-compat-utils/route-manifest.js +1 -1
  44. package/build/esm/reactrouter-compat-utils/route-manifest.js.map +1 -1
  45. package/build/esm/reactrouter-compat-utils/utils.js +32 -34
  46. package/build/esm/reactrouter-compat-utils/utils.js.map +1 -1
  47. package/build/esm/reactrouter.compat.js +0 -3
  48. package/build/esm/reactrouter.compat.js.map +1 -1
  49. package/build/esm/reactrouter.js +16 -10
  50. package/build/esm/reactrouter.js.map +1 -1
  51. package/build/esm/reactrouterv3.js +11 -8
  52. package/build/esm/reactrouterv3.js.map +1 -1
  53. package/build/esm/reactrouterv6.js +0 -3
  54. package/build/esm/reactrouterv6.js.map +1 -1
  55. package/build/esm/reactrouterv7.js +0 -3
  56. package/build/esm/reactrouterv7.js.map +1 -1
  57. package/build/esm/redux.js +1 -1
  58. package/build/esm/redux.js.map +1 -1
  59. package/build/esm/sdk.js +1 -1
  60. package/build/esm/sdk.js.map +1 -1
  61. package/build/esm/tanstackrouter.js +23 -13
  62. package/build/esm/tanstackrouter.js.map +1 -1
  63. package/build/types/error.d.ts +0 -4
  64. package/build/types/error.d.ts.map +1 -1
  65. package/build/types/errorboundary.d.ts.map +1 -1
  66. package/build/types/hoist-non-react-statics.d.ts.map +1 -1
  67. package/build/types/profiler.d.ts +0 -1
  68. package/build/types/profiler.d.ts.map +1 -1
  69. package/build/types/react-router.d.ts +26 -0
  70. package/build/types/react-router.d.ts.map +1 -0
  71. package/build/types/reactrouter-compat-utils/index.d.ts +1 -1
  72. package/build/types/reactrouter-compat-utils/index.d.ts.map +1 -1
  73. package/build/types/reactrouter-compat-utils/instrumentation.d.ts +9 -5
  74. package/build/types/reactrouter-compat-utils/instrumentation.d.ts.map +1 -1
  75. package/build/types/reactrouter-compat-utils/utils.d.ts +6 -11
  76. package/build/types/reactrouter-compat-utils/utils.d.ts.map +1 -1
  77. package/build/types/reactrouter.d.ts +16 -0
  78. package/build/types/reactrouter.d.ts.map +1 -1
  79. package/build/types/reactrouterv3.d.ts +1 -1
  80. package/build/types/reactrouterv3.d.ts.map +1 -1
  81. package/build/types/redux.d.ts +1 -1
  82. package/build/types/redux.d.ts.map +1 -1
  83. package/build/types/sdk.d.ts +1 -1
  84. package/build/types/sdk.d.ts.map +1 -1
  85. package/build/types/tanstackrouter.d.ts +1 -1
  86. package/build/types/tanstackrouter.d.ts.map +1 -1
  87. package/build/types/types.d.ts +16 -0
  88. package/build/types/types.d.ts.map +1 -1
  89. package/changes.json +3 -3
  90. package/package.json +39 -21
  91. package/build/cjs/constants.js +0 -10
  92. package/build/cjs/constants.js.map +0 -1
  93. package/build/esm/constants.js +0 -6
  94. package/build/esm/constants.js.map +0 -1
  95. package/build/types/constants.d.ts +0 -4
  96. package/build/types/constants.d.ts.map +0 -1
  97. package/build/types-ts3.8/constants.d.ts +0 -4
  98. package/build/types-ts3.8/debug-build.d.ts +0 -7
  99. package/build/types-ts3.8/error.d.ts +0 -41
  100. package/build/types-ts3.8/errorboundary.d.ts +0 -87
  101. package/build/types-ts3.8/hoist-non-react-statics.d.ts +0 -21
  102. package/build/types-ts3.8/index.d.ts +0 -14
  103. package/build/types-ts3.8/isSyntheticEvent.d.ts +0 -10
  104. package/build/types-ts3.8/profiler.d.ts +0 -56
  105. package/build/types-ts3.8/reactrouter-compat-utils/index.d.ts +0 -5
  106. package/build/types-ts3.8/reactrouter-compat-utils/instrumentation.d.ts +0 -117
  107. package/build/types-ts3.8/reactrouter-compat-utils/lazy-routes.d.ts +0 -18
  108. package/build/types-ts3.8/reactrouter-compat-utils/route-manifest.d.ts +0 -13
  109. package/build/types-ts3.8/reactrouter-compat-utils/utils.d.ts +0 -77
  110. package/build/types-ts3.8/reactrouter.compat.d.ts +0 -42
  111. package/build/types-ts3.8/reactrouter.d.ts +0 -41
  112. package/build/types-ts3.8/reactrouterv3.d.ts +0 -29
  113. package/build/types-ts3.8/reactrouterv6.d.ts +0 -42
  114. package/build/types-ts3.8/reactrouterv7.d.ts +0 -42
  115. package/build/types-ts3.8/redux.d.ts +0 -38
  116. package/build/types-ts3.8/sdk.d.ts +0 -7
  117. package/build/types-ts3.8/tanstackrouter.d.ts +0 -13
  118. package/build/types-ts3.8/types.d.ts +0 -163
  119. package/build/types-ts3.8/vendor/tanstackrouter-types.d.ts +0 -38
@@ -1 +1 @@
1
- {"version":3,"file":"profiler.js","sources":["../../src/profiler.tsx"],"sourcesContent":["import { startInactiveSpan } from '@sentry/browser';\nimport type { Span } from '@sentry/core';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON, timestampInSeconds, withActiveSpan } from '@sentry/core';\nimport * as React from 'react';\nimport { REACT_MOUNT_OP, REACT_RENDER_OP, REACT_UPDATE_OP } from './constants';\nimport { hoistNonReactStatics } from './hoist-non-react-statics';\n\nexport const UNKNOWN_COMPONENT = 'unknown';\n\nexport type ProfilerProps = {\n // The name of the component being profiled.\n name: string;\n // If the Profiler is disabled. False by default. This is useful if you want to disable profilers\n // in certain environments.\n disabled?: boolean;\n // If time component is on page should be displayed as spans. True by default.\n includeRender?: boolean;\n // If component updates should be displayed as spans. True by default.\n includeUpdates?: boolean;\n // Component that is being profiled.\n children?: React.ReactNode;\n // props given to component being profiled.\n updateProps: { [key: string]: unknown };\n};\n\n/**\n * The Profiler component leverages Sentry's Tracing integration to generate\n * spans based on component lifecycles.\n */\nclass Profiler extends React.Component<ProfilerProps> {\n /**\n * The span of the mount activity\n * Made protected for the React Native SDK to access\n */\n protected _mountSpan: Span | undefined;\n /**\n * The span that represents the duration of time between shouldComponentUpdate and componentDidUpdate\n */\n protected _updateSpan: Span | undefined;\n\n public constructor(props: ProfilerProps) {\n super(props);\n const { name, disabled = false } = this.props;\n\n if (disabled) {\n return;\n }\n\n this._mountSpan = startInactiveSpan({\n name: `<${name}>`,\n onlyIfParent: true,\n op: REACT_MOUNT_OP,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n 'ui.component_name': name,\n },\n });\n }\n\n // If a component mounted, we can finish the mount activity.\n public componentDidMount(): void {\n if (this._mountSpan) {\n this._mountSpan.end();\n }\n }\n\n public shouldComponentUpdate({ updateProps, includeUpdates = true }: ProfilerProps): boolean {\n // Only generate an update span if includeUpdates is true, if there is a valid mountSpan,\n // and if the updateProps have changed. It is ok to not do a deep equality check here as it is expensive.\n // We are just trying to give baseline clues for further investigation.\n if (includeUpdates && this._mountSpan && updateProps !== this.props.updateProps) {\n // See what props have changed between the previous props, and the current props. This is\n // set as data on the span. We just store the prop keys as the values could be potentially very large.\n const changedProps = Object.keys(updateProps).filter(k => updateProps[k] !== this.props.updateProps[k]);\n if (changedProps.length > 0) {\n const now = timestampInSeconds();\n this._updateSpan = withActiveSpan(this._mountSpan, () => {\n return startInactiveSpan({\n name: `<${this.props.name}>`,\n onlyIfParent: true,\n op: REACT_UPDATE_OP,\n startTime: now,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n 'ui.component_name': this.props.name,\n 'ui.react.changed_props': changedProps,\n },\n });\n });\n }\n }\n\n return true;\n }\n\n public componentDidUpdate(): void {\n if (this._updateSpan) {\n this._updateSpan.end();\n this._updateSpan = undefined;\n }\n }\n\n // If a component is unmounted, we can say it is no longer on the screen.\n // This means we can finish the span representing the component render.\n public componentWillUnmount(): void {\n const endTimestamp = timestampInSeconds();\n const { name, includeRender = true } = this.props;\n\n if (this._mountSpan && includeRender) {\n const startTime = spanToJSON(this._mountSpan).timestamp;\n withActiveSpan(this._mountSpan, () => {\n const renderSpan = startInactiveSpan({\n onlyIfParent: true,\n name: `<${name}>`,\n op: REACT_RENDER_OP,\n startTime,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n 'ui.component_name': name,\n },\n });\n if (renderSpan) {\n // Have to cast to Span because the type of _mountSpan is Span | undefined\n // and not getting narrowed properly\n renderSpan.end(endTimestamp);\n }\n });\n }\n }\n\n public render(): React.ReactNode {\n return this.props.children;\n }\n}\n\n// React.Component default props are defined as static property on the class\nObject.assign(Profiler, {\n defaultProps: {\n disabled: false,\n includeRender: true,\n includeUpdates: true,\n },\n});\n\n/**\n * withProfiler is a higher order component that wraps a\n * component in a {@link Profiler} component. It is recommended that\n * the higher order component be used over the regular {@link Profiler} component.\n *\n * @param WrappedComponent component that is wrapped by Profiler\n * @param options the {@link ProfilerProps} you can pass into the Profiler\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction withProfiler<P extends Record<string, any>>(\n WrappedComponent: React.ComponentType<P>,\n // We do not want to have `updateProps` given in options, it is instead filled through the HOC.\n options?: Pick<Partial<ProfilerProps>, Exclude<keyof ProfilerProps, 'updateProps' | 'children'>>,\n): React.FC<P> {\n const componentDisplayName =\n options?.name || WrappedComponent.displayName || WrappedComponent.name || UNKNOWN_COMPONENT;\n\n const Wrapped: React.FC<P> = (props: P) => (\n <Profiler {...options} name={componentDisplayName} updateProps={props}>\n <WrappedComponent {...props} />\n </Profiler>\n );\n\n Wrapped.displayName = `profiler(${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\n/**\n *\n * `useProfiler` is a React hook that profiles a React component.\n *\n * Requires React 16.8 or above.\n * @param name displayName of component being profiled\n */\nfunction useProfiler(\n name: string,\n options: { disabled?: boolean; hasRenderSpan?: boolean } = {\n disabled: false,\n hasRenderSpan: true,\n },\n): void {\n const [mountSpan] = React.useState(() => {\n if (options?.disabled) {\n return undefined;\n }\n\n return startInactiveSpan({\n name: `<${name}>`,\n onlyIfParent: true,\n op: REACT_MOUNT_OP,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n 'ui.component_name': name,\n },\n });\n });\n\n React.useEffect(() => {\n if (mountSpan) {\n mountSpan.end();\n }\n\n return (): void => {\n if (mountSpan && options.hasRenderSpan) {\n const startTime = spanToJSON(mountSpan).timestamp;\n const endTimestamp = timestampInSeconds();\n\n const renderSpan = startInactiveSpan({\n name: `<${name}>`,\n onlyIfParent: true,\n op: REACT_RENDER_OP,\n startTime,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n 'ui.component_name': name,\n },\n });\n if (renderSpan) {\n // Have to cast to Span because the type of _mountSpan is Span | undefined\n // and not getting narrowed properly\n renderSpan.end(endTimestamp);\n }\n }\n };\n // We only want this to run once.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n}\n\nexport { Profiler, useProfiler, withProfiler };\n"],"names":[],"mappings":";;;;;;AAOO,MAAM,iBAAA,GAAoB;AAsBjC,MAAM,QAAA,SAAiB,MAAM,SAAA,CAAyB;AAAA,EAW7C,YAAY,KAAA,EAAsB;AACvC,IAAA,KAAA,CAAM,KAAK,CAAA;AACX,IAAA,MAAM,EAAE,IAAA,EAAM,QAAA,GAAW,KAAA,KAAU,IAAA,CAAK,KAAA;AAExC,IAAA,IAAI,QAAA,EAAU;AACZ,MAAA;AAAA,IACF;AAEA,IAAA,IAAA,CAAK,aAAa,iBAAA,CAAkB;AAAA,MAClC,IAAA,EAAM,IAAI,IAAI,CAAA,CAAA,CAAA;AAAA,MACd,YAAA,EAAc,IAAA;AAAA,MACd,EAAA,EAAI,cAAA;AAAA,MACJ,UAAA,EAAY;AAAA,QACV,CAAC,gCAAgC,GAAG,wBAAA;AAAA,QACpC,mBAAA,EAAqB;AAAA;AACvB,KACD,CAA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A,CAAA;AAAA,UACd,YAAA,EAAc,IAAA;AAAA,UACd,EAAA,EAAI,eAAA;AAAA,UACJ,SAAA;AAAA,UACA,UAAA,EAAY;AAAA,YACV,CAAC,gCAAgC,GAAG,wBAAA;AAAA,YACpC,mBAAA,EAAqB;AAAA;AACvB,SACD,CAAA;AACD,QAAA,IAAI,UAAA,EAAY;AAGd,UAAA,UAAA,CAAW,IAAI,YAAY,CAAA;AAAA,QAC7B;AAAA,MACF;AAAA,IACF,CAAA;AAAA,EAGF,CAAA,EAAG,EAAE,CAAA;AACP;;;;"}
1
+ {"version":3,"file":"profiler.js","sources":["../../src/profiler.tsx"],"sourcesContent":["import { getClient, startInactiveSpan } from '@sentry/browser';\nimport type { Span } from '@sentry/core';\nimport {\n hasSpanStreamingEnabled,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n spanToJSON,\n timestampInSeconds,\n UI_MOUNT_SPAN_NAME_FALLBACK,\n UI_RENDER_SPAN_NAME_FALLBACK,\n UI_UPDATE_SPAN_NAME_FALLBACK,\n withActiveSpan,\n} from '@sentry/core';\nimport { SENTRY_DESCRIPTION, SENTRY_OP, UI_COMPONENT_NAME } from '@sentry/conventions/attributes';\nimport { UI_MOUNT, UI_RENDER, UI_UPDATE } from '@sentry/conventions/op';\nimport * as React from 'react';\nimport { hoistNonReactStatics } from './hoist-non-react-statics';\n\nexport const UNKNOWN_COMPONENT = 'unknown';\n\nexport type ProfilerProps = {\n // The name of the component being profiled.\n name: string;\n // If the Profiler is disabled. False by default. This is useful if you want to disable profilers\n // in certain environments.\n disabled?: boolean;\n // If time component is on page should be displayed as spans. True by default.\n includeRender?: boolean;\n // If component updates should be displayed as spans. True by default.\n includeUpdates?: boolean;\n // Component that is being profiled.\n children?: React.ReactNode;\n // props given to component being profiled.\n updateProps: { [key: string]: unknown };\n};\n\n/**\n * The Profiler component leverages Sentry's Tracing integration to generate\n * spans based on component lifecycles.\n */\nclass Profiler extends React.Component<ProfilerProps> {\n /**\n * The span of the mount activity\n * Made protected for the React Native SDK to access\n */\n protected _mountSpan: Span | undefined;\n /**\n * The span that represents the duration of time between shouldComponentUpdate and componentDidUpdate\n */\n protected _updateSpan: Span | undefined;\n\n public constructor(props: ProfilerProps) {\n super(props);\n const { name, disabled = false } = this.props;\n\n if (disabled) {\n return;\n }\n\n const client = getClient();\n const hasSpanStreaming = !!client && hasSpanStreamingEnabled(client);\n const description = `<${name}>`;\n const componentName = name === UNKNOWN_COMPONENT ? undefined : name;\n\n this._mountSpan = startInactiveSpan({\n name: hasSpanStreaming ? componentName || UI_MOUNT_SPAN_NAME_FALLBACK : description,\n onlyIfParent: true,\n attributes: {\n [SENTRY_OP]: UI_MOUNT,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n ...(componentName && { [UI_COMPONENT_NAME]: componentName }),\n ...(hasSpanStreaming && { [SENTRY_DESCRIPTION]: description }),\n },\n });\n }\n\n // If a component mounted, we can finish the mount activity.\n public componentDidMount(): void {\n if (this._mountSpan) {\n this._mountSpan.end();\n }\n }\n\n public shouldComponentUpdate({ updateProps, includeUpdates = true }: ProfilerProps): boolean {\n // Only generate an update span if includeUpdates is true, if there is a valid mountSpan,\n // and if the updateProps have changed. It is ok to not do a deep equality check here as it is expensive.\n // We are just trying to give baseline clues for further investigation.\n if (includeUpdates && this._mountSpan && updateProps !== this.props.updateProps) {\n // See what props have changed between the previous props, and the current props. This is\n // set as data on the span. We just store the prop keys as the values could be potentially very large.\n const changedProps = Object.keys(updateProps).filter(k => updateProps[k] !== this.props.updateProps[k]);\n if (changedProps.length > 0) {\n const now = timestampInSeconds();\n this._updateSpan = withActiveSpan(this._mountSpan, () => {\n const client = getClient();\n const hasSpanStreaming = !!client && hasSpanStreamingEnabled(client);\n const description = `<${this.props.name}>`;\n const componentName = this.props.name === UNKNOWN_COMPONENT ? undefined : this.props.name;\n\n return startInactiveSpan({\n name: hasSpanStreaming ? componentName || UI_UPDATE_SPAN_NAME_FALLBACK : description,\n onlyIfParent: true,\n startTime: now,\n attributes: {\n [SENTRY_OP]: UI_UPDATE,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n ...(componentName && { [UI_COMPONENT_NAME]: componentName }),\n 'ui.react.changed_props': changedProps,\n ...(hasSpanStreaming && { [SENTRY_DESCRIPTION]: description }),\n },\n });\n });\n }\n }\n\n return true;\n }\n\n public componentDidUpdate(): void {\n if (this._updateSpan) {\n this._updateSpan.end();\n this._updateSpan = undefined;\n }\n }\n\n // If a component is unmounted, we can say it is no longer on the screen.\n // This means we can finish the span representing the component render.\n public componentWillUnmount(): void {\n const endTimestamp = timestampInSeconds();\n const { name, includeRender = true } = this.props;\n\n if (this._mountSpan && includeRender) {\n const startTime = spanToJSON(this._mountSpan).end_timestamp;\n withActiveSpan(this._mountSpan, () => {\n const client = getClient();\n const hasSpanStreaming = !!client && hasSpanStreamingEnabled(client);\n const description = `<${name}>`;\n const componentName = name === UNKNOWN_COMPONENT ? undefined : name;\n\n const renderSpan = startInactiveSpan({\n onlyIfParent: true,\n name: hasSpanStreaming ? componentName || UI_RENDER_SPAN_NAME_FALLBACK : description,\n startTime,\n attributes: {\n [SENTRY_OP]: UI_RENDER,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n ...(componentName && { [UI_COMPONENT_NAME]: componentName }),\n ...(hasSpanStreaming && { [SENTRY_DESCRIPTION]: description }),\n },\n });\n if (renderSpan) {\n // Have to cast to Span because the type of _mountSpan is Span | undefined\n // and not getting narrowed properly\n renderSpan.end(endTimestamp);\n }\n });\n }\n }\n\n public render(): React.ReactNode {\n return this.props.children;\n }\n}\n\n// React.Component default props are defined as static property on the class\nObject.assign(Profiler, {\n defaultProps: {\n disabled: false,\n includeRender: true,\n includeUpdates: true,\n },\n});\n\n/**\n * withProfiler is a higher order component that wraps a\n * component in a {@link Profiler} component. It is recommended that\n * the higher order component be used over the regular {@link Profiler} component.\n *\n * @param WrappedComponent component that is wrapped by Profiler\n * @param options the {@link ProfilerProps} you can pass into the Profiler\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction withProfiler<P extends Record<string, any>>(\n WrappedComponent: React.ComponentType<P>,\n // We do not want to have `updateProps` given in options, it is instead filled through the HOC.\n options?: Pick<Partial<ProfilerProps>, Exclude<keyof ProfilerProps, 'updateProps' | 'children'>>,\n): React.FC<P> {\n const componentDisplayName =\n options?.name || WrappedComponent.displayName || WrappedComponent.name || UNKNOWN_COMPONENT;\n\n const Wrapped: React.FC<P> = (props: P) => (\n <Profiler {...options} name={componentDisplayName} updateProps={props}>\n <WrappedComponent {...props} />\n </Profiler>\n );\n\n Wrapped.displayName = `profiler(${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\n/**\n *\n * `useProfiler` is a React hook that profiles a React component.\n *\n * @param name displayName of component being profiled\n */\nfunction useProfiler(\n name: string,\n options: { disabled?: boolean; hasRenderSpan?: boolean } = {\n disabled: false,\n hasRenderSpan: true,\n },\n): void {\n const [mountSpan] = React.useState(() => {\n if (options?.disabled) {\n return undefined;\n }\n\n const client = getClient();\n const hasSpanStreaming = !!client && hasSpanStreamingEnabled(client);\n const description = `<${name}>`;\n const componentName = name === UNKNOWN_COMPONENT ? undefined : name;\n\n return startInactiveSpan({\n name: hasSpanStreaming ? componentName || UI_MOUNT_SPAN_NAME_FALLBACK : description,\n onlyIfParent: true,\n attributes: {\n [SENTRY_OP]: UI_MOUNT,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n ...(componentName && { [UI_COMPONENT_NAME]: componentName }),\n ...(hasSpanStreaming && { [SENTRY_DESCRIPTION]: description }),\n },\n });\n });\n\n React.useEffect(() => {\n if (mountSpan) {\n mountSpan.end();\n }\n\n return (): void => {\n if (mountSpan && options.hasRenderSpan) {\n const startTime = spanToJSON(mountSpan).end_timestamp;\n const endTimestamp = timestampInSeconds();\n\n const client = getClient();\n const hasSpanStreaming = !!client && hasSpanStreamingEnabled(client);\n const description = `<${name}>`;\n const componentName = name === UNKNOWN_COMPONENT ? undefined : name;\n\n const renderSpan = startInactiveSpan({\n name: hasSpanStreaming ? componentName || UI_RENDER_SPAN_NAME_FALLBACK : description,\n onlyIfParent: true,\n startTime,\n attributes: {\n [SENTRY_OP]: UI_RENDER,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n ...(componentName && { [UI_COMPONENT_NAME]: componentName }),\n ...(hasSpanStreaming && { [SENTRY_DESCRIPTION]: description }),\n },\n });\n if (renderSpan) {\n // Have to cast to Span because the type of _mountSpan is Span | undefined\n // and not getting narrowed properly\n renderSpan.end(endTimestamp);\n }\n }\n };\n // We only want this to run once.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n}\n\nexport { Profiler, useProfiler, withProfiler };\n"],"names":[],"mappings":";;;;;;;AAiBO,MAAM,iBAAA,GAAoB;AAsBjC,MAAM,QAAA,SAAiB,MAAM,SAAA,CAAyB;AAAA,EAW7C,YAAY,KAAA,EAAsB;AACvC,IAAA,KAAA,CAAM,KAAK,CAAA;AACX,IAAA,MAAM,EAAE,IAAA,EAAM,QAAA,GAAW,KAAA,KAAU,IAAA,CAAK,KAAA;AAExC,IAAA,IAAI,QAAA,EAAU;AACZ,MAAA;AAAA,IACF;AAEA,IAAA,MAAM,SAAS,SAAA,EAAU;AACzB,IAAA,MAAM,gBAAA,GAAmB,CAAC,CAAC,MAAA,IAAU,wBAAwB,MAAM,CAAA;AACnE,IAAA,MAAM,WAAA,GAAc,IAAI,IAAI,CAAA,CAAA,CAAA;AAC5B,IAAA,MAAM,aAAA,GAAgB,IAAA,KAAS,iBAAA,GAAoB,MAAA,GAAY,IAAA;AAE/D,IAAA,IAAA,CAAK,aAAa,i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b,MAAA,SAAA,CAAU,GAAA,EAAI;AAAA,IAChB;AAEA,IAAA,OAAO,MAAY;AACjB,MAAA,IAAI,SAAA,IAAa,QAAQ,aAAA,EAAe;AACtC,QAAA,MAAM,SAAA,GAAY,UAAA,CAAW,SAAS,CAAA,CAAE,aAAA;AACxC,QAAA,MAAM,eAAe,kBAAA,EAAmB;AAExC,QAAA,MAAM,SAAS,SAAA,EAAU;AACzB,QAAA,MAAM,gBAAA,GAAmB,CAAC,CAAC,MAAA,IAAU,wBAAwB,MAAM,CAAA;AACnE,QAAA,MAAM,WAAA,GAAc,IAAI,IAAI,CAAA,CAAA,CAAA;AAC5B,QAAA,MAAM,aAAA,GAAgB,IAAA,KAAS,iBAAA,GAAoB,MAAA,GAAY,IAAA;AAE/D,QAAA,MAAM,aAAa,iBAAA,CAAkB;AAAA,UACnC,IAAA,EAAM,gBAAA,GAAmB,aAAA,IAAiB,4BAAA,GAA+B,WAAA;AAAA,UACzE,YAAA,EAAc,IAAA;AAAA,UACd,SAAA;AAAA,UACA,UAAA,EAAY;AAAA,YACV,CAAC,SAAS,GAAG,SAAA;AAAA,YACb,CAAC,gCAAgC,GAAG,wBAAA;AAAA,YACpC,GAAI,aAAA,IAAiB,EAAE,CAAC,iBAAiB,GAAG,aAAA,EAAc;AAAA,YAC1D,GAAI,gBAAA,IAAoB,EAAE,CAAC,kBAAkB,GAAG,WAAA;AAAY;AAC9D,SACD,CAAA;AACD,QAAA,IAAI,UAAA,EAAY;AAGd,UAAA,UAAA,CAAW,IAAI,YAAY,CAAA;AAAA,QAC7B;AAAA,MACF;AAAA,IACF,CAAA;AAAA,EAGF,CAAA,EAAG,EAAE,CAAA;AACP;;;;"}
@@ -0,0 +1,16 @@
1
+ import { matchRoutes, createRoutesFromChildren, useNavigationType, useLocation } from 'react-router';
2
+ import { reactRouterBrowserTracingIntegration as reactRouterBrowserTracingIntegration$1 } from './reactrouter.compat.js';
3
+ export { wrapCreateBrowserRouter, wrapCreateMemoryRouter, wrapReactRouterRouting, wrapUseRoutes } from './reactrouter.compat.js';
4
+
5
+ function reactRouterBrowserTracingIntegration(options = {}) {
6
+ return reactRouterBrowserTracingIntegration$1({
7
+ useLocation,
8
+ useNavigationType,
9
+ createRoutesFromChildren,
10
+ matchRoutes,
11
+ ...options
12
+ });
13
+ }
14
+
15
+ export { reactRouterBrowserTracingIntegration };
16
+ //# sourceMappingURL=react-router.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-router.js","sources":["../../src/react-router.ts"],"sourcesContent":["import type { browserTracingIntegration } from '@sentry/browser';\nimport type { Integration } from '@sentry/core';\nimport { createRoutesFromChildren, matchRoutes, useLocation, useNavigationType } from 'react-router';\nimport type { ReactRouterOptions } from './reactrouter-compat-utils';\nimport { reactRouterBrowserTracingIntegration as reactRouterBrowserTracingIntegrationBase } from './reactrouter.compat';\n\n// The routing wrappers (`wrapReactRouterRouting`, `wrapUseRoutes`, `wrapCreateBrowserRouter`,\n// `wrapCreateMemoryRouter`) do not need the hooks - they read the config the integration below stored on\n// the client - so they are re-exported unchanged from the main entry point.\nexport {\n wrapReactRouterRouting,\n wrapCreateBrowserRouter,\n wrapCreateMemoryRouter,\n wrapUseRoutes,\n} from './reactrouter.compat';\n\ntype BrowserTracingOptions = Parameters<typeof browserTracingIntegration>[0];\n\n/**\n * A browser tracing integration for React Router v6, v7 and v8.\n *\n * Unlike {@link reactRouterBrowserTracingIntegration} exported from `@sentry/react`, this variant pulls the\n * required router hooks (`useLocation`, `useNavigationType`, `createRoutesFromChildren` and `matchRoutes`)\n * directly from `react-router`, so you don't have to pass them in:\n *\n * ```ts\n * import { reactRouterBrowserTracingIntegration } from '@sentry/react/react-router';\n *\n * Sentry.init({ integrations: [reactRouterBrowserTracingIntegration()] });\n * ```\n *\n * Any of the hooks can still be overridden via `options` (e.g. to supply the `react-router-dom` versions in v6).\n *\n * This requires `react-router` to be resolvable (it is declared as an optional peer dependency). If you are on\n * React Router v6 with only `react-router-dom` installed, either add `react-router` as a dependency or import\n * `reactRouterBrowserTracingIntegration` from `@sentry/react` and pass the hooks explicitly.\n */\nexport function reactRouterBrowserTracingIntegration(\n options: BrowserTracingOptions & Partial<ReactRouterOptions> = {},\n): Integration {\n return reactRouterBrowserTracingIntegrationBase({\n useLocation,\n useNavigationType,\n createRoutesFromChildren,\n matchRoutes,\n ...options,\n });\n}\n"],"names":["reactRouterBrowserTracingIntegrationBase"],"mappings":";;;;AAqCO,SAAS,oCAAA,CACd,OAAA,GAA+D,EAAC,EACnD;AACb,EAAA,OAAOA,sCAAA,CAAyC;AAAA,IAC9C,WAAA;AAAA,IACA,iBAAA;AAAA,IACA,wBAAA;AAAA,IACA,WAAA;AAAA,IACA,GAAG;AAAA,GACJ,CAAA;AACH;;;;"}