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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/README.md +2 -3
  2. package/cjs/constants.js +12 -5
  3. package/cjs/constants.js.map +1 -1
  4. package/cjs/errorboundary.js +134 -102
  5. package/cjs/errorboundary.js.map +1 -1
  6. package/cjs/flags.js +7 -3
  7. package/cjs/flags.js.map +1 -1
  8. package/cjs/index.js +30 -21
  9. package/cjs/index.js.map +1 -1
  10. package/cjs/profiler.js +172 -134
  11. package/cjs/profiler.js.map +1 -1
  12. package/cjs/reactrouter.js +145 -94
  13. package/cjs/reactrouter.js.map +1 -1
  14. package/cjs/reactrouterv3.js +107 -75
  15. package/cjs/reactrouterv3.js.map +1 -1
  16. package/cjs/reactrouterv6.js +163 -0
  17. package/cjs/reactrouterv6.js.map +1 -0
  18. package/cjs/redux.js +54 -42
  19. package/cjs/redux.js.map +1 -1
  20. package/cjs/sdk.js +18 -15
  21. package/cjs/sdk.js.map +1 -1
  22. package/esm/constants.js +8 -4
  23. package/esm/constants.js.map +1 -1
  24. package/esm/errorboundary.js +120 -97
  25. package/esm/errorboundary.js.map +1 -1
  26. package/esm/flags.js +5 -2
  27. package/esm/flags.js.map +1 -1
  28. package/esm/index.js +8 -7
  29. package/esm/index.js.map +1 -1
  30. package/esm/profiler.js +154 -125
  31. package/esm/profiler.js.map +1 -1
  32. package/esm/reactrouter.js +132 -88
  33. package/esm/reactrouter.js.map +1 -1
  34. package/esm/reactrouterv3.js +104 -72
  35. package/esm/reactrouterv3.js.map +1 -1
  36. package/esm/reactrouterv6.js +153 -0
  37. package/esm/reactrouterv6.js.map +1 -0
  38. package/esm/redux.js +51 -40
  39. package/esm/redux.js.map +1 -1
  40. package/esm/sdk.js +17 -14
  41. package/esm/sdk.js.map +1 -1
  42. package/package.json +5 -4
  43. package/types/index.d.ts +1 -0
  44. package/types/index.d.ts.map +1 -1
  45. package/types/reactrouterv6.d.ts +27 -0
  46. package/types/reactrouterv6.d.ts.map +1 -0
  47. package/cjs/constants.d.ts +0 -4
  48. package/cjs/constants.d.ts.map +0 -1
  49. package/cjs/errorboundary.d.ts +0 -63
  50. package/cjs/errorboundary.d.ts.map +0 -1
  51. package/cjs/flags.d.ts +0 -3
  52. package/cjs/flags.d.ts.map +0 -1
  53. package/cjs/index.d.ts +0 -8
  54. package/cjs/index.d.ts.map +0 -1
  55. package/cjs/profiler.d.ts +0 -54
  56. package/cjs/profiler.d.ts.map +0 -1
  57. package/cjs/reactrouter.d.ts +0 -25
  58. package/cjs/reactrouter.d.ts.map +0 -1
  59. package/cjs/reactrouterv3.d.ts +0 -26
  60. package/cjs/reactrouterv3.d.ts.map +0 -1
  61. package/cjs/redux.d.ts +0 -33
  62. package/cjs/redux.d.ts.map +0 -1
  63. package/cjs/sdk.d.ts +0 -6
  64. package/cjs/sdk.d.ts.map +0 -1
  65. package/cjs/types.d.ts +0 -8
  66. package/cjs/types.d.ts.map +0 -1
  67. package/cjs/types.js +0 -2
  68. package/cjs/types.js.map +0 -1
  69. package/esm/constants.d.ts +0 -4
  70. package/esm/constants.d.ts.map +0 -1
  71. package/esm/errorboundary.d.ts +0 -63
  72. package/esm/errorboundary.d.ts.map +0 -1
  73. package/esm/flags.d.ts +0 -3
  74. package/esm/flags.d.ts.map +0 -1
  75. package/esm/index.d.ts +0 -8
  76. package/esm/index.d.ts.map +0 -1
  77. package/esm/profiler.d.ts +0 -54
  78. package/esm/profiler.d.ts.map +0 -1
  79. package/esm/reactrouter.d.ts +0 -25
  80. package/esm/reactrouter.d.ts.map +0 -1
  81. package/esm/reactrouterv3.d.ts +0 -26
  82. package/esm/reactrouterv3.d.ts.map +0 -1
  83. package/esm/redux.d.ts +0 -33
  84. package/esm/redux.d.ts.map +0 -1
  85. package/esm/sdk.d.ts +0 -6
  86. package/esm/sdk.d.ts.map +0 -1
  87. package/esm/types.d.ts +0 -8
  88. package/esm/types.d.ts.map +0 -1
  89. package/esm/types.js +0 -1
  90. package/esm/types.js.map +0 -1
