@depup/sentry__react 10.44.0-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +25 -0
  3. package/build/cjs/constants.js +12 -0
  4. package/build/cjs/constants.js.map +1 -0
  5. package/build/cjs/debug-build.js +11 -0
  6. package/build/cjs/debug-build.js.map +1 -0
  7. package/build/cjs/error.js +113 -0
  8. package/build/cjs/error.js.map +1 -0
  9. package/build/cjs/errorboundary.js +170 -0
  10. package/build/cjs/errorboundary.js.map +1 -0
  11. package/build/cjs/hoist-non-react-statics.js +159 -0
  12. package/build/cjs/hoist-non-react-statics.js.map +1 -0
  13. package/build/cjs/index.js +51 -0
  14. package/build/cjs/index.js.map +1 -0
  15. package/build/cjs/profiler.js +226 -0
  16. package/build/cjs/profiler.js.map +1 -0
  17. package/build/cjs/reactrouter-compat-utils/instrumentation.js +1295 -0
  18. package/build/cjs/reactrouter-compat-utils/instrumentation.js.map +1 -0
  19. package/build/cjs/reactrouter-compat-utils/lazy-routes.js +160 -0
  20. package/build/cjs/reactrouter-compat-utils/lazy-routes.js.map +1 -0
  21. package/build/cjs/reactrouter-compat-utils/route-manifest.js +194 -0
  22. package/build/cjs/reactrouter-compat-utils/route-manifest.js.map +1 -0
  23. package/build/cjs/reactrouter-compat-utils/utils.js +336 -0
  24. package/build/cjs/reactrouter-compat-utils/utils.js.map +1 -0
  25. package/build/cjs/reactrouter.js +236 -0
  26. package/build/cjs/reactrouter.js.map +1 -0
  27. package/build/cjs/reactrouterv3.js +130 -0
  28. package/build/cjs/reactrouterv3.js.map +1 -0
  29. package/build/cjs/reactrouterv6.js +61 -0
  30. package/build/cjs/reactrouterv6.js.map +1 -0
  31. package/build/cjs/reactrouterv7.js +61 -0
  32. package/build/cjs/reactrouterv7.js.map +1 -0
  33. package/build/cjs/redux.js +106 -0
  34. package/build/cjs/redux.js.map +1 -0
  35. package/build/cjs/sdk.js +21 -0
  36. package/build/cjs/sdk.js.map +1 -0
  37. package/build/cjs/tanstackrouter.js +134 -0
  38. package/build/cjs/tanstackrouter.js.map +1 -0
  39. package/build/esm/constants.js +8 -0
  40. package/build/esm/constants.js.map +1 -0
  41. package/build/esm/debug-build.js +9 -0
  42. package/build/esm/debug-build.js.map +1 -0
  43. package/build/esm/error.js +108 -0
  44. package/build/esm/error.js.map +1 -0
  45. package/build/esm/errorboundary.js +166 -0
  46. package/build/esm/errorboundary.js.map +1 -0
  47. package/build/esm/hoist-non-react-statics.js +157 -0
  48. package/build/esm/hoist-non-react-statics.js.map +1 -0
  49. package/build/esm/index.js +12 -0
  50. package/build/esm/index.js.map +1 -0
  51. package/build/esm/package.json +1 -0
  52. package/build/esm/profiler.js +221 -0
  53. package/build/esm/profiler.js.map +1 -0
  54. package/build/esm/reactrouter-compat-utils/instrumentation.js +1281 -0
  55. package/build/esm/reactrouter-compat-utils/instrumentation.js.map +1 -0
  56. package/build/esm/reactrouter-compat-utils/lazy-routes.js +156 -0
  57. package/build/esm/reactrouter-compat-utils/lazy-routes.js.map +1 -0
  58. package/build/esm/reactrouter-compat-utils/route-manifest.js +191 -0
  59. package/build/esm/reactrouter-compat-utils/route-manifest.js.map +1 -0
  60. package/build/esm/reactrouter-compat-utils/utils.js +320 -0
  61. package/build/esm/reactrouter-compat-utils/utils.js.map +1 -0
  62. package/build/esm/reactrouter.js +232 -0
  63. package/build/esm/reactrouter.js.map +1 -0
  64. package/build/esm/reactrouterv3.js +128 -0
  65. package/build/esm/reactrouterv3.js.map +1 -0
  66. package/build/esm/reactrouterv6.js +55 -0
  67. package/build/esm/reactrouterv6.js.map +1 -0
  68. package/build/esm/reactrouterv7.js +55 -0
  69. package/build/esm/reactrouterv7.js.map +1 -0
  70. package/build/esm/redux.js +104 -0
  71. package/build/esm/redux.js.map +1 -0
  72. package/build/esm/sdk.js +19 -0
  73. package/build/esm/sdk.js.map +1 -0
  74. package/build/esm/tanstackrouter.js +132 -0
  75. package/build/esm/tanstackrouter.js.map +1 -0
  76. package/build/types/constants.d.ts +4 -0
  77. package/build/types/constants.d.ts.map +1 -0
  78. package/build/types/debug-build.d.ts +7 -0
  79. package/build/types/debug-build.d.ts.map +1 -0
  80. package/build/types/error.d.ts +41 -0
  81. package/build/types/error.d.ts.map +1 -0
  82. package/build/types/errorboundary.d.ts +87 -0
  83. package/build/types/errorboundary.d.ts.map +1 -0
  84. package/build/types/hoist-non-react-statics.d.ts +21 -0
  85. package/build/types/hoist-non-react-statics.d.ts.map +1 -0
  86. package/build/types/index.d.ts +13 -0
  87. package/build/types/index.d.ts.map +1 -0
  88. package/build/types/profiler.d.ts +56 -0
  89. package/build/types/profiler.d.ts.map +1 -0
  90. package/build/types/reactrouter-compat-utils/index.d.ts +5 -0
  91. package/build/types/reactrouter-compat-utils/index.d.ts.map +1 -0
  92. package/build/types/reactrouter-compat-utils/instrumentation.d.ts +117 -0
  93. package/build/types/reactrouter-compat-utils/instrumentation.d.ts.map +1 -0
  94. package/build/types/reactrouter-compat-utils/lazy-routes.d.ts +18 -0
  95. package/build/types/reactrouter-compat-utils/lazy-routes.d.ts.map +1 -0
  96. package/build/types/reactrouter-compat-utils/route-manifest.d.ts +13 -0
  97. package/build/types/reactrouter-compat-utils/route-manifest.d.ts.map +1 -0
  98. package/build/types/reactrouter-compat-utils/utils.d.ts +71 -0
  99. package/build/types/reactrouter-compat-utils/utils.d.ts.map +1 -0
  100. package/build/types/reactrouter.d.ts +41 -0
  101. package/build/types/reactrouter.d.ts.map +1 -0
  102. package/build/types/reactrouterv3.d.ts +29 -0
  103. package/build/types/reactrouterv3.d.ts.map +1 -0
  104. package/build/types/reactrouterv6.d.ts +32 -0
  105. package/build/types/reactrouterv6.d.ts.map +1 -0
  106. package/build/types/reactrouterv7.d.ts +32 -0
  107. package/build/types/reactrouterv7.d.ts.map +1 -0
  108. package/build/types/redux.d.ts +38 -0
  109. package/build/types/redux.d.ts.map +1 -0
  110. package/build/types/sdk.d.ts +7 -0
  111. package/build/types/sdk.d.ts.map +1 -0
  112. package/build/types/tanstackrouter.d.ts +13 -0
  113. package/build/types/tanstackrouter.d.ts.map +1 -0
  114. package/build/types/types.d.ts +163 -0
  115. package/build/types/types.d.ts.map +1 -0
  116. package/build/types/vendor/tanstackrouter-types.d.ts +36 -0
  117. package/build/types/vendor/tanstackrouter-types.d.ts.map +1 -0
  118. package/build/types-ts3.8/constants.d.ts +4 -0
  119. package/build/types-ts3.8/debug-build.d.ts +7 -0
  120. package/build/types-ts3.8/error.d.ts +41 -0
  121. package/build/types-ts3.8/errorboundary.d.ts +87 -0
  122. package/build/types-ts3.8/hoist-non-react-statics.d.ts +21 -0
  123. package/build/types-ts3.8/index.d.ts +13 -0
  124. package/build/types-ts3.8/profiler.d.ts +56 -0
  125. package/build/types-ts3.8/reactrouter-compat-utils/index.d.ts +5 -0
  126. package/build/types-ts3.8/reactrouter-compat-utils/instrumentation.d.ts +117 -0
  127. package/build/types-ts3.8/reactrouter-compat-utils/lazy-routes.d.ts +18 -0
  128. package/build/types-ts3.8/reactrouter-compat-utils/route-manifest.d.ts +13 -0
  129. package/build/types-ts3.8/reactrouter-compat-utils/utils.d.ts +77 -0
  130. package/build/types-ts3.8/reactrouter.d.ts +41 -0
  131. package/build/types-ts3.8/reactrouterv3.d.ts +29 -0
  132. package/build/types-ts3.8/reactrouterv6.d.ts +32 -0
  133. package/build/types-ts3.8/reactrouterv7.d.ts +32 -0
  134. package/build/types-ts3.8/redux.d.ts +38 -0
  135. package/build/types-ts3.8/sdk.d.ts +7 -0
  136. package/build/types-ts3.8/tanstackrouter.d.ts +13 -0
  137. package/build/types-ts3.8/types.d.ts +163 -0
  138. package/build/types-ts3.8/vendor/tanstackrouter-types.d.ts +36 -0
  139. package/changes.json +5 -0
  140. package/package.json +108 -0
