@sentry/react 10.32.0 → 10.33.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/build/cjs/hoist-non-react-statics.js +153 -4
- package/build/cjs/hoist-non-react-statics.js.map +1 -1
- package/build/cjs/tanstackrouter.js +19 -12
- package/build/cjs/tanstackrouter.js.map +1 -1
- package/build/esm/hoist-non-react-statics.js +153 -4
- package/build/esm/hoist-non-react-statics.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/tanstackrouter.js +19 -12
- package/build/esm/tanstackrouter.js.map +1 -1
- package/build/types/hoist-non-react-statics.d.ts +20 -1
- package/build/types/hoist-non-react-statics.d.ts.map +1 -1
- package/build/types/tanstackrouter.d.ts.map +1 -1
- package/build/types-ts3.8/hoist-non-react-statics.d.ts +20 -1
- package/package.json +4 -5
|
@@ -1,10 +1,159 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* React statics that should not be hoisted
|
|
5
|
+
*/
|
|
6
|
+
const REACT_STATICS = {
|
|
7
|
+
childContextTypes: true,
|
|
8
|
+
contextType: true,
|
|
9
|
+
contextTypes: true,
|
|
10
|
+
defaultProps: true,
|
|
11
|
+
displayName: true,
|
|
12
|
+
getDefaultProps: true,
|
|
13
|
+
getDerivedStateFromError: true,
|
|
14
|
+
getDerivedStateFromProps: true,
|
|
15
|
+
mixins: true,
|
|
16
|
+
propTypes: true,
|
|
17
|
+
type: true,
|
|
18
|
+
} ;
|
|
4
19
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Known JavaScript function statics that should not be hoisted
|
|
22
|
+
*/
|
|
23
|
+
const KNOWN_STATICS = {
|
|
24
|
+
name: true,
|
|
25
|
+
length: true,
|
|
26
|
+
prototype: true,
|
|
27
|
+
caller: true,
|
|
28
|
+
callee: true,
|
|
29
|
+
arguments: true,
|
|
30
|
+
arity: true,
|
|
31
|
+
} ;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Statics specific to ForwardRef components
|
|
35
|
+
*/
|
|
36
|
+
const FORWARD_REF_STATICS = {
|
|
37
|
+
$$typeof: true,
|
|
38
|
+
render: true,
|
|
39
|
+
defaultProps: true,
|
|
40
|
+
displayName: true,
|
|
41
|
+
propTypes: true,
|
|
42
|
+
} ;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Statics specific to Memo components
|
|
46
|
+
*/
|
|
47
|
+
const MEMO_STATICS = {
|
|
48
|
+
$$typeof: true,
|
|
49
|
+
compare: true,
|
|
50
|
+
defaultProps: true,
|
|
51
|
+
displayName: true,
|
|
52
|
+
propTypes: true,
|
|
53
|
+
type: true,
|
|
54
|
+
} ;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Inlined react-is utilities
|
|
58
|
+
* We only need to detect ForwardRef and Memo types
|
|
59
|
+
*/
|
|
60
|
+
const ForwardRefType = Symbol.for('react.forward_ref');
|
|
61
|
+
const MemoType = Symbol.for('react.memo');
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Check if a component is a Memo component
|
|
65
|
+
*/
|
|
66
|
+
function isMemo(component) {
|
|
67
|
+
return (
|
|
68
|
+
typeof component === 'object' && component !== null && (component ).$$typeof === MemoType
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Map of React component types to their specific statics
|
|
74
|
+
*/
|
|
75
|
+
const TYPE_STATICS = {};
|
|
76
|
+
TYPE_STATICS[ForwardRefType] = FORWARD_REF_STATICS;
|
|
77
|
+
TYPE_STATICS[MemoType] = MEMO_STATICS;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Get the appropriate statics object for a given component
|
|
81
|
+
*/
|
|
82
|
+
function getStatics(component) {
|
|
83
|
+
// React v16.11 and below
|
|
84
|
+
if (isMemo(component)) {
|
|
85
|
+
return MEMO_STATICS;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// React v16.12 and above
|
|
89
|
+
const componentType = (component ).$$typeof;
|
|
90
|
+
return (componentType && TYPE_STATICS[componentType]) || REACT_STATICS;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const defineProperty = Object.defineProperty.bind(Object);
|
|
94
|
+
const getOwnPropertyNames = Object.getOwnPropertyNames.bind(Object);
|
|
95
|
+
const getOwnPropertySymbols = Object.getOwnPropertySymbols?.bind(Object);
|
|
96
|
+
const getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor.bind(Object);
|
|
97
|
+
const getPrototypeOf = Object.getPrototypeOf.bind(Object);
|
|
98
|
+
const objectPrototype = Object.prototype;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Copies non-react specific statics from a child component to a parent component.
|
|
102
|
+
* Similar to Object.assign, but copies all static properties from source to target,
|
|
103
|
+
* excluding React-specific statics and known JavaScript statics.
|
|
104
|
+
*
|
|
105
|
+
* @param targetComponent - The component to copy statics to
|
|
106
|
+
* @param sourceComponent - The component to copy statics from
|
|
107
|
+
* @param excludelist - An optional object of keys to exclude from hoisting
|
|
108
|
+
* @returns The target component with hoisted statics
|
|
109
|
+
*/
|
|
110
|
+
function hoistNonReactStatics
|
|
111
|
+
|
|
112
|
+
(targetComponent, sourceComponent, excludelist) {
|
|
113
|
+
if (typeof sourceComponent !== 'string') {
|
|
114
|
+
// Don't hoist over string (html) components
|
|
115
|
+
if (objectPrototype) {
|
|
116
|
+
const inheritedComponent = getPrototypeOf(sourceComponent);
|
|
117
|
+
|
|
118
|
+
if (inheritedComponent && inheritedComponent !== objectPrototype) {
|
|
119
|
+
hoistNonReactStatics(targetComponent, inheritedComponent);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
let keys = getOwnPropertyNames(sourceComponent);
|
|
124
|
+
|
|
125
|
+
if (getOwnPropertySymbols) {
|
|
126
|
+
keys = keys.concat(getOwnPropertySymbols(sourceComponent));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const targetStatics = getStatics(targetComponent);
|
|
130
|
+
const sourceStatics = getStatics(sourceComponent);
|
|
131
|
+
|
|
132
|
+
for (const key of keys) {
|
|
133
|
+
const keyStr = String(key);
|
|
134
|
+
if (
|
|
135
|
+
!KNOWN_STATICS[keyStr ] &&
|
|
136
|
+
true &&
|
|
137
|
+
!sourceStatics?.[keyStr] &&
|
|
138
|
+
!targetStatics?.[keyStr] &&
|
|
139
|
+
!getOwnPropertyDescriptor(targetComponent, key) // Don't overwrite existing properties
|
|
140
|
+
) {
|
|
141
|
+
const descriptor = getOwnPropertyDescriptor(sourceComponent, key);
|
|
142
|
+
|
|
143
|
+
if (descriptor) {
|
|
144
|
+
try {
|
|
145
|
+
// Avoid failures from read-only properties
|
|
146
|
+
defineProperty(targetComponent, key, descriptor);
|
|
147
|
+
} catch (e) {
|
|
148
|
+
// Silently ignore errors
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return targetComponent;
|
|
156
|
+
}
|
|
8
157
|
|
|
9
158
|
exports.hoistNonReactStatics = hoistNonReactStatics;
|
|
10
159
|
//# sourceMappingURL=hoist-non-react-statics.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hoist-non-react-statics.js","sources":["../../src/hoist-non-react-statics.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"hoist-non-react-statics.js","sources":["../../src/hoist-non-react-statics.ts"],"sourcesContent":["/**\n * Inlined implementation of hoist-non-react-statics\n * Original library: https://github.com/mridgway/hoist-non-react-statics\n * License: BSD-3-Clause\n * Copyright 2015, Yahoo! Inc.\n *\n * This is an inlined version to avoid ESM compatibility issues with the original package.\n */\n\nimport type * as React from 'react';\n\n/**\n * React statics that should not be hoisted\n */\nconst REACT_STATICS = {\n childContextTypes: true,\n contextType: true,\n contextTypes: true,\n defaultProps: true,\n displayName: true,\n getDefaultProps: true,\n getDerivedStateFromError: true,\n getDerivedStateFromProps: true,\n mixins: true,\n propTypes: true,\n type: true,\n} as const;\n\n/**\n * Known JavaScript function statics that should not be hoisted\n */\nconst KNOWN_STATICS = {\n name: true,\n length: true,\n prototype: true,\n caller: true,\n callee: true,\n arguments: true,\n arity: true,\n} as const;\n\n/**\n * Statics specific to ForwardRef components\n */\nconst FORWARD_REF_STATICS = {\n $$typeof: true,\n render: true,\n defaultProps: true,\n displayName: true,\n propTypes: true,\n} as const;\n\n/**\n * Statics specific to Memo components\n */\nconst MEMO_STATICS = {\n $$typeof: true,\n compare: true,\n defaultProps: true,\n displayName: true,\n propTypes: true,\n type: true,\n} as const;\n\n/**\n * Inlined react-is utilities\n * We only need to detect ForwardRef and Memo types\n */\nconst ForwardRefType = Symbol.for('react.forward_ref');\nconst MemoType = Symbol.for('react.memo');\n\n/**\n * Check if a component is a Memo component\n */\nfunction isMemo(component: unknown): boolean {\n return (\n typeof component === 'object' && component !== null && (component as { $$typeof?: symbol }).$$typeof === MemoType\n );\n}\n\n/**\n * Map of React component types to their specific statics\n */\nconst TYPE_STATICS: Record<symbol, Record<string, boolean>> = {};\nTYPE_STATICS[ForwardRefType] = FORWARD_REF_STATICS;\nTYPE_STATICS[MemoType] = MEMO_STATICS;\n\n/**\n * Get the appropriate statics object for a given component\n */\nfunction getStatics(component: React.ComponentType<unknown>): Record<string, boolean> {\n // React v16.11 and below\n if (isMemo(component)) {\n return MEMO_STATICS;\n }\n\n // React v16.12 and above\n const componentType = (component as { $$typeof?: symbol }).$$typeof;\n return (componentType && TYPE_STATICS[componentType]) || REACT_STATICS;\n}\n\nconst defineProperty = Object.defineProperty.bind(Object);\nconst getOwnPropertyNames = Object.getOwnPropertyNames.bind(Object);\nconst getOwnPropertySymbols = Object.getOwnPropertySymbols?.bind(Object);\nconst getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor.bind(Object);\nconst getPrototypeOf = Object.getPrototypeOf.bind(Object);\nconst objectPrototype = Object.prototype;\n\n/**\n * Copies non-react specific statics from a child component to a parent component.\n * Similar to Object.assign, but copies all static properties from source to target,\n * excluding React-specific statics and known JavaScript statics.\n *\n * @param targetComponent - The component to copy statics to\n * @param sourceComponent - The component to copy statics from\n * @param excludelist - An optional object of keys to exclude from hoisting\n * @returns The target component with hoisted statics\n */\nexport function hoistNonReactStatics<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n T extends React.ComponentType<any>,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n S extends React.ComponentType<any>,\n C extends Record<string, boolean> = Record<string, never>,\n>(targetComponent: T, sourceComponent: S, excludelist?: C): T {\n if (typeof sourceComponent !== 'string') {\n // Don't hoist over string (html) components\n if (objectPrototype) {\n const inheritedComponent = getPrototypeOf(sourceComponent);\n\n if (inheritedComponent && inheritedComponent !== objectPrototype) {\n hoistNonReactStatics(targetComponent, inheritedComponent, excludelist);\n }\n }\n\n let keys: (string | symbol)[] = getOwnPropertyNames(sourceComponent);\n\n if (getOwnPropertySymbols) {\n keys = keys.concat(getOwnPropertySymbols(sourceComponent));\n }\n\n const targetStatics = getStatics(targetComponent);\n const sourceStatics = getStatics(sourceComponent);\n\n for (const key of keys) {\n const keyStr = String(key);\n if (\n !KNOWN_STATICS[keyStr as keyof typeof KNOWN_STATICS] &&\n !excludelist?.[keyStr] &&\n !sourceStatics?.[keyStr] &&\n !targetStatics?.[keyStr] &&\n !getOwnPropertyDescriptor(targetComponent, key) // Don't overwrite existing properties\n ) {\n const descriptor = getOwnPropertyDescriptor(sourceComponent, key);\n\n if (descriptor) {\n try {\n // Avoid failures from read-only properties\n defineProperty(targetComponent, key, descriptor);\n } catch (e) {\n // Silently ignore errors\n }\n }\n }\n }\n }\n\n return targetComponent;\n}\n"],"names":[],"mappings":";;AAWA;AACA;AACA;AACA,MAAM,gBAAgB;AACtB,EAAE,iBAAiB,EAAE,IAAI;AACzB,EA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,oBAAoB,CAAC,eAAe,EAAE,kBAA+B,CAAC;AAC9E,MAAM;AACN,IAAI;;AAEJ,IAAI,IAAI,IAAI,GAAwB,mBAAmB,CAAC,eAAe,CAAC;;AAExE,IAAI,IAAI,qBAAqB,EAAE;AAC/B,MAAM,IAAA,GAAO,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,eAAe,CAAC,CAAC;AAChE,IAAI;;AAEJ,IAAI,MAAM,aAAA,GAAgB,UAAU,CAAC,eAAe,CAAC;AACrD,IAAI,MAAM,aAAA,GAAgB,UAAU,CAAC,eAAe,CAAC;;AAErD,IAAI,KAAK,MAAM,GAAA,IAAO,IAAI,EAAE;AAC5B,MAAM,MAAM,MAAA,GAAS,MAAM,CAAC,GAAG,CAAC;AAChC,MAAM;AACN,QAAQ,CAAC,aAAa,CAAC,MAAA,EAAO;AAC9B,QAAQ,IAAqB;AAC7B,QAAQ,CAAC,aAAa,GAAG,MAAM,CAAA;AAC/B,QAAQ,CAAC,aAAa,GAAG,MAAM,CAAA;AAC/B,QAAQ,CAAC,wBAAwB,CAAC,eAAe,EAAE,GAAG,CAAA;AACtD,QAAQ;AACR,QAAQ,MAAM,aAAa,wBAAwB,CAAC,eAAe,EAAE,GAAG,CAAC;;AAEzE,QAAQ,IAAI,UAAU,EAAE;AACxB,UAAU,IAAI;AACd;AACA,YAAY,cAAc,CAAC,eAAe,EAAE,GAAG,EAAE,UAAU,CAAC;AAC5D,UAAU,CAAA,CAAE,OAAO,CAAC,EAAE;AACtB;AACA,UAAU;AACV,QAAQ;AACR,MAAM;AACN,IAAI;AACJ,EAAE;;AAEF,EAAE,OAAO,eAAe;AACxB;;;;"}
|
|
@@ -40,14 +40,17 @@ function tanstackRouterBrowserTracingIntegration(
|
|
|
40
40
|
);
|
|
41
41
|
|
|
42
42
|
const lastMatch = matchedRoutes[matchedRoutes.length - 1];
|
|
43
|
+
// If we only match __root__, we ended up not matching any route at all, so
|
|
44
|
+
// we fall back to the pathname.
|
|
45
|
+
const routeMatch = lastMatch?.routeId !== '__root__' ? lastMatch : undefined;
|
|
43
46
|
|
|
44
47
|
browser.startBrowserTracingPageLoadSpan(client, {
|
|
45
|
-
name:
|
|
48
|
+
name: routeMatch ? routeMatch.routeId : initialWindowLocation.pathname,
|
|
46
49
|
attributes: {
|
|
47
50
|
[core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload',
|
|
48
51
|
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.tanstack_router',
|
|
49
|
-
[core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]:
|
|
50
|
-
...routeMatchToParamSpanAttributes(
|
|
52
|
+
[core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: routeMatch ? 'route' : 'url',
|
|
53
|
+
...routeMatchToParamSpanAttributes(routeMatch),
|
|
51
54
|
},
|
|
52
55
|
});
|
|
53
56
|
}
|
|
@@ -65,21 +68,23 @@ function tanstackRouterBrowserTracingIntegration(
|
|
|
65
68
|
return;
|
|
66
69
|
}
|
|
67
70
|
|
|
68
|
-
const
|
|
71
|
+
const matchedRoutesOnBeforeNavigate = castRouterInstance.matchRoutes(
|
|
69
72
|
onBeforeNavigateArgs.toLocation.pathname,
|
|
70
73
|
onBeforeNavigateArgs.toLocation.search,
|
|
71
74
|
{ preload: false, throwOnError: false },
|
|
72
75
|
);
|
|
73
76
|
|
|
74
|
-
const onBeforeNavigateLastMatch =
|
|
77
|
+
const onBeforeNavigateLastMatch = matchedRoutesOnBeforeNavigate[matchedRoutesOnBeforeNavigate.length - 1];
|
|
78
|
+
const onBeforeNavigateRouteMatch =
|
|
79
|
+
onBeforeNavigateLastMatch?.routeId !== '__root__' ? onBeforeNavigateLastMatch : undefined;
|
|
75
80
|
|
|
76
81
|
const navigationLocation = browser.WINDOW.location;
|
|
77
82
|
const navigationSpan = browser.startBrowserTracingNavigationSpan(client, {
|
|
78
|
-
name:
|
|
83
|
+
name: onBeforeNavigateRouteMatch ? onBeforeNavigateRouteMatch.routeId : navigationLocation.pathname,
|
|
79
84
|
attributes: {
|
|
80
85
|
[core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',
|
|
81
86
|
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.tanstack_router',
|
|
82
|
-
[core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]:
|
|
87
|
+
[core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: onBeforeNavigateRouteMatch ? 'route' : 'url',
|
|
83
88
|
},
|
|
84
89
|
});
|
|
85
90
|
|
|
@@ -87,18 +92,20 @@ function tanstackRouterBrowserTracingIntegration(
|
|
|
87
92
|
const unsubscribeOnResolved = castRouterInstance.subscribe('onResolved', onResolvedArgs => {
|
|
88
93
|
unsubscribeOnResolved();
|
|
89
94
|
if (navigationSpan) {
|
|
90
|
-
const
|
|
95
|
+
const matchedRoutesOnResolved = castRouterInstance.matchRoutes(
|
|
91
96
|
onResolvedArgs.toLocation.pathname,
|
|
92
97
|
onResolvedArgs.toLocation.search,
|
|
93
98
|
{ preload: false, throwOnError: false },
|
|
94
99
|
);
|
|
95
100
|
|
|
96
|
-
const onResolvedLastMatch =
|
|
101
|
+
const onResolvedLastMatch = matchedRoutesOnResolved[matchedRoutesOnResolved.length - 1];
|
|
102
|
+
const onResolvedRouteMatch =
|
|
103
|
+
onResolvedLastMatch?.routeId !== '__root__' ? onResolvedLastMatch : undefined;
|
|
97
104
|
|
|
98
|
-
if (
|
|
99
|
-
navigationSpan.updateName(
|
|
105
|
+
if (onResolvedRouteMatch) {
|
|
106
|
+
navigationSpan.updateName(onResolvedRouteMatch.routeId);
|
|
100
107
|
navigationSpan.setAttribute(core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route');
|
|
101
|
-
navigationSpan.setAttributes(routeMatchToParamSpanAttributes(
|
|
108
|
+
navigationSpan.setAttributes(routeMatchToParamSpanAttributes(onResolvedRouteMatch));
|
|
102
109
|
}
|
|
103
110
|
}
|
|
104
111
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tanstackrouter.js","sources":["../../src/tanstackrouter.ts"],"sourcesContent":["import {\n browserTracingIntegration as originalBrowserTracingIntegration,\n startBrowserTracingNavigationSpan,\n startBrowserTracingPageLoadSpan,\n WINDOW,\n} from '@sentry/browser';\nimport type { Integration } from '@sentry/core';\nimport {\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n} from '@sentry/core';\nimport type { VendoredTanstackRouter, VendoredTanstackRouterRouteMatch } from './vendor/tanstackrouter-types';\n\n/**\n * A custom browser tracing integration for TanStack Router.\n *\n * The minimum compatible version of `@tanstack/react-router` is `1.64.0`.\n *\n * @param router A TanStack Router `Router` instance that should be used for routing instrumentation.\n * @param options Sentry browser tracing configuration.\n */\nexport function tanstackRouterBrowserTracingIntegration(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n router: any, // This is `any` because we don't want any type mismatches if TanStack Router changes their types\n options: Parameters<typeof originalBrowserTracingIntegration>[0] = {},\n): Integration {\n const castRouterInstance: VendoredTanstackRouter = router;\n\n const browserTracingIntegrationInstance = originalBrowserTracingIntegration({\n ...options,\n instrumentNavigation: false,\n instrumentPageLoad: false,\n });\n\n const { instrumentPageLoad = true, instrumentNavigation = true } = options;\n\n return {\n ...browserTracingIntegrationInstance,\n afterAllSetup(client) {\n browserTracingIntegrationInstance.afterAllSetup(client);\n\n const initialWindowLocation = WINDOW.location;\n if (instrumentPageLoad && initialWindowLocation) {\n const matchedRoutes = castRouterInstance.matchRoutes(\n initialWindowLocation.pathname,\n castRouterInstance.options.parseSearch(initialWindowLocation.search),\n { preload: false, throwOnError: false },\n );\n\n const lastMatch = matchedRoutes[matchedRoutes.length - 1];\n\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:\n // 1. Checking if there's no fromLocation (initial pageload)\n // 2. Comparing the states of the to and from arguments\n if (\n !onBeforeNavigateArgs.fromLocation ||\n onBeforeNavigateArgs.toLocation.state === onBeforeNavigateArgs.fromLocation.state\n ) {\n return;\n }\n\n const 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 Object.entries(match.params).forEach(([key, value]) => {\n paramAttributes[`url.path.params.${key}`] = value; // TODO(v11): remove attribute which does not adhere to Sentry's semantic convention\n paramAttributes[`url.path.parameter.${key}`] = value;\n paramAttributes[`params.${key}`] = value; // params.[key] is an alias\n });\n\n return paramAttributes;\n}\n"],"names":["originalBrowserTracingIntegration","WINDOW","startBrowserTracingPageLoadSpan","SEMANTIC_ATTRIBUTE_SENTRY_OP","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","startBrowserTracingNavigationSpan"],"mappings":";;;;;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,uCAAuC;AACvD;AACA,EAAE,MAAM;AACR,EAAE,OAAO,GAA4D,EAAE;AACvE,EAAe;AACf,EAAE,MAAM,kBAAkB,GAA2B,MAAM;;AAE3D,EAAE,MAAM,iCAAA,GAAoCA,iCAAiC,CAAC;AAC9E,IAAI,GAAG,OAAO;AACd,IAAI,oBAAoB,EAAE,KAAK;AAC/B,IAAI,kBAAkB,EAAE,KAAK;AAC7B,GAAG,CAAC;;AAEJ,EAAE,MAAM,EAAE,kBAAA,GAAqB,IAAI,EAAE,oBAAA,GAAuB,IAAA,EAAK,GAAI,OAAO;;AAE5E,EAAE,OAAO;AACT,IAAI,GAAG,iCAAiC;A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AC;AACtF,gBAAgB,cAAc,CAAC,aAAa,CAAC,+BAA+B,CAAC,mBAAmB,CAAC,CAAC;AAClG,cAAc;AACd,YAAY;AACZ,UAAU,CAAC,CAAC;AACZ,QAAQ,CAAC,CAAC;AACV,MAAM;AACN,IAAI,CAAC;AACL,GAAG;AACH;;AAEA,SAAS,+BAA+B,CAAC,KAAK,EAAwE;AACtH,EAAE,IAAI,CAAC,KAAK,EAAE;AACd,IAAI,OAAO,EAAE;AACb,EAAE;;AAEF,EAAE,MAAM,eAAe,GAA2B,EAAE;AACpD,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK;AACzD,IAAI,eAAe,CAAC,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAA,CAAA,GAAA,KAAA,CAAA;AACA,IAAA,eAAA,CAAA,CAAA,mBAAA,EAAA,GAAA,CAAA,CAAA,CAAA,GAAA,KAAA;AACA,IAAA,eAAA,CAAA,CAAA,OAAA,EAAA,GAAA,CAAA,CAAA,CAAA,GAAA,KAAA,CAAA;AACA,EAAA,CAAA,CAAA;;AAEA,EAAA,OAAA,eAAA;AACA;;;;"}
|
|
1
|
+
{"version":3,"file":"tanstackrouter.js","sources":["../../src/tanstackrouter.ts"],"sourcesContent":["import {\n browserTracingIntegration as originalBrowserTracingIntegration,\n startBrowserTracingNavigationSpan,\n startBrowserTracingPageLoadSpan,\n WINDOW,\n} from '@sentry/browser';\nimport type { Integration } from '@sentry/core';\nimport {\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n} from '@sentry/core';\nimport type { VendoredTanstackRouter, VendoredTanstackRouterRouteMatch } from './vendor/tanstackrouter-types';\n\n/**\n * A custom browser tracing integration for TanStack Router.\n *\n * The minimum compatible version of `@tanstack/react-router` is `1.64.0`.\n *\n * @param router A TanStack Router `Router` instance that should be used for routing instrumentation.\n * @param options Sentry browser tracing configuration.\n */\nexport function tanstackRouterBrowserTracingIntegration(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n router: any, // This is `any` because we don't want any type mismatches if TanStack Router changes their types\n options: Parameters<typeof originalBrowserTracingIntegration>[0] = {},\n): Integration {\n const castRouterInstance: VendoredTanstackRouter = router;\n\n const browserTracingIntegrationInstance = originalBrowserTracingIntegration({\n ...options,\n instrumentNavigation: false,\n instrumentPageLoad: false,\n });\n\n const { instrumentPageLoad = true, instrumentNavigation = true } = options;\n\n return {\n ...browserTracingIntegrationInstance,\n afterAllSetup(client) {\n browserTracingIntegrationInstance.afterAllSetup(client);\n\n const initialWindowLocation = WINDOW.location;\n if (instrumentPageLoad && initialWindowLocation) {\n const matchedRoutes = castRouterInstance.matchRoutes(\n initialWindowLocation.pathname,\n castRouterInstance.options.parseSearch(initialWindowLocation.search),\n { preload: false, throwOnError: false },\n );\n\n const lastMatch = matchedRoutes[matchedRoutes.length - 1];\n // If we only match __root__, we ended up not matching any route at all, so\n // we fall back to the pathname.\n const routeMatch = lastMatch?.routeId !== '__root__' ? lastMatch : undefined;\n\n startBrowserTracingPageLoadSpan(client, {\n name: routeMatch ? routeMatch.routeId : initialWindowLocation.pathname,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.tanstack_router',\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: routeMatch ? 'route' : 'url',\n ...routeMatchToParamSpanAttributes(routeMatch),\n },\n });\n }\n\n if (instrumentNavigation) {\n // The onBeforeNavigate hook is called at the very beginning of a navigation and is only called once per navigation, even when the user is redirected\n castRouterInstance.subscribe('onBeforeNavigate', onBeforeNavigateArgs => {\n // onBeforeNavigate is called during pageloads. We can avoid creating navigation spans by:\n // 1. Checking if there's no fromLocation (initial pageload)\n // 2. Comparing the states of the to and from arguments\n if (\n !onBeforeNavigateArgs.fromLocation ||\n onBeforeNavigateArgs.toLocation.state === onBeforeNavigateArgs.fromLocation.state\n ) {\n return;\n }\n\n const matchedRoutesOnBeforeNavigate = castRouterInstance.matchRoutes(\n onBeforeNavigateArgs.toLocation.pathname,\n onBeforeNavigateArgs.toLocation.search,\n { preload: false, throwOnError: false },\n );\n\n const onBeforeNavigateLastMatch = matchedRoutesOnBeforeNavigate[matchedRoutesOnBeforeNavigate.length - 1];\n const onBeforeNavigateRouteMatch =\n onBeforeNavigateLastMatch?.routeId !== '__root__' ? onBeforeNavigateLastMatch : undefined;\n\n const navigationLocation = WINDOW.location;\n const navigationSpan = startBrowserTracingNavigationSpan(client, {\n name: onBeforeNavigateRouteMatch ? onBeforeNavigateRouteMatch.routeId : navigationLocation.pathname,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.tanstack_router',\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: onBeforeNavigateRouteMatch ? 'route' : 'url',\n },\n });\n\n // In case the user is redirected during navigation we want to update the span with the right value.\n const unsubscribeOnResolved = castRouterInstance.subscribe('onResolved', onResolvedArgs => {\n unsubscribeOnResolved();\n if (navigationSpan) {\n const matchedRoutesOnResolved = castRouterInstance.matchRoutes(\n onResolvedArgs.toLocation.pathname,\n onResolvedArgs.toLocation.search,\n { preload: false, throwOnError: false },\n );\n\n const onResolvedLastMatch = matchedRoutesOnResolved[matchedRoutesOnResolved.length - 1];\n const onResolvedRouteMatch =\n onResolvedLastMatch?.routeId !== '__root__' ? onResolvedLastMatch : undefined;\n\n if (onResolvedRouteMatch) {\n navigationSpan.updateName(onResolvedRouteMatch.routeId);\n navigationSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route');\n navigationSpan.setAttributes(routeMatchToParamSpanAttributes(onResolvedRouteMatch));\n }\n }\n });\n });\n }\n },\n };\n}\n\nfunction routeMatchToParamSpanAttributes(match: VendoredTanstackRouterRouteMatch | undefined): Record<string, string> {\n if (!match) {\n return {};\n }\n\n const paramAttributes: Record<string, string> = {};\n Object.entries(match.params).forEach(([key, value]) => {\n paramAttributes[`url.path.params.${key}`] = value; // TODO(v11): remove attribute which does not adhere to Sentry's semantic convention\n paramAttributes[`url.path.parameter.${key}`] = value;\n paramAttributes[`params.${key}`] = value; // params.[key] is an alias\n });\n\n return paramAttributes;\n}\n"],"names":["originalBrowserTracingIntegration","WINDOW","startBrowserTracingPageLoadSpan","SEMANTIC_ATTRIBUTE_SENTRY_OP","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","startBrowserTracingNavigationSpan"],"mappings":";;;;;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,uCAAuC;AACvD;AACA,EAAE,MAAM;AACR,EAAE,OAAO,GAA4D,EAAE;AACvE,EAAe;AACf,EAAE,MAAM,kBAAkB,GAA2B,MAAM;;AAE3D,EAAE,MAAM,iCAAA,GAAoCA,iCAAiC,CAAC;AAC9E,IAAI,GAAG,OAAO;AACd,IAAI,oBAAoB,EAAE,KAAK;AAC/B,IAAI,kBAAkB,EAAE,KAAK;AAC7B,GAAG,CAAC;;AAEJ,EAAE,MAAM,EAAE,kBAAA,GAAqB,IAAI,EAAE,oBAAA,GAAuB,IAAA,EAAK,GAAI,OAAO;;AAE5E,EAAE,OAAO;AACT,IAAI,GAAG,iCAAiC;AACxC,IAAI,aAAa,CAAC,MAAM,EAAE;AAC1B,MAAM,iCAAiC,CAAC,aAAa,CAAC,MAAM,CAAC;;AAE7D,MAAM,MAAM,qBAAA,GAAwBC,cAAM,CAAC,QAAQ;AACnD,MAAM,IAAI,kBAAA,IAAsB,qBAAqB,EAAE;AACvD,QAAQ,MAAM,aAAA,GAAgB,kBAAkB,CAAC,WAAW;AAC5D,UAAU,qBAA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AgC,EAAE,OAAO,CAAC;AACtF,gBAAgB,cAAc,CAAC,aAAa,CAAC,+BAA+B,CAAC,oBAAoB,CAAC,CAAC;AACnG,cAAc;AACd,YAAY;AACZ,UAAU,CAAC,CAAC;AACZ,QAAQ,CAAC,CAAC;AACV,MAAM;AACN,IAAI,CAAC;AACL,GAAG;AACH;;AAEA,SAAS,+BAA+B,CAAC,KAAK,EAAwE;AACtH,EAAE,IAAI,CAAC,KAAK,EAAE;AACd,IAAI,OAAO,EAAE;AACb,EAAE;;AAEF,EAAE,MAAM,eAAe,GAA2B,EAAE;AACpD,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK;AACzD,IAAI,eAAe,CAAC,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAA,CAAA,GAAA,KAAA,CAAA;AACA,IAAA,eAAA,CAAA,CAAA,mBAAA,EAAA,GAAA,CAAA,CAAA,CAAA,GAAA,KAAA;AACA,IAAA,eAAA,CAAA,CAAA,OAAA,EAAA,GAAA,CAAA,CAAA,CAAA,GAAA,KAAA,CAAA;AACA,EAAA,CAAA,CAAA;;AAEA,EAAA,OAAA,eAAA;AACA;;;;"}
|
|
@@ -1,8 +1,157 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* React statics that should not be hoisted
|
|
3
|
+
*/
|
|
4
|
+
const REACT_STATICS = {
|
|
5
|
+
childContextTypes: true,
|
|
6
|
+
contextType: true,
|
|
7
|
+
contextTypes: true,
|
|
8
|
+
defaultProps: true,
|
|
9
|
+
displayName: true,
|
|
10
|
+
getDefaultProps: true,
|
|
11
|
+
getDerivedStateFromError: true,
|
|
12
|
+
getDerivedStateFromProps: true,
|
|
13
|
+
mixins: true,
|
|
14
|
+
propTypes: true,
|
|
15
|
+
type: true,
|
|
16
|
+
} ;
|
|
2
17
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Known JavaScript function statics that should not be hoisted
|
|
20
|
+
*/
|
|
21
|
+
const KNOWN_STATICS = {
|
|
22
|
+
name: true,
|
|
23
|
+
length: true,
|
|
24
|
+
prototype: true,
|
|
25
|
+
caller: true,
|
|
26
|
+
callee: true,
|
|
27
|
+
arguments: true,
|
|
28
|
+
arity: true,
|
|
29
|
+
} ;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Statics specific to ForwardRef components
|
|
33
|
+
*/
|
|
34
|
+
const FORWARD_REF_STATICS = {
|
|
35
|
+
$$typeof: true,
|
|
36
|
+
render: true,
|
|
37
|
+
defaultProps: true,
|
|
38
|
+
displayName: true,
|
|
39
|
+
propTypes: true,
|
|
40
|
+
} ;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Statics specific to Memo components
|
|
44
|
+
*/
|
|
45
|
+
const MEMO_STATICS = {
|
|
46
|
+
$$typeof: true,
|
|
47
|
+
compare: true,
|
|
48
|
+
defaultProps: true,
|
|
49
|
+
displayName: true,
|
|
50
|
+
propTypes: true,
|
|
51
|
+
type: true,
|
|
52
|
+
} ;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Inlined react-is utilities
|
|
56
|
+
* We only need to detect ForwardRef and Memo types
|
|
57
|
+
*/
|
|
58
|
+
const ForwardRefType = Symbol.for('react.forward_ref');
|
|
59
|
+
const MemoType = Symbol.for('react.memo');
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Check if a component is a Memo component
|
|
63
|
+
*/
|
|
64
|
+
function isMemo(component) {
|
|
65
|
+
return (
|
|
66
|
+
typeof component === 'object' && component !== null && (component ).$$typeof === MemoType
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Map of React component types to their specific statics
|
|
72
|
+
*/
|
|
73
|
+
const TYPE_STATICS = {};
|
|
74
|
+
TYPE_STATICS[ForwardRefType] = FORWARD_REF_STATICS;
|
|
75
|
+
TYPE_STATICS[MemoType] = MEMO_STATICS;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Get the appropriate statics object for a given component
|
|
79
|
+
*/
|
|
80
|
+
function getStatics(component) {
|
|
81
|
+
// React v16.11 and below
|
|
82
|
+
if (isMemo(component)) {
|
|
83
|
+
return MEMO_STATICS;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// React v16.12 and above
|
|
87
|
+
const componentType = (component ).$$typeof;
|
|
88
|
+
return (componentType && TYPE_STATICS[componentType]) || REACT_STATICS;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const defineProperty = Object.defineProperty.bind(Object);
|
|
92
|
+
const getOwnPropertyNames = Object.getOwnPropertyNames.bind(Object);
|
|
93
|
+
const getOwnPropertySymbols = Object.getOwnPropertySymbols?.bind(Object);
|
|
94
|
+
const getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor.bind(Object);
|
|
95
|
+
const getPrototypeOf = Object.getPrototypeOf.bind(Object);
|
|
96
|
+
const objectPrototype = Object.prototype;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Copies non-react specific statics from a child component to a parent component.
|
|
100
|
+
* Similar to Object.assign, but copies all static properties from source to target,
|
|
101
|
+
* excluding React-specific statics and known JavaScript statics.
|
|
102
|
+
*
|
|
103
|
+
* @param targetComponent - The component to copy statics to
|
|
104
|
+
* @param sourceComponent - The component to copy statics from
|
|
105
|
+
* @param excludelist - An optional object of keys to exclude from hoisting
|
|
106
|
+
* @returns The target component with hoisted statics
|
|
107
|
+
*/
|
|
108
|
+
function hoistNonReactStatics
|
|
109
|
+
|
|
110
|
+
(targetComponent, sourceComponent, excludelist) {
|
|
111
|
+
if (typeof sourceComponent !== 'string') {
|
|
112
|
+
// Don't hoist over string (html) components
|
|
113
|
+
if (objectPrototype) {
|
|
114
|
+
const inheritedComponent = getPrototypeOf(sourceComponent);
|
|
115
|
+
|
|
116
|
+
if (inheritedComponent && inheritedComponent !== objectPrototype) {
|
|
117
|
+
hoistNonReactStatics(targetComponent, inheritedComponent);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
let keys = getOwnPropertyNames(sourceComponent);
|
|
122
|
+
|
|
123
|
+
if (getOwnPropertySymbols) {
|
|
124
|
+
keys = keys.concat(getOwnPropertySymbols(sourceComponent));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const targetStatics = getStatics(targetComponent);
|
|
128
|
+
const sourceStatics = getStatics(sourceComponent);
|
|
129
|
+
|
|
130
|
+
for (const key of keys) {
|
|
131
|
+
const keyStr = String(key);
|
|
132
|
+
if (
|
|
133
|
+
!KNOWN_STATICS[keyStr ] &&
|
|
134
|
+
true &&
|
|
135
|
+
!sourceStatics?.[keyStr] &&
|
|
136
|
+
!targetStatics?.[keyStr] &&
|
|
137
|
+
!getOwnPropertyDescriptor(targetComponent, key) // Don't overwrite existing properties
|
|
138
|
+
) {
|
|
139
|
+
const descriptor = getOwnPropertyDescriptor(sourceComponent, key);
|
|
140
|
+
|
|
141
|
+
if (descriptor) {
|
|
142
|
+
try {
|
|
143
|
+
// Avoid failures from read-only properties
|
|
144
|
+
defineProperty(targetComponent, key, descriptor);
|
|
145
|
+
} catch (e) {
|
|
146
|
+
// Silently ignore errors
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return targetComponent;
|
|
154
|
+
}
|
|
6
155
|
|
|
7
156
|
export { hoistNonReactStatics };
|
|
8
157
|
//# sourceMappingURL=hoist-non-react-statics.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hoist-non-react-statics.js","sources":["../../src/hoist-non-react-statics.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"hoist-non-react-statics.js","sources":["../../src/hoist-non-react-statics.ts"],"sourcesContent":["/**\n * Inlined implementation of hoist-non-react-statics\n * Original library: https://github.com/mridgway/hoist-non-react-statics\n * License: BSD-3-Clause\n * Copyright 2015, Yahoo! Inc.\n *\n * This is an inlined version to avoid ESM compatibility issues with the original package.\n */\n\nimport type * as React from 'react';\n\n/**\n * React statics that should not be hoisted\n */\nconst REACT_STATICS = {\n childContextTypes: true,\n contextType: true,\n contextTypes: true,\n defaultProps: true,\n displayName: true,\n getDefaultProps: true,\n getDerivedStateFromError: true,\n getDerivedStateFromProps: true,\n mixins: true,\n propTypes: true,\n type: true,\n} as const;\n\n/**\n * Known JavaScript function statics that should not be hoisted\n */\nconst KNOWN_STATICS = {\n name: true,\n length: true,\n prototype: true,\n caller: true,\n callee: true,\n arguments: true,\n arity: true,\n} as const;\n\n/**\n * Statics specific to ForwardRef components\n */\nconst FORWARD_REF_STATICS = {\n $$typeof: true,\n render: true,\n defaultProps: true,\n displayName: true,\n propTypes: true,\n} as const;\n\n/**\n * Statics specific to Memo components\n */\nconst MEMO_STATICS = {\n $$typeof: true,\n compare: true,\n defaultProps: true,\n displayName: true,\n propTypes: true,\n type: true,\n} as const;\n\n/**\n * Inlined react-is utilities\n * We only need to detect ForwardRef and Memo types\n */\nconst ForwardRefType = Symbol.for('react.forward_ref');\nconst MemoType = Symbol.for('react.memo');\n\n/**\n * Check if a component is a Memo component\n */\nfunction isMemo(component: unknown): boolean {\n return (\n typeof component === 'object' && component !== null && (component as { $$typeof?: symbol }).$$typeof === MemoType\n );\n}\n\n/**\n * Map of React component types to their specific statics\n */\nconst TYPE_STATICS: Record<symbol, Record<string, boolean>> = {};\nTYPE_STATICS[ForwardRefType] = FORWARD_REF_STATICS;\nTYPE_STATICS[MemoType] = MEMO_STATICS;\n\n/**\n * Get the appropriate statics object for a given component\n */\nfunction getStatics(component: React.ComponentType<unknown>): Record<string, boolean> {\n // React v16.11 and below\n if (isMemo(component)) {\n return MEMO_STATICS;\n }\n\n // React v16.12 and above\n const componentType = (component as { $$typeof?: symbol }).$$typeof;\n return (componentType && TYPE_STATICS[componentType]) || REACT_STATICS;\n}\n\nconst defineProperty = Object.defineProperty.bind(Object);\nconst getOwnPropertyNames = Object.getOwnPropertyNames.bind(Object);\nconst getOwnPropertySymbols = Object.getOwnPropertySymbols?.bind(Object);\nconst getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor.bind(Object);\nconst getPrototypeOf = Object.getPrototypeOf.bind(Object);\nconst objectPrototype = Object.prototype;\n\n/**\n * Copies non-react specific statics from a child component to a parent component.\n * Similar to Object.assign, but copies all static properties from source to target,\n * excluding React-specific statics and known JavaScript statics.\n *\n * @param targetComponent - The component to copy statics to\n * @param sourceComponent - The component to copy statics from\n * @param excludelist - An optional object of keys to exclude from hoisting\n * @returns The target component with hoisted statics\n */\nexport function hoistNonReactStatics<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n T extends React.ComponentType<any>,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n S extends React.ComponentType<any>,\n C extends Record<string, boolean> = Record<string, never>,\n>(targetComponent: T, sourceComponent: S, excludelist?: C): T {\n if (typeof sourceComponent !== 'string') {\n // Don't hoist over string (html) components\n if (objectPrototype) {\n const inheritedComponent = getPrototypeOf(sourceComponent);\n\n if (inheritedComponent && inheritedComponent !== objectPrototype) {\n hoistNonReactStatics(targetComponent, inheritedComponent, excludelist);\n }\n }\n\n let keys: (string | symbol)[] = getOwnPropertyNames(sourceComponent);\n\n if (getOwnPropertySymbols) {\n keys = keys.concat(getOwnPropertySymbols(sourceComponent));\n }\n\n const targetStatics = getStatics(targetComponent);\n const sourceStatics = getStatics(sourceComponent);\n\n for (const key of keys) {\n const keyStr = String(key);\n if (\n !KNOWN_STATICS[keyStr as keyof typeof KNOWN_STATICS] &&\n !excludelist?.[keyStr] &&\n !sourceStatics?.[keyStr] &&\n !targetStatics?.[keyStr] &&\n !getOwnPropertyDescriptor(targetComponent, key) // Don't overwrite existing properties\n ) {\n const descriptor = getOwnPropertyDescriptor(sourceComponent, key);\n\n if (descriptor) {\n try {\n // Avoid failures from read-only properties\n defineProperty(targetComponent, key, descriptor);\n } catch (e) {\n // Silently ignore errors\n }\n }\n }\n }\n }\n\n return targetComponent;\n}\n"],"names":[],"mappings":"AAWA;AACA;AACA;AACA,MAAM,gBAAgB;AACtB,EAAE,iBAAiB,EAAE,IAAI;AACzB,EAAE,WAAW,EAAE,IAAI;AACnB,EAAE,YAAY,EAAE,IAAI;AACpB,EAAE,YAAY,EAAE,IAAI;AACpB,EAAE,WAAW,EAAE,IAAI;AACnB,EAAE,eAAe,EAAE,IAAI;AACvB,EAAE,wBAAwB,EAAE,IAAI;AAChC,EAAE,wBAAwB,EAAE,IAAI;AAChC,EAAE,MAAM,EAAE,IAAI;AACd,EAAE,SAAS,EAAE,IAAI;AACjB,EAAE,IAAI,EAAE,IAAI;AACZ,CAAA;;AAEA;AACA;AACA;AACA,MAAM,gBAAgB;AACtB,EAAE,IAAI,EAAE,IAAI;AACZ,EAAE,MAAM,EAAE,IAAI;AACd,EAAE,SAAS,EAAE,IAAI;AACjB,EAAE,MAAM,EAAE,IAAI;AACd,EAAE,MAAM,EAAE,IAAI;AACd,EAAE,SAAS,EAAE,IAAI;AACjB,EAAE,KAAK,EAAE,IAAI;AACb,CAAA;;AAEA;AACA;AACA;AACA,MAAM,sBAAsB;AAC5B,EAAE,QAAQ,EAAE,IAAI;AAChB,EAAE,MAAM,EAAE,IAAI;AACd,EAAE,YAAY,EAAE,IAAI;AACpB,EAAE,WAAW,EAAE,IAAI;AACnB,EAAE,SAAS,EAAE,IAAI;AACjB,CAAA;;AAEA;AACA;AACA;AACA,MAAM,eAAe;AACrB,EAAE,QAAQ,EAAE,IAAI;AAChB,EAAE,OAAO,EAAE,IAAI;AACf,EAAE,YAAY,EAAE,IAAI;AACpB,EAAE,WAAW,EAAE,IAAI;AACnB,EAAE,SAAS,EAAE,IAAI;AACjB,EAAE,IAAI,EAAE,IAAI;AACZ,CAAA;;AAEA;AACA;AACA;AACA;AACA,MAAM,iBAAiB,MAAM,CAAC,GAAG,CAAC,mBA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
@@ -1 +1 @@
|
|
|
1
|
-
{"type":"module","version":"10.
|
|
1
|
+
{"type":"module","version":"10.33.0","sideEffects":false}
|
|
@@ -38,14 +38,17 @@ function tanstackRouterBrowserTracingIntegration(
|
|
|
38
38
|
);
|
|
39
39
|
|
|
40
40
|
const lastMatch = matchedRoutes[matchedRoutes.length - 1];
|
|
41
|
+
// If we only match __root__, we ended up not matching any route at all, so
|
|
42
|
+
// we fall back to the pathname.
|
|
43
|
+
const routeMatch = lastMatch?.routeId !== '__root__' ? lastMatch : undefined;
|
|
41
44
|
|
|
42
45
|
startBrowserTracingPageLoadSpan(client, {
|
|
43
|
-
name:
|
|
46
|
+
name: routeMatch ? routeMatch.routeId : initialWindowLocation.pathname,
|
|
44
47
|
attributes: {
|
|
45
48
|
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload',
|
|
46
49
|
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.tanstack_router',
|
|
47
|
-
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]:
|
|
48
|
-
...routeMatchToParamSpanAttributes(
|
|
50
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: routeMatch ? 'route' : 'url',
|
|
51
|
+
...routeMatchToParamSpanAttributes(routeMatch),
|
|
49
52
|
},
|
|
50
53
|
});
|
|
51
54
|
}
|
|
@@ -63,21 +66,23 @@ function tanstackRouterBrowserTracingIntegration(
|
|
|
63
66
|
return;
|
|
64
67
|
}
|
|
65
68
|
|
|
66
|
-
const
|
|
69
|
+
const matchedRoutesOnBeforeNavigate = castRouterInstance.matchRoutes(
|
|
67
70
|
onBeforeNavigateArgs.toLocation.pathname,
|
|
68
71
|
onBeforeNavigateArgs.toLocation.search,
|
|
69
72
|
{ preload: false, throwOnError: false },
|
|
70
73
|
);
|
|
71
74
|
|
|
72
|
-
const onBeforeNavigateLastMatch =
|
|
75
|
+
const onBeforeNavigateLastMatch = matchedRoutesOnBeforeNavigate[matchedRoutesOnBeforeNavigate.length - 1];
|
|
76
|
+
const onBeforeNavigateRouteMatch =
|
|
77
|
+
onBeforeNavigateLastMatch?.routeId !== '__root__' ? onBeforeNavigateLastMatch : undefined;
|
|
73
78
|
|
|
74
79
|
const navigationLocation = WINDOW.location;
|
|
75
80
|
const navigationSpan = startBrowserTracingNavigationSpan(client, {
|
|
76
|
-
name:
|
|
81
|
+
name: onBeforeNavigateRouteMatch ? onBeforeNavigateRouteMatch.routeId : navigationLocation.pathname,
|
|
77
82
|
attributes: {
|
|
78
83
|
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',
|
|
79
84
|
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.tanstack_router',
|
|
80
|
-
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]:
|
|
85
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: onBeforeNavigateRouteMatch ? 'route' : 'url',
|
|
81
86
|
},
|
|
82
87
|
});
|
|
83
88
|
|
|
@@ -85,18 +90,20 @@ function tanstackRouterBrowserTracingIntegration(
|
|
|
85
90
|
const unsubscribeOnResolved = castRouterInstance.subscribe('onResolved', onResolvedArgs => {
|
|
86
91
|
unsubscribeOnResolved();
|
|
87
92
|
if (navigationSpan) {
|
|
88
|
-
const
|
|
93
|
+
const matchedRoutesOnResolved = castRouterInstance.matchRoutes(
|
|
89
94
|
onResolvedArgs.toLocation.pathname,
|
|
90
95
|
onResolvedArgs.toLocation.search,
|
|
91
96
|
{ preload: false, throwOnError: false },
|
|
92
97
|
);
|
|
93
98
|
|
|
94
|
-
const onResolvedLastMatch =
|
|
99
|
+
const onResolvedLastMatch = matchedRoutesOnResolved[matchedRoutesOnResolved.length - 1];
|
|
100
|
+
const onResolvedRouteMatch =
|
|
101
|
+
onResolvedLastMatch?.routeId !== '__root__' ? onResolvedLastMatch : undefined;
|
|
95
102
|
|
|
96
|
-
if (
|
|
97
|
-
navigationSpan.updateName(
|
|
103
|
+
if (onResolvedRouteMatch) {
|
|
104
|
+
navigationSpan.updateName(onResolvedRouteMatch.routeId);
|
|
98
105
|
navigationSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route');
|
|
99
|
-
navigationSpan.setAttributes(routeMatchToParamSpanAttributes(
|
|
106
|
+
navigationSpan.setAttributes(routeMatchToParamSpanAttributes(onResolvedRouteMatch));
|
|
100
107
|
}
|
|
101
108
|
}
|
|
102
109
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tanstackrouter.js","sources":["../../src/tanstackrouter.ts"],"sourcesContent":["import {\n browserTracingIntegration as originalBrowserTracingIntegration,\n startBrowserTracingNavigationSpan,\n startBrowserTracingPageLoadSpan,\n WINDOW,\n} from '@sentry/browser';\nimport type { Integration } from '@sentry/core';\nimport {\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n} from '@sentry/core';\nimport type { VendoredTanstackRouter, VendoredTanstackRouterRouteMatch } from './vendor/tanstackrouter-types';\n\n/**\n * A custom browser tracing integration for TanStack Router.\n *\n * The minimum compatible version of `@tanstack/react-router` is `1.64.0`.\n *\n * @param router A TanStack Router `Router` instance that should be used for routing instrumentation.\n * @param options Sentry browser tracing configuration.\n */\nexport function tanstackRouterBrowserTracingIntegration(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n router: any, // This is `any` because we don't want any type mismatches if TanStack Router changes their types\n options: Parameters<typeof originalBrowserTracingIntegration>[0] = {},\n): Integration {\n const castRouterInstance: VendoredTanstackRouter = router;\n\n const browserTracingIntegrationInstance = originalBrowserTracingIntegration({\n ...options,\n instrumentNavigation: false,\n instrumentPageLoad: false,\n });\n\n const { instrumentPageLoad = true, instrumentNavigation = true } = options;\n\n return {\n ...browserTracingIntegrationInstance,\n afterAllSetup(client) {\n browserTracingIntegrationInstance.afterAllSetup(client);\n\n const initialWindowLocation = WINDOW.location;\n if (instrumentPageLoad && initialWindowLocation) {\n const matchedRoutes = castRouterInstance.matchRoutes(\n initialWindowLocation.pathname,\n castRouterInstance.options.parseSearch(initialWindowLocation.search),\n { preload: false, throwOnError: false },\n );\n\n const lastMatch = matchedRoutes[matchedRoutes.length - 1];\n\n startBrowserTracingPageLoadSpan(client, {\n name:
|
|
1
|
+
{"version":3,"file":"tanstackrouter.js","sources":["../../src/tanstackrouter.ts"],"sourcesContent":["import {\n browserTracingIntegration as originalBrowserTracingIntegration,\n startBrowserTracingNavigationSpan,\n startBrowserTracingPageLoadSpan,\n WINDOW,\n} from '@sentry/browser';\nimport type { Integration } from '@sentry/core';\nimport {\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n} from '@sentry/core';\nimport type { VendoredTanstackRouter, VendoredTanstackRouterRouteMatch } from './vendor/tanstackrouter-types';\n\n/**\n * A custom browser tracing integration for TanStack Router.\n *\n * The minimum compatible version of `@tanstack/react-router` is `1.64.0`.\n *\n * @param router A TanStack Router `Router` instance that should be used for routing instrumentation.\n * @param options Sentry browser tracing configuration.\n */\nexport function tanstackRouterBrowserTracingIntegration(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n router: any, // This is `any` because we don't want any type mismatches if TanStack Router changes their types\n options: Parameters<typeof originalBrowserTracingIntegration>[0] = {},\n): Integration {\n const castRouterInstance: VendoredTanstackRouter = router;\n\n const browserTracingIntegrationInstance = originalBrowserTracingIntegration({\n ...options,\n instrumentNavigation: false,\n instrumentPageLoad: false,\n });\n\n const { instrumentPageLoad = true, instrumentNavigation = true } = options;\n\n return {\n ...browserTracingIntegrationInstance,\n afterAllSetup(client) {\n browserTracingIntegrationInstance.afterAllSetup(client);\n\n const initialWindowLocation = WINDOW.location;\n if (instrumentPageLoad && initialWindowLocation) {\n const matchedRoutes = castRouterInstance.matchRoutes(\n initialWindowLocation.pathname,\n castRouterInstance.options.parseSearch(initialWindowLocation.search),\n { preload: false, throwOnError: false },\n );\n\n const lastMatch = matchedRoutes[matchedRoutes.length - 1];\n // If we only match __root__, we ended up not matching any route at all, so\n // we fall back to the pathname.\n const routeMatch = lastMatch?.routeId !== '__root__' ? lastMatch : undefined;\n\n startBrowserTracingPageLoadSpan(client, {\n name: routeMatch ? routeMatch.routeId : initialWindowLocation.pathname,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.tanstack_router',\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: routeMatch ? 'route' : 'url',\n ...routeMatchToParamSpanAttributes(routeMatch),\n },\n });\n }\n\n if (instrumentNavigation) {\n // The onBeforeNavigate hook is called at the very beginning of a navigation and is only called once per navigation, even when the user is redirected\n castRouterInstance.subscribe('onBeforeNavigate', onBeforeNavigateArgs => {\n // onBeforeNavigate is called during pageloads. We can avoid creating navigation spans by:\n // 1. Checking if there's no fromLocation (initial pageload)\n // 2. Comparing the states of the to and from arguments\n if (\n !onBeforeNavigateArgs.fromLocation ||\n onBeforeNavigateArgs.toLocation.state === onBeforeNavigateArgs.fromLocation.state\n ) {\n return;\n }\n\n const matchedRoutesOnBeforeNavigate = castRouterInstance.matchRoutes(\n onBeforeNavigateArgs.toLocation.pathname,\n onBeforeNavigateArgs.toLocation.search,\n { preload: false, throwOnError: false },\n );\n\n const onBeforeNavigateLastMatch = matchedRoutesOnBeforeNavigate[matchedRoutesOnBeforeNavigate.length - 1];\n const onBeforeNavigateRouteMatch =\n onBeforeNavigateLastMatch?.routeId !== '__root__' ? onBeforeNavigateLastMatch : undefined;\n\n const navigationLocation = WINDOW.location;\n const navigationSpan = startBrowserTracingNavigationSpan(client, {\n name: onBeforeNavigateRouteMatch ? onBeforeNavigateRouteMatch.routeId : navigationLocation.pathname,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.tanstack_router',\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: onBeforeNavigateRouteMatch ? 'route' : 'url',\n },\n });\n\n // In case the user is redirected during navigation we want to update the span with the right value.\n const unsubscribeOnResolved = castRouterInstance.subscribe('onResolved', onResolvedArgs => {\n unsubscribeOnResolved();\n if (navigationSpan) {\n const matchedRoutesOnResolved = castRouterInstance.matchRoutes(\n onResolvedArgs.toLocation.pathname,\n onResolvedArgs.toLocation.search,\n { preload: false, throwOnError: false },\n );\n\n const onResolvedLastMatch = matchedRoutesOnResolved[matchedRoutesOnResolved.length - 1];\n const onResolvedRouteMatch =\n onResolvedLastMatch?.routeId !== '__root__' ? onResolvedLastMatch : undefined;\n\n if (onResolvedRouteMatch) {\n navigationSpan.updateName(onResolvedRouteMatch.routeId);\n navigationSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route');\n navigationSpan.setAttributes(routeMatchToParamSpanAttributes(onResolvedRouteMatch));\n }\n }\n });\n });\n }\n },\n };\n}\n\nfunction routeMatchToParamSpanAttributes(match: VendoredTanstackRouterRouteMatch | undefined): Record<string, string> {\n if (!match) {\n return {};\n }\n\n const paramAttributes: Record<string, string> = {};\n Object.entries(match.params).forEach(([key, value]) => {\n paramAttributes[`url.path.params.${key}`] = value; // TODO(v11): remove attribute which does not adhere to Sentry's semantic convention\n paramAttributes[`url.path.parameter.${key}`] = value;\n paramAttributes[`params.${key}`] = value; // params.[key] is an alias\n });\n\n return paramAttributes;\n}\n"],"names":["originalBrowserTracingIntegration"],"mappings":";;;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,uCAAuC;AACvD;AACA,EAAE,MAAM;AACR,EAAE,OAAO,GAA4D,EAAE;AACvE,EAAe;AACf,EAAE,MAAM,kBAAkB,GAA2B,MAAM;;AAE3D,EAAE,MAAM,i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AAA,CAAA,GAAA,KAAA,CAAA;AACA,EAAA,CAAA,CAAA;;AAEA,EAAA,OAAA,eAAA;AACA;;;;"}
|
|
@@ -1,2 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Inlined implementation of hoist-non-react-statics
|
|
3
|
+
* Original library: https://github.com/mridgway/hoist-non-react-statics
|
|
4
|
+
* License: BSD-3-Clause
|
|
5
|
+
* Copyright 2015, Yahoo! Inc.
|
|
6
|
+
*
|
|
7
|
+
* This is an inlined version to avoid ESM compatibility issues with the original package.
|
|
8
|
+
*/
|
|
9
|
+
import type * as React from 'react';
|
|
10
|
+
/**
|
|
11
|
+
* Copies non-react specific statics from a child component to a parent component.
|
|
12
|
+
* Similar to Object.assign, but copies all static properties from source to target,
|
|
13
|
+
* excluding React-specific statics and known JavaScript statics.
|
|
14
|
+
*
|
|
15
|
+
* @param targetComponent - The component to copy statics to
|
|
16
|
+
* @param sourceComponent - The component to copy statics from
|
|
17
|
+
* @param excludelist - An optional object of keys to exclude from hoisting
|
|
18
|
+
* @returns The target component with hoisted statics
|
|
19
|
+
*/
|
|
20
|
+
export declare function hoistNonReactStatics<T extends React.ComponentType<any>, S extends React.ComponentType<any>, C extends Record<string, boolean> = Record<string, never>>(targetComponent: T, sourceComponent: S, excludelist?: C): T;
|
|
2
21
|
//# sourceMappingURL=hoist-non-react-statics.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hoist-non-react-statics.d.ts","sourceRoot":"","sources":["../../src/hoist-non-react-statics.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hoist-non-react-statics.d.ts","sourceRoot":"","sources":["../../src/hoist-non-react-statics.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAmGpC;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAElC,CAAC,SAAS,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,EAElC,CAAC,SAAS,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,EAClC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EACzD,eAAe,EAAE,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE,WAAW,CAAC,EAAE,CAAC,GAAG,CAAC,CA4C5D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tanstackrouter.d.ts","sourceRoot":"","sources":["../../src/tanstackrouter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,IAAI,iCAAiC,EAI/D,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAQhD;;;;;;;GAOG;AACH,wBAAgB,uCAAuC,CAErD,MAAM,EAAE,GAAG,EAAE,iGAAiG;AAC9G,OAAO,GAAE,UAAU,CAAC,OAAO,iCAAiC,CAAC,CAAC,CAAC,CAAM,GACpE,WAAW,
|
|
1
|
+
{"version":3,"file":"tanstackrouter.d.ts","sourceRoot":"","sources":["../../src/tanstackrouter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,IAAI,iCAAiC,EAI/D,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAQhD;;;;;;;GAOG;AACH,wBAAgB,uCAAuC,CAErD,MAAM,EAAE,GAAG,EAAE,iGAAiG;AAC9G,OAAO,GAAE,UAAU,CAAC,OAAO,iCAAiC,CAAC,CAAC,CAAC,CAAM,GACpE,WAAW,CAkGb"}
|
|
@@ -1,2 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Inlined implementation of hoist-non-react-statics
|
|
3
|
+
* Original library: https://github.com/mridgway/hoist-non-react-statics
|
|
4
|
+
* License: BSD-3-Clause
|
|
5
|
+
* Copyright 2015, Yahoo! Inc.
|
|
6
|
+
*
|
|
7
|
+
* This is an inlined version to avoid ESM compatibility issues with the original package.
|
|
8
|
+
*/
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
/**
|
|
11
|
+
* Copies non-react specific statics from a child component to a parent component.
|
|
12
|
+
* Similar to Object.assign, but copies all static properties from source to target,
|
|
13
|
+
* excluding React-specific statics and known JavaScript statics.
|
|
14
|
+
*
|
|
15
|
+
* @param targetComponent - The component to copy statics to
|
|
16
|
+
* @param sourceComponent - The component to copy statics from
|
|
17
|
+
* @param excludelist - An optional object of keys to exclude from hoisting
|
|
18
|
+
* @returns The target component with hoisted statics
|
|
19
|
+
*/
|
|
20
|
+
export declare function hoistNonReactStatics<T extends React.ComponentType<any>, S extends React.ComponentType<any>, C extends Record<string, boolean> = Record<string, never>>(targetComponent: T, sourceComponent: S, excludelist?: C): T;
|
|
2
21
|
//# sourceMappingURL=hoist-non-react-statics.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/react",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.33.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",
|
|
@@ -39,9 +39,8 @@
|
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@sentry/browser": "10.
|
|
43
|
-
"@sentry/core": "10.
|
|
44
|
-
"hoist-non-react-statics": "^3.3.2"
|
|
42
|
+
"@sentry/browser": "10.33.0",
|
|
43
|
+
"@sentry/core": "10.33.0"
|
|
45
44
|
},
|
|
46
45
|
"peerDependencies": {
|
|
47
46
|
"react": "^16.14.0 || 17.x || 18.x || 19.x"
|
|
@@ -51,7 +50,7 @@
|
|
|
51
50
|
"@testing-library/react-hooks": "^7.0.2",
|
|
52
51
|
"@types/history-4": "npm:@types/history@4.7.8",
|
|
53
52
|
"@types/history-5": "npm:@types/history@4.7.8",
|
|
54
|
-
"@types/
|
|
53
|
+
"@types/node-fetch": "^2.6.11",
|
|
55
54
|
"@types/react": "17.0.3",
|
|
56
55
|
"@types/react-router-4": "npm:@types/react-router@4.0.25",
|
|
57
56
|
"@types/react-router-5": "npm:@types/react-router@5.1.20",
|