@sentry/react 8.5.0 → 8.7.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.
- package/README.md +31 -4
- package/cjs/error.js +112 -0
- package/cjs/error.js.map +1 -0
- package/cjs/errorboundary.js +10 -56
- package/cjs/errorboundary.js.map +1 -1
- package/cjs/index.js +4 -0
- package/cjs/index.js.map +1 -1
- package/cjs/reactrouterv6.js +3 -3
- package/cjs/reactrouterv6.js.map +1 -1
- package/cjs/tanstackrouter.js +120 -0
- package/cjs/tanstackrouter.js.map +1 -0
- package/esm/error.js +107 -0
- package/esm/error.js.map +1 -0
- package/esm/errorboundary.js +12 -57
- package/esm/errorboundary.js.map +1 -1
- package/esm/index.js +2 -0
- package/esm/index.js.map +1 -1
- package/esm/reactrouterv6.js +3 -3
- package/esm/reactrouterv6.js.map +1 -1
- package/esm/tanstackrouter.js +118 -0
- package/esm/tanstackrouter.js.map +1 -0
- package/package.json +7 -7
- package/types/error.d.ts +41 -0
- package/types/error.d.ts.map +1 -0
- package/types/errorboundary.d.ts +4 -5
- package/types/errorboundary.d.ts.map +1 -1
- package/types/index.d.ts +2 -0
- package/types/index.d.ts.map +1 -1
- package/types/tanstackrouter.d.ts +13 -0
- package/types/tanstackrouter.d.ts.map +1 -0
- package/types/vendor/tanstackrouter-types.d.ts +33 -0
- package/types/vendor/tanstackrouter-types.d.ts.map +1 -0
- package/types-ts3.8/error.d.ts +41 -0
- package/types-ts3.8/errorboundary.d.ts +4 -5
- package/types-ts3.8/index.d.ts +2 -0
- package/types-ts3.8/tanstackrouter.d.ts +13 -0
- package/types-ts3.8/vendor/tanstackrouter-types.d.ts +33 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { browserTracingIntegration, WINDOW, startBrowserTracingPageLoadSpan, startBrowserTracingNavigationSpan } from '@sentry/browser';
|
|
2
|
+
import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A custom browser tracing integration for TanStack Router.
|
|
6
|
+
*
|
|
7
|
+
* The minimum compatible version of `@tanstack/router` is `1.34.5`.
|
|
8
|
+
*
|
|
9
|
+
* @param router A TanStack Router `Router` instance that should be used for routing instrumentation.
|
|
10
|
+
* @param options Sentry browser tracing configuration.
|
|
11
|
+
*/
|
|
12
|
+
function tanstackRouterBrowserTracingIntegration(
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
+
router, // This is `any` because we don't want any type mismatches if TanStack Router changes their types
|
|
15
|
+
options = {},
|
|
16
|
+
) {
|
|
17
|
+
const castRouterInstance = router;
|
|
18
|
+
|
|
19
|
+
const browserTracingIntegrationInstance = browserTracingIntegration({
|
|
20
|
+
...options,
|
|
21
|
+
instrumentNavigation: false,
|
|
22
|
+
instrumentPageLoad: false,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const { instrumentPageLoad = true, instrumentNavigation = true } = options;
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
...browserTracingIntegrationInstance,
|
|
29
|
+
afterAllSetup(client) {
|
|
30
|
+
browserTracingIntegrationInstance.afterAllSetup(client);
|
|
31
|
+
|
|
32
|
+
const initialWindowLocation = WINDOW.location;
|
|
33
|
+
if (instrumentPageLoad && initialWindowLocation) {
|
|
34
|
+
const matchedRoutes = castRouterInstance.matchRoutes(
|
|
35
|
+
initialWindowLocation.pathname,
|
|
36
|
+
initialWindowLocation.search,
|
|
37
|
+
{ preload: false, throwOnError: false },
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
const lastMatch = matchedRoutes[matchedRoutes.length - 1];
|
|
41
|
+
|
|
42
|
+
startBrowserTracingPageLoadSpan(client, {
|
|
43
|
+
name: lastMatch ? lastMatch.routeId : initialWindowLocation.pathname,
|
|
44
|
+
attributes: {
|
|
45
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload',
|
|
46
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.tanstack_router',
|
|
47
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: lastMatch ? 'route' : 'url',
|
|
48
|
+
...routeMatchToParamSpanAttributes(lastMatch),
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (instrumentNavigation) {
|
|
54
|
+
// 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
|
|
55
|
+
castRouterInstance.subscribe('onBeforeNavigate', onBeforeNavigateArgs => {
|
|
56
|
+
// onBeforeNavigate is called during pageloads. We can avoid creating navigation spans by comparing the states of the to and from arguments.
|
|
57
|
+
if (onBeforeNavigateArgs.toLocation.state === onBeforeNavigateArgs.fromLocation.state) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const onResolvedMatchedRoutes = castRouterInstance.matchRoutes(
|
|
62
|
+
onBeforeNavigateArgs.toLocation.pathname,
|
|
63
|
+
onBeforeNavigateArgs.toLocation.search,
|
|
64
|
+
{ preload: false, throwOnError: false },
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const onBeforeNavigateLastMatch = onResolvedMatchedRoutes[onResolvedMatchedRoutes.length - 1];
|
|
68
|
+
|
|
69
|
+
const navigationLocation = WINDOW.location;
|
|
70
|
+
const navigationSpan = startBrowserTracingNavigationSpan(client, {
|
|
71
|
+
name: onBeforeNavigateLastMatch ? onBeforeNavigateLastMatch.routeId : navigationLocation.pathname,
|
|
72
|
+
attributes: {
|
|
73
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',
|
|
74
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.tanstack_router',
|
|
75
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: onBeforeNavigateLastMatch ? 'route' : 'url',
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// In case the user is redirected during navigation we want to update the span with the right value.
|
|
80
|
+
const unsubscribeOnResolved = castRouterInstance.subscribe('onResolved', onResolvedArgs => {
|
|
81
|
+
unsubscribeOnResolved();
|
|
82
|
+
if (navigationSpan) {
|
|
83
|
+
const onResolvedMatchedRoutes = castRouterInstance.matchRoutes(
|
|
84
|
+
onResolvedArgs.toLocation.pathname,
|
|
85
|
+
onResolvedArgs.toLocation.search,
|
|
86
|
+
{ preload: false, throwOnError: false },
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
const onResolvedLastMatch = onResolvedMatchedRoutes[onResolvedMatchedRoutes.length - 1];
|
|
90
|
+
|
|
91
|
+
if (onResolvedLastMatch) {
|
|
92
|
+
navigationSpan.updateName(onResolvedLastMatch.routeId);
|
|
93
|
+
navigationSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route');
|
|
94
|
+
navigationSpan.setAttributes(routeMatchToParamSpanAttributes(onResolvedLastMatch));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function routeMatchToParamSpanAttributes(match) {
|
|
105
|
+
if (!match) {
|
|
106
|
+
return {};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const paramAttributes = {};
|
|
110
|
+
for (const key of Object.keys(match.params)) {
|
|
111
|
+
paramAttributes[`url.path.params.${key}`] = match.params[key];
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return paramAttributes;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export { tanstackRouterBrowserTracingIntegration };
|
|
118
|
+
//# sourceMappingURL=tanstackrouter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tanstackrouter.js","sources":["../../src/tanstackrouter.ts"],"sourcesContent":["import { WINDOW, startBrowserTracingNavigationSpan, startBrowserTracingPageLoadSpan } from '@sentry/browser';\nimport {\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n} from '@sentry/core';\n\nimport { browserTracingIntegration as originalBrowserTracingIntegration } from '@sentry/browser';\nimport type { Integration } from '@sentry/types';\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/router` is `1.34.5`.\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 initialWindowLocation.search,\n { preload: false, throwOnError: false },\n );\n\n const lastMatch = matchedRoutes[matchedRoutes.length - 1];\n\n startBrowserTracingPageLoadSpan(client, {\n name: lastMatch ? lastMatch.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]: lastMatch ? 'route' : 'url',\n ...routeMatchToParamSpanAttributes(lastMatch),\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 comparing the states of the to and from arguments.\n if (onBeforeNavigateArgs.toLocation.state === onBeforeNavigateArgs.fromLocation.state) {\n return;\n }\n\n const onResolvedMatchedRoutes = castRouterInstance.matchRoutes(\n onBeforeNavigateArgs.toLocation.pathname,\n onBeforeNavigateArgs.toLocation.search,\n { preload: false, throwOnError: false },\n );\n\n const onBeforeNavigateLastMatch = onResolvedMatchedRoutes[onResolvedMatchedRoutes.length - 1];\n\n const navigationLocation = WINDOW.location;\n const navigationSpan = startBrowserTracingNavigationSpan(client, {\n name: onBeforeNavigateLastMatch ? onBeforeNavigateLastMatch.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]: onBeforeNavigateLastMatch ? '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 onResolvedMatchedRoutes = castRouterInstance.matchRoutes(\n onResolvedArgs.toLocation.pathname,\n onResolvedArgs.toLocation.search,\n { preload: false, throwOnError: false },\n );\n\n const onResolvedLastMatch = onResolvedMatchedRoutes[onResolvedMatchedRoutes.length - 1];\n\n if (onResolvedLastMatch) {\n navigationSpan.updateName(onResolvedLastMatch.routeId);\n navigationSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route');\n navigationSpan.setAttributes(routeMatchToParamSpanAttributes(onResolvedLastMatch));\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 for (const key of Object.keys(match.params)) {\n paramAttributes[`url.path.params.${key}`] = match.params[key];\n }\n\n return paramAttributes;\n}\n"],"names":["originalBrowserTracingIntegration"],"mappings":";;;AAWA;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,CAAA;AAC3D;AACA,EAAE,MAAM,iCAAA,GAAoCA,yBAAiC,CAAC;AAC9E,IAAI,GAAG,OAAO;AACd,IAAI,oBAAoB,EAAE,KAAK;AAC/B,IAAI,kBAAkB,EAAE,KAAK;AAC7B,GAAG,CAAC,CAAA;AACJ;AACA,EAAE,MAAM,EAAE,kBAAA,GAAqB,IAAI,EAAE,oBAAA,GAAuB,IAAA,EAAO,GAAE,OAAO,CAAA;AAC5E;AACA,EAAE,OAAO;AACT,IAAI,GAAG,iCAAiC;AACxC,IAAI,aAAa,CAAC,MAAM,EAAE;AAC1B,MAAM,iCAAiC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;AAC7D;AACA,MAAM,MAAM,qBAAA,GAAwB,MAAM,CAAC,QAAQ,CAAA;AACnD,MAAM,IAAI,kBAAmB,IAAG,qBAAqB,EAAE;AACvD,QAAQ,MAAM,aAAA,GAAgB,kBAAkB,CAAC,WAAW;AAC5D,UAAU,qBAAqB,CAAC,QAAQ;AACxC,UAAU,qBAAqB,CAAC,MAAM;AACtC,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO;AACjD,SAAS,CAAA;AACT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AK,MAAM,GAAA,IAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;AAC/C,IAAI,eAAe,CAAC,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAA,CAAA,GAAA,KAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA;AACA,GAAA;AACA;AACA,EAAA,OAAA,eAAA,CAAA;AACA;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/react",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.7.0",
|
|
4
4
|
"description": "Official Sentry SDK for React.js",
|
|
5
5
|
"repository": "git://github.com/getsentry/sentry-javascript.git",
|
|
6
6
|
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/react",
|
|
@@ -42,10 +42,10 @@
|
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@sentry/browser": "8.
|
|
46
|
-
"@sentry/core": "8.
|
|
47
|
-
"@sentry/types": "8.
|
|
48
|
-
"@sentry/utils": "8.
|
|
45
|
+
"@sentry/browser": "8.7.0",
|
|
46
|
+
"@sentry/core": "8.7.0",
|
|
47
|
+
"@sentry/types": "8.7.0",
|
|
48
|
+
"@sentry/utils": "8.7.0",
|
|
49
49
|
"hoist-non-react-statics": "^3.3.2"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
@@ -56,9 +56,9 @@
|
|
|
56
56
|
"@testing-library/react-hooks": "^7.0.2",
|
|
57
57
|
"@types/history-4": "npm:@types/history@4.7.8",
|
|
58
58
|
"@types/history-5": "npm:@types/history@4.7.8",
|
|
59
|
-
"@types/hoist-non-react-statics": "^3.3.
|
|
59
|
+
"@types/hoist-non-react-statics": "^3.3.5",
|
|
60
60
|
"@types/node-fetch": "^2.6.0",
|
|
61
|
-
"@types/react": "
|
|
61
|
+
"@types/react": "17.0.3",
|
|
62
62
|
"@types/react-router-3": "npm:@types/react-router@3.0.24",
|
|
63
63
|
"@types/react-router-4": "npm:@types/react-router@5.1.14",
|
|
64
64
|
"@types/react-router-5": "npm:@types/react-router@5.1.14",
|
package/types/error.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { EventHint } from '@sentry/types';
|
|
2
|
+
import type { ErrorInfo } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* See if React major version is 17+ by parsing version string.
|
|
5
|
+
*/
|
|
6
|
+
export declare function isAtLeastReact17(reactVersion: string): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Recurse through `error.cause` chain to set cause on an error.
|
|
9
|
+
*/
|
|
10
|
+
export declare function setCause(error: Error & {
|
|
11
|
+
cause?: Error;
|
|
12
|
+
}, cause: Error): void;
|
|
13
|
+
/**
|
|
14
|
+
* Captures an error that was thrown by a React ErrorBoundary or React root.
|
|
15
|
+
*
|
|
16
|
+
* @param error The error to capture.
|
|
17
|
+
* @param errorInfo The errorInfo provided by React.
|
|
18
|
+
* @param hint Optional additional data to attach to the Sentry event.
|
|
19
|
+
* @returns the id of the captured Sentry event.
|
|
20
|
+
*/
|
|
21
|
+
export declare function captureReactException(error: any, { componentStack }: ErrorInfo, hint?: EventHint): string;
|
|
22
|
+
/**
|
|
23
|
+
* Creates an error handler that can be used with the `onCaughtError`, `onUncaughtError`,
|
|
24
|
+
* and `onRecoverableError` options in `createRoot` and `hydrateRoot` React DOM methods.
|
|
25
|
+
*
|
|
26
|
+
* @param callback An optional callback that will be called after the error is captured.
|
|
27
|
+
* Use this to add custom handling for errors.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
*
|
|
31
|
+
* ```JavaScript
|
|
32
|
+
* const root = createRoot(container, {
|
|
33
|
+
* onCaughtError: Sentry.reactErrorHandler(),
|
|
34
|
+
* onUncaughtError: Sentry.reactErrorHandler((error, errorInfo) => {
|
|
35
|
+
* console.warn('Caught error', error, errorInfo.componentStack);
|
|
36
|
+
* });
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function reactErrorHandler(callback?: (error: any, errorInfo: ErrorInfo, eventId: string) => void): (error: any, errorInfo: ErrorInfo) => void;
|
|
41
|
+
//# sourceMappingURL=error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAG9D;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAiB7E;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAEnC,KAAK,EAAE,GAAG,EACV,EAAE,cAAc,EAAE,EAAE,SAAS,EAC7B,IAAI,CAAC,EAAE,SAAS,GACf,MAAM,CAwBR;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,CAE/B,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAErE,CAAC,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,KAAK,IAAI,CAQ5C"}
|
package/types/errorboundary.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { ReportDialogOptions } from '@sentry/browser';
|
|
2
2
|
import type { Scope } from '@sentry/types';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
export declare function isAtLeastReact17(version: string): boolean;
|
|
5
4
|
export declare const UNKNOWN_COMPONENT = "unknown";
|
|
6
5
|
export type FallbackRender = (errorData: {
|
|
7
6
|
error: unknown;
|
|
@@ -28,13 +27,13 @@ export type ErrorBoundaryProps = {
|
|
|
28
27
|
*/
|
|
29
28
|
fallback?: React.ReactElement | FallbackRender | undefined;
|
|
30
29
|
/** Called when the error boundary encounters an error */
|
|
31
|
-
onError?: ((error: unknown, componentStack: string, eventId: string) => void) | undefined;
|
|
30
|
+
onError?: ((error: unknown, componentStack: string | undefined, eventId: string) => void) | undefined;
|
|
32
31
|
/** Called on componentDidMount() */
|
|
33
32
|
onMount?: (() => void) | undefined;
|
|
34
33
|
/** Called if resetError() is called from the fallback render props function */
|
|
35
|
-
onReset?: ((error: unknown, componentStack: string | null, eventId: string | null) => void) | undefined;
|
|
34
|
+
onReset?: ((error: unknown, componentStack: string | null | undefined, eventId: string | null) => void) | undefined;
|
|
36
35
|
/** Called on componentWillUnmount() */
|
|
37
|
-
onUnmount?: ((error: unknown, componentStack: string | null, eventId: string | null) => void) | undefined;
|
|
36
|
+
onUnmount?: ((error: unknown, componentStack: string | null | undefined, eventId: string | null) => void) | undefined;
|
|
38
37
|
/** Called before the error is captured by Sentry, allows for you to add tags or context using the scope */
|
|
39
38
|
beforeCapture?: ((scope: Scope, error: unknown, componentStack: string | undefined) => void) | undefined;
|
|
40
39
|
};
|
|
@@ -58,7 +57,7 @@ declare class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBou
|
|
|
58
57
|
private readonly _openFallbackReportDialog;
|
|
59
58
|
private _lastEventId?;
|
|
60
59
|
constructor(props: ErrorBoundaryProps);
|
|
61
|
-
componentDidCatch(error: unknown,
|
|
60
|
+
componentDidCatch(error: unknown, errorInfo: React.ErrorInfo): void;
|
|
62
61
|
componentDidMount(): void;
|
|
63
62
|
componentWillUnmount(): void;
|
|
64
63
|
resetErrorBoundary: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorboundary.d.ts","sourceRoot":"","sources":["../../src/errorboundary.tsx"],"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,EAAE,MAAM,IAAI,CAOnC;IAEK,MAAM,IAAI,KAAK,CAAC,SAAS;CAkCjC;AAGD,iBAAS,iBAAiB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACtD,gBAAgB,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EACxC,oBAAoB,EAAE,kBAAkB,GACvC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAeb;AAED,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,CAAC"}
|
package/types/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export * from '@sentry/browser';
|
|
2
2
|
export { init } from './sdk';
|
|
3
|
+
export { reactErrorHandler } from './error';
|
|
3
4
|
export { Profiler, withProfiler, useProfiler } from './profiler';
|
|
4
5
|
export type { ErrorBoundaryProps, FallbackRender } from './errorboundary';
|
|
5
6
|
export { ErrorBoundary, withErrorBoundary } from './errorboundary';
|
|
6
7
|
export { createReduxEnhancer } from './redux';
|
|
7
8
|
export { reactRouterV3BrowserTracingIntegration } from './reactrouterv3';
|
|
9
|
+
export { tanstackRouterBrowserTracingIntegration } from './tanstackrouter';
|
|
8
10
|
export { withSentryRouting, reactRouterV4BrowserTracingIntegration, reactRouterV5BrowserTracingIntegration, } from './reactrouter';
|
|
9
11
|
export { reactRouterV6BrowserTracingIntegration, withSentryReactRouterV6Routing, wrapUseRoutes, wrapCreateBrowserRouter, } from './reactrouterv6';
|
|
10
12
|
//# sourceMappingURL=index.d.ts.map
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAEhC,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACjE,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,sCAAsC,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EACL,iBAAiB,EACjB,sCAAsC,EACtC,sCAAsC,GACvC,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,sCAAsC,EACtC,8BAA8B,EAC9B,aAAa,EACb,uBAAuB,GACxB,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAEhC,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACjE,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,sCAAsC,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,uCAAuC,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EACL,iBAAiB,EACjB,sCAAsC,EACtC,sCAAsC,GACvC,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,sCAAsC,EACtC,8BAA8B,EAC9B,aAAa,EACb,uBAAuB,GACxB,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { browserTracingIntegration as originalBrowserTracingIntegration } from '@sentry/browser';
|
|
2
|
+
import type { Integration } from '@sentry/types';
|
|
3
|
+
/**
|
|
4
|
+
* A custom browser tracing integration for TanStack Router.
|
|
5
|
+
*
|
|
6
|
+
* The minimum compatible version of `@tanstack/router` is `1.34.5`.
|
|
7
|
+
*
|
|
8
|
+
* @param router A TanStack Router `Router` instance that should be used for routing instrumentation.
|
|
9
|
+
* @param options Sentry browser tracing configuration.
|
|
10
|
+
*/
|
|
11
|
+
export declare function tanstackRouterBrowserTracingIntegration(router: any, // This is `any` because we don't want any type mismatches if TanStack Router changes their types
|
|
12
|
+
options?: Parameters<typeof originalBrowserTracingIntegration>[0]): Integration;
|
|
13
|
+
//# sourceMappingURL=tanstackrouter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tanstackrouter.d.ts","sourceRoot":"","sources":["../../src/tanstackrouter.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,yBAAyB,IAAI,iCAAiC,EAAE,MAAM,iBAAiB,CAAC;AACjG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD;;;;;;;GAOG;AACH,wBAAgB,uCAAuC,CAErD,MAAM,EAAE,GAAG,EAAE,iGAAiG;AAC9G,OAAO,GAAE,UAAU,CAAC,OAAO,iCAAiC,CAAC,CAAC,CAAC,CAAM,GACpE,WAAW,CAsFb"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface VendoredTanstackRouter {
|
|
2
|
+
history: VendoredTanstackRouterHistory;
|
|
3
|
+
state: VendoredTanstackRouterState;
|
|
4
|
+
matchRoutes: (pathname: string, locationSearch: {}, opts?: {
|
|
5
|
+
preload?: boolean;
|
|
6
|
+
throwOnError?: boolean;
|
|
7
|
+
}) => Array<VendoredTanstackRouterRouteMatch>;
|
|
8
|
+
subscribe(eventType: 'onResolved' | 'onBeforeNavigate', callback: (stateUpdate: {
|
|
9
|
+
toLocation: VendoredTanstackRouterLocation;
|
|
10
|
+
fromLocation: VendoredTanstackRouterLocation;
|
|
11
|
+
}) => void): () => void;
|
|
12
|
+
}
|
|
13
|
+
interface VendoredTanstackRouterLocation {
|
|
14
|
+
pathname: string;
|
|
15
|
+
search: {};
|
|
16
|
+
state: string;
|
|
17
|
+
}
|
|
18
|
+
interface VendoredTanstackRouterHistory {
|
|
19
|
+
subscribe: (cb: () => void) => () => void;
|
|
20
|
+
}
|
|
21
|
+
interface VendoredTanstackRouterState {
|
|
22
|
+
matches: Array<VendoredTanstackRouterRouteMatch>;
|
|
23
|
+
pendingMatches?: Array<VendoredTanstackRouterRouteMatch>;
|
|
24
|
+
}
|
|
25
|
+
export interface VendoredTanstackRouterRouteMatch {
|
|
26
|
+
routeId: string;
|
|
27
|
+
pathname: string;
|
|
28
|
+
params: {
|
|
29
|
+
[key: string]: string;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=tanstackrouter-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tanstackrouter-types.d.ts","sourceRoot":"","sources":["../../../src/vendor/tanstackrouter-types.ts"],"names":[],"mappings":"AA4BA,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,6BAA6B,CAAC;IACvC,KAAK,EAAE,2BAA2B,CAAC;IACnC,WAAW,EAAE,CACX,QAAQ,EAAE,MAAM,EAEhB,cAAc,EAAE,EAAE,EAClB,IAAI,CAAC,EAAE;QACL,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,YAAY,CAAC,EAAE,OAAO,CAAC;KACxB,KACE,KAAK,CAAC,gCAAgC,CAAC,CAAC;IAC7C,SAAS,CACP,SAAS,EAAE,YAAY,GAAG,kBAAkB,EAC5C,QAAQ,EAAE,CAAC,WAAW,EAAE;QACtB,UAAU,EAAE,8BAA8B,CAAC;QAC3C,YAAY,EAAE,8BAA8B,CAAC;KAC9C,KAAK,IAAI,GACT,MAAM,IAAI,CAAC;CACf;AAED,UAAU,8BAA8B;IACtC,QAAQ,EAAE,MAAM,CAAC;IAEjB,MAAM,EAAE,EAAE,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,6BAA6B;IACrC,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAC;CAC3C;AAED,UAAU,2BAA2B;IACnC,OAAO,EAAE,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACjD,cAAc,CAAC,EAAE,KAAK,CAAC,gCAAgC,CAAC,CAAC;CAC1D;AAED,MAAM,WAAW,gCAAgC;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CACnC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { EventHint } from '@sentry/types';
|
|
2
|
+
import { ErrorInfo } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* See if React major version is 17+ by parsing version string.
|
|
5
|
+
*/
|
|
6
|
+
export declare function isAtLeastReact17(reactVersion: string): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Recurse through `error.cause` chain to set cause on an error.
|
|
9
|
+
*/
|
|
10
|
+
export declare function setCause(error: Error & {
|
|
11
|
+
cause?: Error;
|
|
12
|
+
}, cause: Error): void;
|
|
13
|
+
/**
|
|
14
|
+
* Captures an error that was thrown by a React ErrorBoundary or React root.
|
|
15
|
+
*
|
|
16
|
+
* @param error The error to capture.
|
|
17
|
+
* @param errorInfo The errorInfo provided by React.
|
|
18
|
+
* @param hint Optional additional data to attach to the Sentry event.
|
|
19
|
+
* @returns the id of the captured Sentry event.
|
|
20
|
+
*/
|
|
21
|
+
export declare function captureReactException(error: any, { componentStack }: ErrorInfo, hint?: EventHint): string;
|
|
22
|
+
/**
|
|
23
|
+
* Creates an error handler that can be used with the `onCaughtError`, `onUncaughtError`,
|
|
24
|
+
* and `onRecoverableError` options in `createRoot` and `hydrateRoot` React DOM methods.
|
|
25
|
+
*
|
|
26
|
+
* @param callback An optional callback that will be called after the error is captured.
|
|
27
|
+
* Use this to add custom handling for errors.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
*
|
|
31
|
+
* ```JavaScript
|
|
32
|
+
* const root = createRoot(container, {
|
|
33
|
+
* onCaughtError: Sentry.reactErrorHandler(),
|
|
34
|
+
* onUncaughtError: Sentry.reactErrorHandler((error, errorInfo) => {
|
|
35
|
+
* console.warn('Caught error', error, errorInfo.componentStack);
|
|
36
|
+
* });
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function reactErrorHandler(callback?: (error: any, errorInfo: ErrorInfo, eventId: string) => void): (error: any, errorInfo: ErrorInfo) => void;
|
|
41
|
+
//# sourceMappingURL=error.d.ts.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ReportDialogOptions } from '@sentry/browser';
|
|
2
2
|
import { Scope } from '@sentry/types';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
export declare function isAtLeastReact17(version: string): boolean;
|
|
5
4
|
export declare const UNKNOWN_COMPONENT = "unknown";
|
|
6
5
|
export type FallbackRender = (errorData: {
|
|
7
6
|
error: unknown;
|
|
@@ -28,13 +27,13 @@ export type ErrorBoundaryProps = {
|
|
|
28
27
|
*/
|
|
29
28
|
fallback?: React.ReactElement | FallbackRender | undefined;
|
|
30
29
|
/** Called when the error boundary encounters an error */
|
|
31
|
-
onError?: ((error: unknown, componentStack: string, eventId: string) => void) | undefined;
|
|
30
|
+
onError?: ((error: unknown, componentStack: string | undefined, eventId: string) => void) | undefined;
|
|
32
31
|
/** Called on componentDidMount() */
|
|
33
32
|
onMount?: (() => void) | undefined;
|
|
34
33
|
/** Called if resetError() is called from the fallback render props function */
|
|
35
|
-
onReset?: ((error: unknown, componentStack: string | null, eventId: string | null) => void) | undefined;
|
|
34
|
+
onReset?: ((error: unknown, componentStack: string | null | undefined, eventId: string | null) => void) | undefined;
|
|
36
35
|
/** Called on componentWillUnmount() */
|
|
37
|
-
onUnmount?: ((error: unknown, componentStack: string | null, eventId: string | null) => void) | undefined;
|
|
36
|
+
onUnmount?: ((error: unknown, componentStack: string | null | undefined, eventId: string | null) => void) | undefined;
|
|
38
37
|
/** Called before the error is captured by Sentry, allows for you to add tags or context using the scope */
|
|
39
38
|
beforeCapture?: ((scope: Scope, error: unknown, componentStack: string | undefined) => void) | undefined;
|
|
40
39
|
};
|
|
@@ -58,7 +57,7 @@ declare class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBou
|
|
|
58
57
|
private readonly _openFallbackReportDialog;
|
|
59
58
|
private _lastEventId?;
|
|
60
59
|
constructor(props: ErrorBoundaryProps);
|
|
61
|
-
componentDidCatch(error: unknown,
|
|
60
|
+
componentDidCatch(error: unknown, errorInfo: React.ErrorInfo): void;
|
|
62
61
|
componentDidMount(): void;
|
|
63
62
|
componentWillUnmount(): void;
|
|
64
63
|
resetErrorBoundary: () => void;
|
package/types-ts3.8/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export * from '@sentry/browser';
|
|
2
2
|
export { init } from './sdk';
|
|
3
|
+
export { reactErrorHandler } from './error';
|
|
3
4
|
export { Profiler, withProfiler, useProfiler } from './profiler';
|
|
4
5
|
export { ErrorBoundaryProps, FallbackRender } from './errorboundary';
|
|
5
6
|
export { ErrorBoundary, withErrorBoundary } from './errorboundary';
|
|
6
7
|
export { createReduxEnhancer } from './redux';
|
|
7
8
|
export { reactRouterV3BrowserTracingIntegration } from './reactrouterv3';
|
|
9
|
+
export { tanstackRouterBrowserTracingIntegration } from './tanstackrouter';
|
|
8
10
|
export { withSentryRouting, reactRouterV4BrowserTracingIntegration, reactRouterV5BrowserTracingIntegration, } from './reactrouter';
|
|
9
11
|
export { reactRouterV6BrowserTracingIntegration, withSentryReactRouterV6Routing, wrapUseRoutes, wrapCreateBrowserRouter, } from './reactrouterv6';
|
|
10
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { browserTracingIntegration as originalBrowserTracingIntegration } from '@sentry/browser';
|
|
2
|
+
import { Integration } from '@sentry/types';
|
|
3
|
+
/**
|
|
4
|
+
* A custom browser tracing integration for TanStack Router.
|
|
5
|
+
*
|
|
6
|
+
* The minimum compatible version of `@tanstack/router` is `1.34.5`.
|
|
7
|
+
*
|
|
8
|
+
* @param router A TanStack Router `Router` instance that should be used for routing instrumentation.
|
|
9
|
+
* @param options Sentry browser tracing configuration.
|
|
10
|
+
*/
|
|
11
|
+
export declare function tanstackRouterBrowserTracingIntegration(router: any, // This is `any` because we don't want any type mismatches if TanStack Router changes their types
|
|
12
|
+
options?: Parameters<typeof originalBrowserTracingIntegration>[0]): Integration;
|
|
13
|
+
//# sourceMappingURL=tanstackrouter.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface VendoredTanstackRouter {
|
|
2
|
+
history: VendoredTanstackRouterHistory;
|
|
3
|
+
state: VendoredTanstackRouterState;
|
|
4
|
+
matchRoutes: (pathname: string, locationSearch: {}, opts?: {
|
|
5
|
+
preload?: boolean;
|
|
6
|
+
throwOnError?: boolean;
|
|
7
|
+
}) => Array<VendoredTanstackRouterRouteMatch>;
|
|
8
|
+
subscribe(eventType: 'onResolved' | 'onBeforeNavigate', callback: (stateUpdate: {
|
|
9
|
+
toLocation: VendoredTanstackRouterLocation;
|
|
10
|
+
fromLocation: VendoredTanstackRouterLocation;
|
|
11
|
+
}) => void): () => void;
|
|
12
|
+
}
|
|
13
|
+
interface VendoredTanstackRouterLocation {
|
|
14
|
+
pathname: string;
|
|
15
|
+
search: {};
|
|
16
|
+
state: string;
|
|
17
|
+
}
|
|
18
|
+
interface VendoredTanstackRouterHistory {
|
|
19
|
+
subscribe: (cb: () => void) => () => void;
|
|
20
|
+
}
|
|
21
|
+
interface VendoredTanstackRouterState {
|
|
22
|
+
matches: Array<VendoredTanstackRouterRouteMatch>;
|
|
23
|
+
pendingMatches?: Array<VendoredTanstackRouterRouteMatch>;
|
|
24
|
+
}
|
|
25
|
+
export interface VendoredTanstackRouterRouteMatch {
|
|
26
|
+
routeId: string;
|
|
27
|
+
pathname: string;
|
|
28
|
+
params: {
|
|
29
|
+
[key: string]: string;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=tanstackrouter-types.d.ts.map
|