package/esm/profiler.js CHANGED
@@ -1,90 +1,100 @@
1
- /* eslint-disable @typescript-eslint/no-unsafe-member-access */
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
3
1
  import { getCurrentHub } from '@sentry/browser';
4
2
  import { timestampWithMs } from '@sentry/utils';
5
3
  import hoistNonReactStatics from 'hoist-non-react-statics';
6
4
  import * as React from 'react';
7
- import { REACT_MOUNT_OP, REACT_RENDER_OP, REACT_UPDATE_OP } from './constants';
8
- export const UNKNOWN_COMPONENT = 'unknown';
5
+ import { REACT_MOUNT_OP, REACT_UPDATE_OP, REACT_RENDER_OP } from './constants.js';
6
+
7
+ var _jsxFileName = "/home/runner/work/sentry-javascript/sentry-javascript/packages/react/src/profiler.tsx";
8
+ var UNKNOWN_COMPONENT = 'unknown';
9
+
9
10
  /**
10
11
  * The Profiler component leverages Sentry's Tracing integration to generate
11
12
  * spans based on component lifecycles.
12
13
  */
13
14
  class Profiler extends React.Component {
14
- constructor(props) {
15
- super(props);
16
- /**
17
- * The span of the mount activity
18
- * Made protected for the React Native SDK to access
19
- */
20
- this._mountSpan = undefined;
21
- const { name, disabled = false } = this.props;
22
- if (disabled) {
23
- return;
24
- }
25
- const activeTransaction = getActiveTransaction();
26
- if (activeTransaction) {
27
- this._mountSpan = activeTransaction.startChild({
28
- description: `<${name}>`,
29
- op: REACT_MOUNT_OP,
30
- });
31
- }
15
+ /**
16
+ * The span of the mount activity
17
+ * Made protected for the React Native SDK to access
18
+ */
19
+ __init() {this._mountSpan = undefined;}
20
+
21
+ static __initStatic() {this.defaultProps = {
22
+ disabled: false,
23
+ includeRender: true,
24
+ includeUpdates: true,
25
+ };}
26
+
27
+ constructor(props) {
28
+ super(props);Profiler.prototype.__init.call(this);;
29
+ const { name, disabled = false } = this.props;
30
+
31
+ if (disabled) {
32
+ return;
32
33
  }
33
- // If a component mounted, we can finish the mount activity.
34
- componentDidMount() {
35
- if (this._mountSpan) {
36
- this._mountSpan.finish();
37
- }
34
+
35
+ var activeTransaction = getActiveTransaction();
36
+ if (activeTransaction) {
37
+ this._mountSpan = activeTransaction.startChild({
38
+ description: `<${name}>`,
39
+ op: REACT_MOUNT_OP,
40
+ });
38
41
  }
39
- componentDidUpdate({ updateProps, includeUpdates = true }) {
40
- // Only generate an update span if hasUpdateSpan is true, if there is a valid mountSpan,
41
- // and if the updateProps have changed. It is ok to not do a deep equality check here as it is expensive.
42
- // We are just trying to give baseline clues for further investigation.
43
- if (includeUpdates && this._mountSpan && updateProps !== this.props.updateProps) {
44
- // See what props haved changed between the previous props, and the current props. This is
45
- // set as data on the span. We just store the prop keys as the values could be potenially very large.
46
- const changedProps = Object.keys(updateProps).filter(k => updateProps[k] !== this.props.updateProps[k]);
47
- if (changedProps.length > 0) {
48
- // The update span is a point in time span with 0 duration, just signifying that the component
49
- // has been updated.
50
- const now = timestampWithMs();
51
- this._mountSpan.startChild({
52
- data: {
53
- changedProps,
54
- },
55
- description: `<${this.props.name}>`,
56
- endTimestamp: now,
57
- op: REACT_UPDATE_OP,
58
- startTimestamp: now,
59
- });
60
- }
61
- }
42
+ }
43
+
44
+ // If a component mounted, we can finish the mount activity.
45
+ componentDidMount() {
46
+ if (this._mountSpan) {
47
+ this._mountSpan.finish();
62
48
  }
63
- // If a component is unmounted, we can say it is no longer on the screen.
64
- // This means we can finish the span representing the component render.
65
- componentWillUnmount() {
66
- const { name, includeRender = true } = this.props;
67
- if (this._mountSpan && includeRender) {
68
- // If we were able to obtain the spanId of the mount activity, we should set the
69
- // next activity as a child to the component mount activity.
70
- this._mountSpan.startChild({
71
- description: `<${name}>`,
72
- endTimestamp: timestampWithMs(),
73
- op: REACT_RENDER_OP,
74
- startTimestamp: this._mountSpan.endTimestamp,
75
- });
76
- }
49
+ }
50
+
51
+ componentDidUpdate({ updateProps, includeUpdates = true }) {
52
+ // Only generate an update span if hasUpdateSpan is true, if there is a valid mountSpan,
53
+ // and if the updateProps have changed. It is ok to not do a deep equality check here as it is expensive.
54
+ // We are just trying to give baseline clues for further investigation.
55
+ if (includeUpdates && this._mountSpan && updateProps !== this.props.updateProps) {
56
+ // See what props haved changed between the previous props, and the current props. This is
57
+ // set as data on the span. We just store the prop keys as the values could be potenially very large.
58
+ var changedProps = Object.keys(updateProps).filter(k => updateProps[k] !== this.props.updateProps[k]);
59
+ if (changedProps.length > 0) {
60
+ // The update span is a point in time span with 0 duration, just signifying that the component
61
+ // has been updated.
62
+ var now = timestampWithMs();
63
+ this._mountSpan.startChild({
64
+ data: {
65
+ changedProps,
66
+ },
67
+ description: `<${this.props.name}>`,
68
+ endTimestamp: now,
69
+ op: REACT_UPDATE_OP,
70
+ startTimestamp: now,
71
+ });
72
+ }
77
73
  }
78
- render() {
79
- return this.props.children;
74
+ }
75
+
76
+ // If a component is unmounted, we can say it is no longer on the screen.
77
+ // This means we can finish the span representing the component render.
78
+ componentWillUnmount() {
79
+ const { name, includeRender = true } = this.props;
80
+
81
+ if (this._mountSpan && includeRender) {
82
+ // If we were able to obtain the spanId of the mount activity, we should set the
83
+ // next activity as a child to the component mount activity.
84
+ this._mountSpan.startChild({
85
+ description: `<${name}>`,
86
+ endTimestamp: timestampWithMs(),
87
+ op: REACT_RENDER_OP,
88
+ startTimestamp: this._mountSpan.endTimestamp,
89
+ });
80
90
  }
81
- }
82
- // eslint-disable-next-line @typescript-eslint/member-ordering
83
- Profiler.defaultProps = {
84
- disabled: false,
85
- includeRender: true,
86
- includeUpdates: true,
87
- };
91
+ }
92
+
93
+ render() {
94
+ return this.props.children;
95
+ }
96
+ } Profiler.__initStatic();
97
+
88
98
  /**
89
99
  * withProfiler is a higher order component that wraps a
90
100
  * component in a {@link Profiler} component. It is recommended that
@@ -93,18 +103,28 @@ Profiler.defaultProps = {
93
103
  * @param WrappedComponent component that is wrapped by Profiler
94
104
  * @param options the {@link ProfilerProps} you can pass into the Profiler
95
105
  */
96
- function withProfiler(WrappedComponent,
97
- // We do not want to have `updateProps` given in options, it is instead filled through the HOC.
98
- options) {
99
- const componentDisplayName = (options && options.name) || WrappedComponent.displayName || WrappedComponent.name || UNKNOWN_COMPONENT;
100
- const Wrapped = (props) => (React.createElement(Profiler, Object.assign({}, options, { name: componentDisplayName, updateProps: props }),
101
- React.createElement(WrappedComponent, Object.assign({}, props))));
102
- Wrapped.displayName = `profiler(${componentDisplayName})`;
103
- // Copy over static methods from Wrapped component to Profiler HOC
104
- // See: https://reactjs.org/docs/higher-order-components.html#static-methods-must-be-copied-over
105
- hoistNonReactStatics(Wrapped, WrappedComponent);
106
- return Wrapped;
106
+ function withProfiler(
107
+ WrappedComponent,
108
+ // We do not want to have `updateProps` given in options, it is instead filled through the HOC.
109
+ options,
110
+ ) {
111
+ var componentDisplayName =
112
+ (options && options.name) || WrappedComponent.displayName || WrappedComponent.name || UNKNOWN_COMPONENT;
113
+
114
+ var Wrapped = (props) => (
115
+ React.createElement(Profiler, { ...options, name: componentDisplayName, updateProps: props, __self: this, __source: {fileName: _jsxFileName, lineNumber: 133}}
116
+ , React.createElement(WrappedComponent, { ...props, __self: this, __source: {fileName: _jsxFileName, lineNumber: 134}} )
117
+ )
118
+ );
119
+
120
+ Wrapped.displayName = `profiler(${componentDisplayName})`;
121
+
122
+ // Copy over static methods from Wrapped component to Profiler HOC
123
+ // See: https://reactjs.org/docs/higher-order-components.html#static-methods-must-be-copied-over
124
+ hoistNonReactStatics(Wrapped, WrappedComponent);
125
+ return Wrapped;
107
126
  }
127
+
108
128
  /**
109
129
  *
110
130
  * `useProfiler` is a React hook that profiles a React component.
@@ -112,50 +132,59 @@ options) {
112
132
  * Requires React 16.8 or above.
113
133
  * @param name displayName of component being profiled
114
134
  */
115
- function useProfiler(name, options = {
135
+ function useProfiler(
136
+ name,
137
+ options = {
116
138
  disabled: false,
117
139
  hasRenderSpan: true,
118
- }) {
119
- const [mountSpan] = React.useState(() => {
120
- if (options && options.disabled) {
121
- return undefined;
122
- }
123
- const activeTransaction = getActiveTransaction();
124
- if (activeTransaction) {
125
- return activeTransaction.startChild({
126
- description: `<${name}>`,
127
- op: REACT_MOUNT_OP,
128
- });
129
- }
130
- return undefined;
131
- });
132
- React.useEffect(() => {
133
- if (mountSpan) {
134
- mountSpan.finish();
135
- }
136
- return () => {
137
- if (mountSpan && options.hasRenderSpan) {
138
- mountSpan.startChild({
139
- description: `<${name}>`,
140
- endTimestamp: timestampWithMs(),
141
- op: REACT_RENDER_OP,
142
- startTimestamp: mountSpan.endTimestamp,
143
- });
144
- }
145
- };
146
- // We only want this to run once.
147
- // eslint-disable-next-line react-hooks/exhaustive-deps
148
- }, []);
140
+ },
141
+ ) {
142
+ const [mountSpan] = React.useState(() => {
143
+ if (options && options.disabled) {
144
+ return undefined;
145
+ }
146
+
147
+ var activeTransaction = getActiveTransaction();
148
+ if (activeTransaction) {
149
+ return activeTransaction.startChild({
150
+ description: `<${name}>`,
151
+ op: REACT_MOUNT_OP,
152
+ });
153
+ }
154
+
155
+ return undefined;
156
+ });
157
+
158
+ React.useEffect(() => {
159
+ if (mountSpan) {
160
+ mountSpan.finish();
161
+ }
162
+
163
+ return () => {
164
+ if (mountSpan && options.hasRenderSpan) {
165
+ mountSpan.startChild({
166
+ description: `<${name}>`,
167
+ endTimestamp: timestampWithMs(),
168
+ op: REACT_RENDER_OP,
169
+ startTimestamp: mountSpan.endTimestamp,
170
+ });
171
+ }
172
+ };
173
+ // We only want this to run once.
174
+ }, []);
149
175
  }
150
- export { withProfiler, Profiler, useProfiler };
176
+
151
177
  /** Grabs active transaction off scope */
152
- export function getActiveTransaction(hub = getCurrentHub()) {
153
- if (hub) {
154
- const scope = hub.getScope();
155
- if (scope) {
156
- return scope.getTransaction();
157
- }
178
+ function getActiveTransaction(hub = getCurrentHub()) {
179
+ if (hub) {
180
+ var scope = hub.getScope();
181
+ if (scope) {
182
+ return scope.getTransaction() ;
158
183
  }
159
- return undefined;
184
+ }
185
+
186
+ return undefined;
160
187
  }
161
- //# sourceMappingURL=profiler.js.map
188
+
189
+ export { Profiler, UNKNOWN_COMPONENT, getActiveTransaction, useProfiler, withProfiler };
190
+ //# sourceMappingURL=profiler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"profiler.js","sourceRoot":"","sources":["../../src/profiler.tsx"],"names":[],"mappings":"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","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { getCurrentHub, Hub } from '@sentry/browser';\nimport { Span, Transaction } from '@sentry/types';\nimport { timestampWithMs } from '@sentry/utils';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\nimport * as React from 'react';\n\nimport { REACT_MOUNT_OP, REACT_RENDER_OP, REACT_UPDATE_OP } from './constants';\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 // 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 = undefined;\n\n // eslint-disable-next-line @typescript-eslint/member-ordering\n public static defaultProps: Partial<ProfilerProps> = {\n disabled: false,\n includeRender: true,\n includeUpdates: true,\n };\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 activeTransaction = getActiveTransaction();\n if (activeTransaction) {\n this._mountSpan = activeTransaction.startChild({\n description: `<${name}>`,\n op: REACT_MOUNT_OP,\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.finish();\n }\n }\n\n public componentDidUpdate({ updateProps, includeUpdates = true }: ProfilerProps): void {\n // Only generate an update span if hasUpdateSpan 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 haved 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 potenially very large.\n const changedProps = Object.keys(updateProps).filter(k => updateProps[k] !== this.props.updateProps[k]);\n if (changedProps.length > 0) {\n // The update span is a point in time span with 0 duration, just signifying that the component\n // has been updated.\n const now = timestampWithMs();\n this._mountSpan.startChild({\n data: {\n changedProps,\n },\n description: `<${this.props.name}>`,\n endTimestamp: now,\n op: REACT_UPDATE_OP,\n startTimestamp: now,\n });\n }\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 { name, includeRender = true } = this.props;\n\n if (this._mountSpan && includeRender) {\n // If we were able to obtain the spanId of the mount activity, we should set the\n // next activity as a child to the component mount activity.\n this._mountSpan.startChild({\n description: `<${name}>`,\n endTimestamp: timestampWithMs(),\n op: REACT_RENDER_OP,\n startTimestamp: this._mountSpan.endTimestamp,\n });\n }\n }\n\n public render(): React.ReactNode {\n return this.props.children;\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 */\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'>>,\n): React.FC<P> {\n const componentDisplayName =\n (options && 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 && options.disabled) {\n return undefined;\n }\n\n const activeTransaction = getActiveTransaction();\n if (activeTransaction) {\n return activeTransaction.startChild({\n description: `<${name}>`,\n op: REACT_MOUNT_OP,\n });\n }\n\n return undefined;\n });\n\n React.useEffect(() => {\n if (mountSpan) {\n mountSpan.finish();\n }\n\n return (): void => {\n if (mountSpan && options.hasRenderSpan) {\n mountSpan.startChild({\n description: `<${name}>`,\n endTimestamp: timestampWithMs(),\n op: REACT_RENDER_OP,\n startTimestamp: mountSpan.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 { withProfiler, Profiler, useProfiler };\n\n/** Grabs active transaction off scope */\nexport function getActiveTransaction<T extends Transaction>(hub: Hub = getCurrentHub()): T | undefined {\n if (hub) {\n const scope = hub.getScope();\n if (scope) {\n return scope.getTransaction() as T | undefined;\n }\n }\n\n return undefined;\n}\n"]}
1
+ {"version":3,"file":"profiler.js","sources":["../../src/profiler.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { getCurrentHub, Hub } from '@sentry/browser';\nimport { Span, Transaction } from '@sentry/types';\nimport { timestampWithMs } from '@sentry/utils';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\nimport * as React from 'react';\n\nimport { REACT_MOUNT_OP, REACT_RENDER_OP, REACT_UPDATE_OP } from './constants';\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 // 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 = undefined;\n\n // eslint-disable-next-line @typescript-eslint/member-ordering\n public static defaultProps: Partial<ProfilerProps> = {\n disabled: false,\n includeRender: true,\n includeUpdates: true,\n };\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 activeTransaction = getActiveTransaction();\n if (activeTransaction) {\n this._mountSpan = activeTransaction.startChild({\n description: `<${name}>`,\n op: REACT_MOUNT_OP,\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.finish();\n }\n }\n\n public componentDidUpdate({ updateProps, includeUpdates = true }: ProfilerProps): void {\n // Only generate an update span if hasUpdateSpan 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 haved 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 potenially very large.\n const changedProps = Object.keys(updateProps).filter(k => updateProps[k] !== this.props.updateProps[k]);\n if (changedProps.length > 0) {\n // The update span is a point in time span with 0 duration, just signifying that the component\n // has been updated.\n const now = timestampWithMs();\n this._mountSpan.startChild({\n data: {\n changedProps,\n },\n description: `<${this.props.name}>`,\n endTimestamp: now,\n op: REACT_UPDATE_OP,\n startTimestamp: now,\n });\n }\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 { name, includeRender = true } = this.props;\n\n if (this._mountSpan && includeRender) {\n // If we were able to obtain the spanId of the mount activity, we should set the\n // next activity as a child to the component mount activity.\n this._mountSpan.startChild({\n description: `<${name}>`,\n endTimestamp: timestampWithMs(),\n op: REACT_RENDER_OP,\n startTimestamp: this._mountSpan.endTimestamp,\n });\n }\n }\n\n public render(): React.ReactNode {\n return this.props.children;\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 */\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'>>,\n): React.FC<P> {\n const componentDisplayName =\n (options && 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 && options.disabled) {\n return undefined;\n }\n\n const activeTransaction = getActiveTransaction();\n if (activeTransaction) {\n return activeTransaction.startChild({\n description: `<${name}>`,\n op: REACT_MOUNT_OP,\n });\n }\n\n return undefined;\n });\n\n React.useEffect(() => {\n if (mountSpan) {\n mountSpan.finish();\n }\n\n return (): void => {\n if (mountSpan && options.hasRenderSpan) {\n mountSpan.startChild({\n description: `<${name}>`,\n endTimestamp: timestampWithMs(),\n op: REACT_RENDER_OP,\n startTimestamp: mountSpan.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 { withProfiler, Profiler, useProfiler };\n\n/** Grabs active transaction off scope */\nexport function getActiveTransaction<T extends Transaction>(hub: Hub = getCurrentHub()): T | undefined {\n if (hub) {\n const scope = hub.getScope();\n if (scope) {\n return scope.getTransaction() as T | undefined;\n }\n }\n\n return undefined;\n}\n"],"names":[],"mappings":";;;;;;AAAA,2GASA;;;AAiBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;"}
@@ -1,110 +1,154 @@
1
1
  import { getGlobalObject } from '@sentry/utils';
2
2
  import hoistNonReactStatics from 'hoist-non-react-statics';
3
3
  import * as React from 'react';
4
- /* eslint-enable @typescript-eslint/no-explicit-any */
5
- const global = getGlobalObject();
4
+
5
+ var _jsxFileName = "/home/runner/work/sentry-javascript/sentry-javascript/packages/react/src/reactrouter.tsx";
6
+
7
+ // We need to disable eslint no-explict-any because any is required for the
8
+ // react-router typings.
9
+
10
+ var global = getGlobalObject();
11
+
6
12
  let activeTransaction;
7
- export function reactRouterV4Instrumentation(history, routes, matchPath) {
8
- return createReactRouterInstrumentation(history, 'react-router-v4', routes, matchPath);
13
+
14
+ function reactRouterV4Instrumentation(
15
+ history,
16
+ routes,
17
+ matchPath,
18
+ ) {
19
+ return createReactRouterInstrumentation(history, 'react-router-v4', routes, matchPath);
9
20
  }
10
- export function reactRouterV5Instrumentation(history, routes, matchPath) {
11
- return createReactRouterInstrumentation(history, 'react-router-v5', routes, matchPath);
21
+
22
+ function reactRouterV5Instrumentation(
23
+ history,
24
+ routes,
25
+ matchPath,
26
+ ) {
27
+ return createReactRouterInstrumentation(history, 'react-router-v5', routes, matchPath);
12
28
  }
13
- function createReactRouterInstrumentation(history, name, allRoutes = [], matchPath) {
14
- function getInitPathName() {
15
- if (history && history.location) {
16
- return history.location.pathname;
17
- }
18
- if (global && global.location) {
19
- return global.location.pathname;
20
- }
21
- return undefined;
29
+
30
+ function createReactRouterInstrumentation(
31
+ history,
32
+ name,
33
+ allRoutes = [],
34
+ matchPath,
35
+ ) {
36
+ function getInitPathName() {
37
+ if (history && history.location) {
38
+ return history.location.pathname;
22
39
  }
23
- function getTransactionName(pathname) {
24
- if (allRoutes.length === 0 || !matchPath) {
25
- return pathname;
26
- }
27
- const branches = matchRoutes(allRoutes, pathname, matchPath);
28
- // eslint-disable-next-line @typescript-eslint/prefer-for-of
40
+
41
+ if (global && global.location) {
42
+ return global.location.pathname;
43
+ }
44
+
45
+ return undefined;
46
+ }
47
+
48
+ function getTransactionName(pathname) {
49
+ if (allRoutes.length === 0 || !matchPath) {
50
+ return pathname;
51
+ }
52
+
53
+ var branches = matchRoutes(allRoutes, pathname, matchPath);
29
54
  for (let x = 0; x < branches.length; x++) {
30
- if (branches[x].match.isExact) {
31
- return branches[x].match.path;
32
- }
33
- }
34
- return pathname;
55
+ if (branches[x].match.isExact) {
56
+ return branches[x].match.path;
57
+ }
35
58
  }
36
- return (customStartTransaction, startTransactionOnPageLoad = true, startTransactionOnLocationChange = true) => {
37
- const initPathName = getInitPathName();
38
- if (startTransactionOnPageLoad && initPathName) {
39
- activeTransaction = customStartTransaction({
40
- name: getTransactionName(initPathName),
41
- op: 'pageload',
42
- tags: {
43
- 'routing.instrumentation': name,
44
- },
45
- });
46
- }
47
- if (startTransactionOnLocationChange && history.listen) {
48
- history.listen((location, action) => {
49
- if (action && (action === 'PUSH' || action === 'POP')) {
50
- if (activeTransaction) {
51
- activeTransaction.finish();
52
- }
53
- const tags = {
54
- 'routing.instrumentation': name,
55
- };
56
- activeTransaction = customStartTransaction({
57
- name: getTransactionName(location.pathname),
58
- op: 'navigation',
59
- tags,
60
- });
61
- }
62
- });
59
+
60
+ return pathname;
61
+ }
62
+
63
+ return (customStartTransaction, startTransactionOnPageLoad = true, startTransactionOnLocationChange = true) => {
64
+ var initPathName = getInitPathName();
65
+ if (startTransactionOnPageLoad && initPathName) {
66
+ activeTransaction = customStartTransaction({
67
+ name: getTransactionName(initPathName),
68
+ op: 'pageload',
69
+ tags: {
70
+ 'routing.instrumentation': name,
71
+ },
72
+ });
73
+ }
74
+
75
+ if (startTransactionOnLocationChange && history.listen) {
76
+ history.listen((location, action) => {
77
+ if (action && (action === 'PUSH' || action === 'POP')) {
78
+ if (activeTransaction) {
79
+ activeTransaction.finish();
80
+ }
81
+ var tags = {
82
+ 'routing.instrumentation': name,
83
+ };
84
+
85
+ activeTransaction = customStartTransaction({
86
+ name: getTransactionName(location.pathname),
87
+ op: 'navigation',
88
+ tags,
89
+ });
63
90
  }
64
- };
91
+ });
92
+ }
93
+ };
65
94
  }
95
+
66
96
  /**
67
97
  * Matches a set of routes to a pathname
68
98
  * Based on implementation from
69
99
  */
70
- function matchRoutes(routes, pathname, matchPath, branch = []) {
71
- routes.some(route => {
72
- const match = route.path
73
- ? matchPath(pathname, route)
74
- : branch.length
75
- ? branch[branch.length - 1].match // use parent match
76
- : computeRootMatch(pathname); // use default "root" match
77
- if (match) {
78
- branch.push({ route, match });
79
- if (route.routes) {
80
- matchRoutes(route.routes, pathname, matchPath, branch);
81
- }
82
- }
83
- return !!match;
84
- });
85
- return branch;
100
+ function matchRoutes(
101
+ routes,
102
+ pathname,
103
+ matchPath,
104
+ branch = [],
105
+ ) {
106
+ routes.some(route => {
107
+ var match = route.path
108
+ ? matchPath(pathname, route)
109
+ : branch.length
110
+ ? branch[branch.length - 1].match // use parent match
111
+ : computeRootMatch(pathname); // use default "root" match
112
+
113
+ if (match) {
114
+ branch.push({ route, match });
115
+
116
+ if (route.routes) {
117
+ matchRoutes(route.routes, pathname, matchPath, branch);
118
+ }
119
+ }
120
+
121
+ return !!match;
122
+ });
123
+
124
+ return branch;
86
125
  }
126
+
87
127
  function computeRootMatch(pathname) {
88
- return { path: '/', url: '/', params: {}, isExact: pathname === '/' };
128
+ return { path: '/', url: '/', params: {}, isExact: pathname === '/' };
89
129
  }
90
- /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */
91
- export function withSentryRouting(Route) {
92
- const componentDisplayName = Route.displayName || Route.name;
93
- const WrappedRoute = (props) => {
94
- if (activeTransaction && props && props.computedMatch && props.computedMatch.isExact) {
95
- activeTransaction.setName(props.computedMatch.path);
96
- }
97
- // @ts-ignore Setting more specific React Component typing for `R` generic above
98
- // will break advanced type inference done by react router params:
99
- // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/13dc4235c069e25fe7ee16e11f529d909f9f3ff8/types/react-router/index.d.ts#L154-L164
100
- return React.createElement(Route, Object.assign({}, props));
101
- };
102
- WrappedRoute.displayName = `sentryRoute(${componentDisplayName})`;
103
- hoistNonReactStatics(WrappedRoute, Route);
130
+
131
+ function withSentryRouting(Route) {
132
+ var componentDisplayName = (Route ).displayName || (Route ).name;
133
+
134
+ var WrappedRoute = (props) => {
135
+ if (activeTransaction && props && props.computedMatch && props.computedMatch.isExact) {
136
+ activeTransaction.setName(props.computedMatch.path);
137
+ }
138
+
104
139
  // @ts-ignore Setting more specific React Component typing for `R` generic above
105
140
  // will break advanced type inference done by react router params:
106
141
  // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/13dc4235c069e25fe7ee16e11f529d909f9f3ff8/types/react-router/index.d.ts#L154-L164
107
- return WrappedRoute;
142
+ return React.createElement(Route, { ...props, __self: this, __source: {fileName: _jsxFileName, lineNumber: 163}} );
143
+ };
144
+
145
+ WrappedRoute.displayName = `sentryRoute(${componentDisplayName})`;
146
+ hoistNonReactStatics(WrappedRoute, Route);
147
+ // @ts-ignore Setting more specific React Component typing for `R` generic above
148
+ // will break advanced type inference done by react router params:
149
+ // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/13dc4235c069e25fe7ee16e11f529d909f9f3ff8/types/react-router/index.d.ts#L154-L164
150
+ return WrappedRoute;
108
151
  }
109
- /* eslint-enable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */
110
- //# sourceMappingURL=reactrouter.js.map
152
+
153
+ export { reactRouterV4Instrumentation, reactRouterV5Instrumentation, withSentryRouting };
154
+ //# sourceMappingURL=reactrouter.js.map