@@ -0,0 +1,221 @@
1
+ import { startInactiveSpan } from '@sentry/browser';
2
+ import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, timestampInSeconds, withActiveSpan, spanToJSON } from '@sentry/core';
3
+ import * as React from 'react';
4
+ import { REACT_MOUNT_OP, REACT_UPDATE_OP, REACT_RENDER_OP } from './constants.js';
5
+ import { hoistNonReactStatics } from './hoist-non-react-statics.js';
6
+
7
+ const UNKNOWN_COMPONENT = 'unknown';
8
+
9
+ /**
10
+ * The Profiler component leverages Sentry's Tracing integration to generate
11
+ * spans based on component lifecycles.
12
+ */
13
+ class Profiler extends React.Component {
14
+ /**
15
+ * The span of the mount activity
16
+ * Made protected for the React Native SDK to access
17
+ */
18
+
19
+ /**
20
+ * The span that represents the duration of time between shouldComponentUpdate and componentDidUpdate
21
+ */
22
+
23
+ constructor(props) {
24
+ super(props);
25
+ const { name, disabled = false } = this.props;
26
+
27
+ if (disabled) {
28
+ return;
29
+ }
30
+
31
+ this._mountSpan = startInactiveSpan({
32
+ name: `<${name}>`,
33
+ onlyIfParent: true,
34
+ op: REACT_MOUNT_OP,
35
+ attributes: {
36
+ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',
37
+ 'ui.component_name': name,
38
+ },
39
+ });
40
+ }
41
+
42
+ // If a component mounted, we can finish the mount activity.
43
+ componentDidMount() {
44
+ if (this._mountSpan) {
45
+ this._mountSpan.end();
46
+ }
47
+ }
48
+
49
+ shouldComponentUpdate({ updateProps, includeUpdates = true }) {
50
+ // Only generate an update span if includeUpdates is true, if there is a valid mountSpan,
51
+ // and if the updateProps have changed. It is ok to not do a deep equality check here as it is expensive.
52
+ // We are just trying to give baseline clues for further investigation.
53
+ if (includeUpdates && this._mountSpan && updateProps !== this.props.updateProps) {
54
+ // See what props have changed between the previous props, and the current props. This is
55
+ // set as data on the span. We just store the prop keys as the values could be potentially very large.
56
+ const changedProps = Object.keys(updateProps).filter(k => updateProps[k] !== this.props.updateProps[k]);
57
+ if (changedProps.length > 0) {
58
+ const now = timestampInSeconds();
59
+ this._updateSpan = withActiveSpan(this._mountSpan, () => {
60
+ return startInactiveSpan({
61
+ name: `<${this.props.name}>`,
62
+ onlyIfParent: true,
63
+ op: REACT_UPDATE_OP,
64
+ startTime: now,
65
+ attributes: {
66
+ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',
67
+ 'ui.component_name': this.props.name,
68
+ 'ui.react.changed_props': changedProps,
69
+ },
70
+ });
71
+ });
72
+ }
73
+ }
74
+
75
+ return true;
76
+ }
77
+
78
+ componentDidUpdate() {
79
+ if (this._updateSpan) {
80
+ this._updateSpan.end();
81
+ this._updateSpan = undefined;
82
+ }
83
+ }
84
+
85
+ // If a component is unmounted, we can say it is no longer on the screen.
86
+ // This means we can finish the span representing the component render.
87
+ componentWillUnmount() {
88
+ const endTimestamp = timestampInSeconds();
89
+ const { name, includeRender = true } = this.props;
90
+
91
+ if (this._mountSpan && includeRender) {
92
+ const startTime = spanToJSON(this._mountSpan).timestamp;
93
+ withActiveSpan(this._mountSpan, () => {
94
+ const renderSpan = startInactiveSpan({
95
+ onlyIfParent: true,
96
+ name: `<${name}>`,
97
+ op: REACT_RENDER_OP,
98
+ startTime,
99
+ attributes: {
100
+ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',
101
+ 'ui.component_name': name,
102
+ },
103
+ });
104
+ if (renderSpan) {
105
+ // Have to cast to Span because the type of _mountSpan is Span | undefined
106
+ // and not getting narrowed properly
107
+ renderSpan.end(endTimestamp);
108
+ }
109
+ });
110
+ }
111
+ }
112
+
113
+ render() {
114
+ return this.props.children;
115
+ }
116
+ }
117
+
118
+ // React.Component default props are defined as static property on the class
119
+ Object.assign(Profiler, {
120
+ defaultProps: {
121
+ disabled: false,
122
+ includeRender: true,
123
+ includeUpdates: true,
124
+ },
125
+ });
126
+
127
+ /**
128
+ * withProfiler is a higher order component that wraps a
129
+ * component in a {@link Profiler} component. It is recommended that
130
+ * the higher order component be used over the regular {@link Profiler} component.
131
+ *
132
+ * @param WrappedComponent component that is wrapped by Profiler
133
+ * @param options the {@link ProfilerProps} you can pass into the Profiler
134
+ */
135
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
136
+ function withProfiler(
137
+ WrappedComponent,
138
+ // We do not want to have `updateProps` given in options, it is instead filled through the HOC.
139
+ options,
140
+ ) {
141
+ const componentDisplayName =
142
+ options?.name || WrappedComponent.displayName || WrappedComponent.name || UNKNOWN_COMPONENT;
143
+
144
+ const Wrapped = (props) => (
145
+ React.createElement(Profiler, { ...options, name: componentDisplayName, updateProps: props,}
146
+ , React.createElement(WrappedComponent, { ...props,} )
147
+ )
148
+ );
149
+
150
+ Wrapped.displayName = `profiler(${componentDisplayName})`;
151
+
152
+ // Copy over static methods from Wrapped component to Profiler HOC
153
+ // See: https://reactjs.org/docs/higher-order-components.html#static-methods-must-be-copied-over
154
+ hoistNonReactStatics(Wrapped, WrappedComponent);
155
+ return Wrapped;
156
+ }
157
+
158
+ /**
159
+ *
160
+ * `useProfiler` is a React hook that profiles a React component.
161
+ *
162
+ * Requires React 16.8 or above.
163
+ * @param name displayName of component being profiled
164
+ */
165
+ function useProfiler(
166
+ name,
167
+ options = {
168
+ disabled: false,
169
+ hasRenderSpan: true,
170
+ },
171
+ ) {
172
+ const [mountSpan] = React.useState(() => {
173
+ if (options?.disabled) {
174
+ return undefined;
175
+ }
176
+
177
+ return startInactiveSpan({
178
+ name: `<${name}>`,
179
+ onlyIfParent: true,
180
+ op: REACT_MOUNT_OP,
181
+ attributes: {
182
+ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',
183
+ 'ui.component_name': name,
184
+ },
185
+ });
186
+ });
187
+
188
+ React.useEffect(() => {
189
+ if (mountSpan) {
190
+ mountSpan.end();
191
+ }
192
+
193
+ return () => {
194
+ if (mountSpan && options.hasRenderSpan) {
195
+ const startTime = spanToJSON(mountSpan).timestamp;
196
+ const endTimestamp = timestampInSeconds();
197
+
198
+ const renderSpan = startInactiveSpan({
199
+ name: `<${name}>`,
200
+ onlyIfParent: true,
201
+ op: REACT_RENDER_OP,
202
+ startTime,
203
+ attributes: {
204
+ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',
205
+ 'ui.component_name': name,
206
+ },
207
+ });
208
+ if (renderSpan) {
209
+ // Have to cast to Span because the type of _mountSpan is Span | undefined
210
+ // and not getting narrowed properly
211
+ renderSpan.end(endTimestamp);
212
+ }
213
+ }
214
+ };
215
+ // We only want this to run once.
216
+ // eslint-disable-next-line react-hooks/exhaustive-deps
217
+ }, []);
218
+ }
219
+
220
+ export { Profiler, UNKNOWN_COMPONENT, useProfiler, withProfiler };
221
+ //# sourceMappingURL=profiler.js.map
@@ -0,0 +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;;AAkBjC;AACA;AACA;AACA;AACA,MAAM,QAAA,SAAiB,KAAK,CAAC,SAAS,CAAgB;AACtD;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAGA,GAAS,WAAW,CAAC,KAAK,EAAiB;AAC3C,IAAI,KAAK,CAAC,KAAK,CAAC;AAChB,IAAI,MAAM,EAAE,IAAI,EAAE,QAAA,GAAW,KAAA,EAAM,GAAI,IAAI,CAAC,KAAK;;AAEjD,IAAI,IAAI,QAAQ,EAAE;AAClB,MAAM;AACN,IAAI;;AAEJ,IAAI,IAAI,CAAC,UAAA,GAAa,iBAAiB,CAAC;AACxC,MAAM,IAAI,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;AACvB,MAAM,YAAY,EAAE,IAAI;AACxB,MAAM,EAAE,EAAE,cAAc;A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