@sentry/react 11.0.0-alpha.1 → 11.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/build/cjs/error.js +4 -4
  2. package/build/cjs/error.js.map +1 -1
  3. package/build/cjs/profiler.js +10 -13
  4. package/build/cjs/profiler.js.map +1 -1
  5. package/build/cjs/reactrouter-compat-utils/instrumentation.js +30 -18
  6. package/build/cjs/reactrouter-compat-utils/instrumentation.js.map +1 -1
  7. package/build/cjs/reactrouter-compat-utils/route-manifest.js +4 -4
  8. package/build/cjs/reactrouter-compat-utils/route-manifest.js.map +1 -1
  9. package/build/cjs/reactrouter-compat-utils/utils.js +5 -5
  10. package/build/cjs/reactrouter-compat-utils/utils.js.map +1 -1
  11. package/build/cjs/reactrouter.compat.js +0 -3
  12. package/build/cjs/reactrouter.compat.js.map +1 -1
  13. package/build/cjs/reactrouter.js +10 -7
  14. package/build/cjs/reactrouter.js.map +1 -1
  15. package/build/cjs/reactrouterv3.js +12 -9
  16. package/build/cjs/reactrouterv3.js.map +1 -1
  17. package/build/cjs/reactrouterv6.js +0 -3
  18. package/build/cjs/reactrouterv6.js.map +1 -1
  19. package/build/cjs/reactrouterv7.js +0 -3
  20. package/build/cjs/reactrouterv7.js.map +1 -1
  21. package/build/cjs/redux.js +6 -6
  22. package/build/cjs/redux.js.map +1 -1
  23. package/build/cjs/sdk.js +7 -7
  24. package/build/cjs/sdk.js.map +1 -1
  25. package/build/cjs/tanstackrouter.js +25 -14
  26. package/build/cjs/tanstackrouter.js.map +1 -1
  27. package/build/esm/error.js +1 -1
  28. package/build/esm/error.js.map +1 -1
  29. package/build/esm/package.json +1 -1
  30. package/build/esm/profiler.js +12 -15
  31. package/build/esm/profiler.js.map +1 -1
  32. package/build/esm/reactrouter-compat-utils/instrumentation.js +32 -20
  33. package/build/esm/reactrouter-compat-utils/instrumentation.js.map +1 -1
  34. package/build/esm/reactrouter-compat-utils/route-manifest.js +1 -1
  35. package/build/esm/reactrouter-compat-utils/route-manifest.js.map +1 -1
  36. package/build/esm/reactrouter-compat-utils/utils.js +1 -1
  37. package/build/esm/reactrouter-compat-utils/utils.js.map +1 -1
  38. package/build/esm/reactrouter.compat.js +0 -3
  39. package/build/esm/reactrouter.compat.js.map +1 -1
  40. package/build/esm/reactrouter.js +12 -9
  41. package/build/esm/reactrouter.js.map +1 -1
  42. package/build/esm/reactrouterv3.js +11 -8
  43. package/build/esm/reactrouterv3.js.map +1 -1
  44. package/build/esm/reactrouterv6.js +0 -3
  45. package/build/esm/reactrouterv6.js.map +1 -1
  46. package/build/esm/reactrouterv7.js +0 -3
  47. package/build/esm/reactrouterv7.js.map +1 -1
  48. package/build/esm/redux.js +1 -1
  49. package/build/esm/redux.js.map +1 -1
  50. package/build/esm/sdk.js +1 -1
  51. package/build/esm/sdk.js.map +1 -1
  52. package/build/esm/tanstackrouter.js +25 -14
  53. package/build/esm/tanstackrouter.js.map +1 -1
  54. package/build/types/profiler.d.ts.map +1 -1
  55. package/build/types/reactrouter-compat-utils/instrumentation.d.ts.map +1 -1
  56. package/build/types/reactrouter-compat-utils/utils.d.ts +1 -1
  57. package/build/types/reactrouter-compat-utils/utils.d.ts.map +1 -1
  58. package/build/types/reactrouter.d.ts.map +1 -1
  59. package/build/types/reactrouterv3.d.ts +1 -1
  60. package/build/types/reactrouterv3.d.ts.map +1 -1
  61. package/build/types/redux.d.ts +1 -1
  62. package/build/types/redux.d.ts.map +1 -1
  63. package/build/types/sdk.d.ts +1 -1
  64. package/build/types/sdk.d.ts.map +1 -1
  65. package/build/types/tanstackrouter.d.ts +1 -1
  66. package/build/types/tanstackrouter.d.ts.map +1 -1
  67. package/build/types/vendor/tanstackrouter-types.d.ts +1 -0
  68. package/build/types/vendor/tanstackrouter-types.d.ts.map +1 -1
  69. package/package.json +5 -4
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../src/reactrouter-compat-utils/utils.ts"],"sourcesContent":["import type { Span, TransactionSource } from '@sentry/core/browser';\nimport { debug, getActiveSpan, getRootSpan, spanToJSON } from '@sentry/core/browser';\nimport { DEBUG_BUILD } from '../debug-build';\nimport type { Location, MatchRoutes, RouteMatch, RouteObject } from '../types';\nimport { matchRouteManifest, stripBasenameFromPathname } from './route-manifest';\nimport { SENTRY_OP } from '@sentry/conventions/attributes';\n\n// Global variables that these utilities depend on\nlet _matchRoutes: MatchRoutes;\nlet _stripBasename: boolean = false;\n\n// Navigation context stack for nested/concurrent patchRoutesOnNavigation calls.\n// Required because window.location hasn't updated yet when handlers are invoked.\ninterface NavigationContext {\n token: object;\n targetPath: string | undefined;\n span: Span | undefined;\n}\n\nconst _navigationContextStack: NavigationContext[] = [];\nconst MAX_CONTEXT_STACK_SIZE = 10;\n\n/**\n * Pushes a navigation context and returns a unique token for cleanup.\n * The token uses object identity for uniqueness (no counter needed).\n */\nexport function setNavigationContext(targetPath: string | undefined, span: Span | undefined): object {\n const token = {};\n // Prevent unbounded stack growth - oldest (likely stale) contexts are evicted first\n if (_navigationContextStack.length >= MAX_CONTEXT_STACK_SIZE) {\n DEBUG_BUILD && debug.warn('[React Router] Navigation context stack overflow - removing oldest context');\n _navigationContextStack.shift();\n }\n _navigationContextStack.push({ token, targetPath, span });\n return token;\n}\n\n/**\n * Clears the navigation context if it's on top of the stack (LIFO).\n * If our context is not on top (out-of-order completion), we leave it -\n * it will be cleaned up by overflow protection when the stack fills up.\n */\nexport function clearNavigationContext(token: object): void {\n const top = _navigationContextStack[_navigationContextStack.length - 1];\n if (top?.token === token) {\n _navigationContextStack.pop();\n }\n}\n\n/** Gets the current (most recent) navigation context if inside a patchRoutesOnNavigation call. */\nexport function getNavigationContext(): NavigationContext | null {\n const length = _navigationContextStack.length;\n // The `?? null` converts undefined (from array access) to null to match return type\n return length > 0 ? (_navigationContextStack[length - 1] ?? null) : null;\n}\n\n/**\n * Initialize function to set dependencies that the router utilities need.\n * Must be called before using any of the exported utility functions.\n */\nexport function initializeRouterUtils(matchRoutes: MatchRoutes, stripBasename: boolean = false): void {\n _matchRoutes = matchRoutes;\n _stripBasename = stripBasename;\n}\n\n// Helper functions\nfunction pickPath(match: RouteMatch): string {\n return trimWildcard(match.route.path || '');\n}\n\nfunction pickSplat(match: RouteMatch): string {\n return match.params['*'] || '';\n}\n\nfunction trimWildcard(path: string): string {\n return path[path.length - 1] === '*' ? path.slice(0, -1) : path;\n}\n\nfunction trimSlash(path: string): string {\n return path[path.length - 1] === '/' ? path.slice(0, -1) : path;\n}\n\n/**\n * Checks if a path ends with a wildcard character (*).\n */\nexport function pathEndsWithWildcard(path: string): boolean {\n return path.endsWith('*');\n}\n\n/** Checks if transaction name has wildcard (/* or ends with *). */\nexport function transactionNameHasWildcard(name: string): boolean {\n return name.includes('/*') || name.endsWith('*');\n}\n\n/**\n * Checks if a path is a wildcard and has child routes.\n */\nexport function pathIsWildcardAndHasChildren(path: string, branch: RouteMatch<string>): boolean {\n return (pathEndsWithWildcard(path) && !!branch.route.children?.length) || false;\n}\n\n/** Check if route is in descendant route (<Routes> within <Routes>) */\nexport function routeIsDescendant(route: RouteObject): boolean {\n return !!(!route.children && route.element && route.path?.endsWith('/*'));\n}\n\nfunction sendIndexPath(pathBuilder: string, pathname: string, basename: string): [string, TransactionSource] {\n const reconstructedPath =\n pathBuilder && pathBuilder.length > 0\n ? pathBuilder\n : _stripBasename\n ? stripBasenameFromPathname(pathname, basename)\n : pathname;\n\n let formattedPath =\n // If the path ends with a wildcard suffix, remove both the slash and the asterisk\n reconstructedPath.slice(-2) === '/*' ? reconstructedPath.slice(0, -2) : reconstructedPath;\n\n // If the path ends with a slash, remove it (but keep single '/')\n if (formattedPath.length > 1 && formattedPath[formattedPath.length - 1] === '/') {\n formattedPath = formattedPath.slice(0, -1);\n }\n\n return [formattedPath, 'route'];\n}\n\n/**\n * Returns the number of URL segments in the given URL string.\n * Splits at '/' or '\\/' to handle regex URLs correctly.\n *\n * @param url - The URL string to segment.\n * @returns The number of segments in the URL.\n */\nexport function getNumberOfUrlSegments(url: string): number {\n // split at '/' or at '\\/' to split regex urls correctly\n return url.split(/\\\\?\\//).filter(s => s.length > 0 && s !== ',').length;\n}\n\n// Exported utility functions\n\n/**\n * Ensures a path string starts with a forward slash.\n */\nexport function prefixWithSlash(path: string): string {\n return path[0] === '/' ? path : `/${path}`;\n}\n\n/**\n * Rebuilds the route path from all available routes by matching against the current location.\n */\nexport function rebuildRoutePathFromAllRoutes(allRoutes: RouteObject[], location: Location): string {\n const matchedRoutes = _matchRoutes(allRoutes, location) as RouteMatch[];\n\n if (!matchedRoutes || matchedRoutes.length === 0) {\n return '';\n }\n\n for (const match of matchedRoutes) {\n if (match.route.path && match.route.path !== '*') {\n const path = pickPath(match);\n const strippedPath = stripBasenameFromPathname(location.pathname, prefixWithSlash(match.pathnameBase));\n\n if (location.pathname === strippedPath) {\n return trimSlash(strippedPath);\n }\n\n return trimSlash(\n trimSlash(path || '') +\n prefixWithSlash(\n rebuildRoutePathFromAllRoutes(\n allRoutes.filter(route => route !== match.route),\n {\n pathname: strippedPath,\n },\n ),\n ),\n );\n }\n }\n\n return '';\n}\n\n/**\n * Recovers the parent prefix for descendant `<Routes>` names.\n *\n * `allRoutes` flattens every mounted `<Routes>` into one set, so an orphaned descendant subtree can\n * outscore the `.../*` route that anchors the location and drop its prefix (e.g. `/:id/:sub` instead of `/child/:id`).\n * Matching only the descendant-parent routes recovers the true anchor.\n */\nfunction reconstructNameFromDescendantParent(\n location: Location,\n allRoutes: RouteObject[],\n currentName: string | undefined,\n): string | undefined {\n const descendantParents = allRoutes.filter(routeIsDescendant);\n if (!descendantParents.length) {\n return undefined;\n }\n\n const matchedParents = _matchRoutes(descendantParents, location) as RouteMatch[] | null;\n const parentMatch = matchedParents?.[matchedParents.length - 1];\n if (!parentMatch || !pickSplat(parentMatch)) {\n return undefined;\n }\n\n const parentTemplate = trimSlash(trimWildcard(parentMatch.route.path || ''));\n\n if (!parentTemplate) {\n return undefined;\n }\n\n const expectedPrefix = prefixWithSlash(parentTemplate);\n\n // Child `<Routes>` resolve against the matched parent, but flattened route matching can already retain\n // a dynamic leading parameter. Adding the parent again would duplicate it (e.g. `/:id/:id`)\n const firstElement = parentTemplate.split('/')[0];\n const hasDynamicLead = firstElement?.startsWith(':') && currentName?.split('/').includes(firstElement);\n\n // Rebuild only when matching the descendant subtree discarded its parent route template\n if (currentName === expectedPrefix || currentName?.startsWith(`${expectedPrefix}/`) || hasDynamicLead) {\n return undefined;\n }\n\n const remainingPathname =\n stripBasenameFromPathname(location.pathname, prefixWithSlash(parentMatch.pathnameBase)) || '/';\n const remainingName = rebuildRoutePathFromAllRoutes(\n allRoutes.filter(route => route !== parentMatch.route),\n { pathname: remainingPathname },\n );\n\n return remainingName ? prefixWithSlash(`${parentTemplate}${prefixWithSlash(remainingName)}`) : undefined;\n}\n\n/**\n * Checks if the current location is inside a descendant route (route with splat parameter).\n */\nexport function locationIsInsideDescendantRoute(location: Location, routes: RouteObject[]): boolean {\n const matchedRoutes = _matchRoutes(routes, location) as RouteMatch[];\n\n if (matchedRoutes) {\n for (const match of matchedRoutes) {\n if (routeIsDescendant(match.route) && pickSplat(match)) {\n return true;\n }\n }\n }\n\n return false;\n}\n\n/**\n * Returns a fallback transaction name from location pathname.\n */\nfunction getFallbackTransactionName(location: Location, basename: string): string {\n return _stripBasename ? stripBasenameFromPathname(location.pathname, basename) : location.pathname || '';\n}\n\n/**\n * Gets a normalized route name and transaction source from the current routes and location.\n */\nexport function getNormalizedName(\n routes: RouteObject[],\n location: Location,\n branches: RouteMatch[],\n basename: string = '',\n): [string, TransactionSource] {\n if (!routes || routes.length === 0) {\n return [_stripBasename ? stripBasenameFromPathname(location.pathname, basename) : location.pathname, 'url'];\n }\n\n if (!branches) {\n return [getFallbackTransactionName(location, basename), 'url'];\n }\n\n let pathBuilder = '';\n\n for (const branch of branches) {\n const route = branch.route;\n if (!route) {\n continue;\n }\n\n // Early return for index routes\n if (route.index) {\n return sendIndexPath(pathBuilder, branch.pathname, basename);\n }\n\n const path = route.path;\n if (!path || pathIsWildcardAndHasChildren(path, branch)) {\n continue;\n }\n\n // Build the route path\n const newPath = path[0] === '/' || pathBuilder[pathBuilder.length - 1] === '/' ? path : `/${path}`;\n pathBuilder = trimSlash(pathBuilder) + prefixWithSlash(newPath);\n\n // Check if this path matches the current location\n if (trimSlash(location.pathname) !== trimSlash(basename + branch.pathname)) {\n continue;\n }\n\n // Check if this is a parameterized route like /stores/:storeId/products/:productId\n if (\n getNumberOfUrlSegments(pathBuilder) !== getNumberOfUrlSegments(branch.pathname) &&\n !pathEndsWithWildcard(pathBuilder)\n ) {\n return [(_stripBasename ? '' : basename) + newPath, 'route'];\n }\n\n // Handle wildcard routes with children - strip trailing wildcard\n if (pathIsWildcardAndHasChildren(pathBuilder, branch)) {\n pathBuilder = pathBuilder.slice(0, -1);\n }\n\n return [(_stripBasename ? '' : basename) + pathBuilder, 'route'];\n }\n\n // Fallback when no matching route found\n return [getFallbackTransactionName(location, basename), 'url'];\n}\n\n/**\n * Shared helper function to resolve route name and source\n */\nexport function resolveRouteNameAndSource(\n location: Location,\n routes: RouteObject[],\n allRoutes: RouteObject[],\n branches: RouteMatch[],\n basename: string = '',\n lazyRouteManifest?: string[],\n enableAsyncRouteHandlers?: boolean,\n): [string, TransactionSource] {\n // When lazy route manifest is provided, use it as the primary source for transaction names\n if (enableAsyncRouteHandlers && lazyRouteManifest && lazyRouteManifest.length > 0) {\n const manifestMatch = matchRouteManifest(location.pathname, lazyRouteManifest, basename);\n if (manifestMatch) {\n return [(_stripBasename ? '' : basename) + manifestMatch, 'route'];\n }\n }\n\n // Fall back to React Router route matching\n let name: string | undefined;\n let source: TransactionSource = 'url';\n\n const isInDescendantRoute = locationIsInsideDescendantRoute(location, allRoutes);\n\n if (isInDescendantRoute) {\n name = prefixWithSlash(rebuildRoutePathFromAllRoutes(allRoutes, location));\n source = 'route';\n }\n\n if (!isInDescendantRoute || !name) {\n [name, source] = getNormalizedName(routes, location, branches, basename);\n }\n\n // Guard against orphaned descendant subtrees stealing the transaction name: if the location is\n // anchored by a descendant-parent route (`.../*`) whose prefix was dropped, reconstruct with it.\n const anchoredName = reconstructNameFromDescendantParent(location, allRoutes, name);\n if (anchoredName) {\n return [anchoredName, 'route'];\n }\n\n return [name || location.pathname, source];\n}\n\n/**\n * Gets the active root span if it's a pageload or navigation span.\n */\nexport function getActiveRootSpan(): Span | undefined {\n const span = getActiveSpan();\n const rootSpan = span ? getRootSpan(span) : undefined;\n\n if (!rootSpan) {\n return undefined;\n }\n\n const op = spanToJSON(rootSpan).attributes[SENTRY_OP];\n\n // Only use this root span if it is a pageload or navigation span\n return op === 'navigation' || op === 'pageload' ? rootSpan : undefined;\n}\n"],"names":["DEBUG_BUILD","debug","stripBasenameFromPathname","matchRouteManifest","getActiveSpan","getRootSpan","spanToJSON","SENTRY_OP"],"mappings":";;;;;;;AAQA,IAAI,YAAA;AACJ,IAAI,cAAA,GAA0B,KAAA;AAU9B,MAAM,0BAA+C,EAAC;AACtD,MAAM,sBAAA,GAAyB,EAAA;AAMxB,SAAS,oBAAA,CAAqB,YAAgC,IAAA,EAAgC;AACnG,EAAA,MAAM,QAAQ,EAAC;AAEf,EAAA,IAAI,uBAAA,CAAwB,UAAU,sBAAA,EAAwB;AAC5D,IAAAA,sBAAA,IAAeC,aAAA,CAAM,KAAK,4EAA4E,CAAA;AACtG,IAAA,uBAAA,CAAwB,KAAA,EAAM;AAAA,EAChC;AACA,EAAA,uBAAA,CAAwB,IAAA,CAAK,EAAE,KAAA,EAAO,UAAA,EAAY,MAAM,CAAA;AACxD,EAAA,OAAO,KAAA;AACT;AAOO,SAAS,uBAAuB,KAAA,EAAqB;AAC1D,EAAA,MAAM,GAAA,GAAM,uBAAA,CAAwB,uBAAA,CAAwB,MAAA,GAAS,CAAC,CAAA;AACtE,EAAA,IAAI,GAAA,EAAK,UAAU,KAAA,EAAO;AACxB,IAAA,uBAAA,CAAwB,GAAA,EAAI;AAAA,EA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1
+ {"version":3,"file":"utils.js","sources":["../../../src/reactrouter-compat-utils/utils.ts"],"sourcesContent":["import type { Span, TransactionSource } from '@sentry/core';\nimport { debug, getActiveSpan, getRootSpan, spanToJSON } from '@sentry/core';\nimport { DEBUG_BUILD } from '../debug-build';\nimport type { Location, MatchRoutes, RouteMatch, RouteObject } from '../types';\nimport { matchRouteManifest, stripBasenameFromPathname } from './route-manifest';\nimport { SENTRY_OP } from '@sentry/conventions/attributes';\n\n// Global variables that these utilities depend on\nlet _matchRoutes: MatchRoutes;\nlet _stripBasename: boolean = false;\n\n// Navigation context stack for nested/concurrent patchRoutesOnNavigation calls.\n// Required because window.location hasn't updated yet when handlers are invoked.\ninterface NavigationContext {\n token: object;\n targetPath: string | undefined;\n span: Span | undefined;\n}\n\nconst _navigationContextStack: NavigationContext[] = [];\nconst MAX_CONTEXT_STACK_SIZE = 10;\n\n/**\n * Pushes a navigation context and returns a unique token for cleanup.\n * The token uses object identity for uniqueness (no counter needed).\n */\nexport function setNavigationContext(targetPath: string | undefined, span: Span | undefined): object {\n const token = {};\n // Prevent unbounded stack growth - oldest (likely stale) contexts are evicted first\n if (_navigationContextStack.length >= MAX_CONTEXT_STACK_SIZE) {\n DEBUG_BUILD && debug.warn('[React Router] Navigation context stack overflow - removing oldest context');\n _navigationContextStack.shift();\n }\n _navigationContextStack.push({ token, targetPath, span });\n return token;\n}\n\n/**\n * Clears the navigation context if it's on top of the stack (LIFO).\n * If our context is not on top (out-of-order completion), we leave it -\n * it will be cleaned up by overflow protection when the stack fills up.\n */\nexport function clearNavigationContext(token: object): void {\n const top = _navigationContextStack[_navigationContextStack.length - 1];\n if (top?.token === token) {\n _navigationContextStack.pop();\n }\n}\n\n/** Gets the current (most recent) navigation context if inside a patchRoutesOnNavigation call. */\nexport function getNavigationContext(): NavigationContext | null {\n const length = _navigationContextStack.length;\n // The `?? null` converts undefined (from array access) to null to match return type\n return length > 0 ? (_navigationContextStack[length - 1] ?? null) : null;\n}\n\n/**\n * Initialize function to set dependencies that the router utilities need.\n * Must be called before using any of the exported utility functions.\n */\nexport function initializeRouterUtils(matchRoutes: MatchRoutes, stripBasename: boolean = false): void {\n _matchRoutes = matchRoutes;\n _stripBasename = stripBasename;\n}\n\n// Helper functions\nfunction pickPath(match: RouteMatch): string {\n return trimWildcard(match.route.path || '');\n}\n\nfunction pickSplat(match: RouteMatch): string {\n return match.params['*'] || '';\n}\n\nfunction trimWildcard(path: string): string {\n return path[path.length - 1] === '*' ? path.slice(0, -1) : path;\n}\n\nfunction trimSlash(path: string): string {\n return path[path.length - 1] === '/' ? path.slice(0, -1) : path;\n}\n\n/**\n * Checks if a path ends with a wildcard character (*).\n */\nexport function pathEndsWithWildcard(path: string): boolean {\n return path.endsWith('*');\n}\n\n/** Checks if transaction name has wildcard (/* or ends with *). */\nexport function transactionNameHasWildcard(name: string): boolean {\n return name.includes('/*') || name.endsWith('*');\n}\n\n/**\n * Checks if a path is a wildcard and has child routes.\n */\nexport function pathIsWildcardAndHasChildren(path: string, branch: RouteMatch<string>): boolean {\n return (pathEndsWithWildcard(path) && !!branch.route.children?.length) || false;\n}\n\n/** Check if route is in descendant route (<Routes> within <Routes>) */\nexport function routeIsDescendant(route: RouteObject): boolean {\n return !!(!route.children && route.element && route.path?.endsWith('/*'));\n}\n\nfunction sendIndexPath(pathBuilder: string, pathname: string, basename: string): [string, TransactionSource] {\n const reconstructedPath =\n pathBuilder && pathBuilder.length > 0\n ? pathBuilder\n : _stripBasename\n ? stripBasenameFromPathname(pathname, basename)\n : pathname;\n\n let formattedPath =\n // If the path ends with a wildcard suffix, remove both the slash and the asterisk\n reconstructedPath.slice(-2) === '/*' ? reconstructedPath.slice(0, -2) : reconstructedPath;\n\n // If the path ends with a slash, remove it (but keep single '/')\n if (formattedPath.length > 1 && formattedPath[formattedPath.length - 1] === '/') {\n formattedPath = formattedPath.slice(0, -1);\n }\n\n return [formattedPath, 'route'];\n}\n\n/**\n * Returns the number of URL segments in the given URL string.\n * Splits at '/' or '\\/' to handle regex URLs correctly.\n *\n * @param url - The URL string to segment.\n * @returns The number of segments in the URL.\n */\nexport function getNumberOfUrlSegments(url: string): number {\n // split at '/' or at '\\/' to split regex urls correctly\n return url.split(/\\\\?\\//).filter(s => s.length > 0 && s !== ',').length;\n}\n\n// Exported utility functions\n\n/**\n * Ensures a path string starts with a forward slash.\n */\nexport function prefixWithSlash(path: string): string {\n return path[0] === '/' ? path : `/${path}`;\n}\n\n/**\n * Rebuilds the route path from all available routes by matching against the current location.\n */\nexport function rebuildRoutePathFromAllRoutes(allRoutes: RouteObject[], location: Location): string {\n const matchedRoutes = _matchRoutes(allRoutes, location) as RouteMatch[];\n\n if (!matchedRoutes || matchedRoutes.length === 0) {\n return '';\n }\n\n for (const match of matchedRoutes) {\n if (match.route.path && match.route.path !== '*') {\n const path = pickPath(match);\n const strippedPath = stripBasenameFromPathname(location.pathname, prefixWithSlash(match.pathnameBase));\n\n if (location.pathname === strippedPath) {\n return trimSlash(strippedPath);\n }\n\n return trimSlash(\n trimSlash(path || '') +\n prefixWithSlash(\n rebuildRoutePathFromAllRoutes(\n allRoutes.filter(route => route !== match.route),\n {\n pathname: strippedPath,\n },\n ),\n ),\n );\n }\n }\n\n return '';\n}\n\n/**\n * Recovers the parent prefix for descendant `<Routes>` names.\n *\n * `allRoutes` flattens every mounted `<Routes>` into one set, so an orphaned descendant subtree can\n * outscore the `.../*` route that anchors the location and drop its prefix (e.g. `/:id/:sub` instead of `/child/:id`).\n * Matching only the descendant-parent routes recovers the true anchor.\n */\nfunction reconstructNameFromDescendantParent(\n location: Location,\n allRoutes: RouteObject[],\n currentName: string | undefined,\n): string | undefined {\n const descendantParents = allRoutes.filter(routeIsDescendant);\n if (!descendantParents.length) {\n return undefined;\n }\n\n const matchedParents = _matchRoutes(descendantParents, location) as RouteMatch[] | null;\n const parentMatch = matchedParents?.[matchedParents.length - 1];\n if (!parentMatch || !pickSplat(parentMatch)) {\n return undefined;\n }\n\n const parentTemplate = trimSlash(trimWildcard(parentMatch.route.path || ''));\n\n if (!parentTemplate) {\n return undefined;\n }\n\n const expectedPrefix = prefixWithSlash(parentTemplate);\n\n // Child `<Routes>` resolve against the matched parent, but flattened route matching can already retain\n // a dynamic leading parameter. Adding the parent again would duplicate it (e.g. `/:id/:id`)\n const firstElement = parentTemplate.split('/')[0];\n const hasDynamicLead = firstElement?.startsWith(':') && currentName?.split('/').includes(firstElement);\n\n // Rebuild only when matching the descendant subtree discarded its parent route template\n if (currentName === expectedPrefix || currentName?.startsWith(`${expectedPrefix}/`) || hasDynamicLead) {\n return undefined;\n }\n\n const remainingPathname =\n stripBasenameFromPathname(location.pathname, prefixWithSlash(parentMatch.pathnameBase)) || '/';\n const remainingName = rebuildRoutePathFromAllRoutes(\n allRoutes.filter(route => route !== parentMatch.route),\n { pathname: remainingPathname },\n );\n\n return remainingName ? prefixWithSlash(`${parentTemplate}${prefixWithSlash(remainingName)}`) : undefined;\n}\n\n/**\n * Checks if the current location is inside a descendant route (route with splat parameter).\n */\nexport function locationIsInsideDescendantRoute(location: Location, routes: RouteObject[]): boolean {\n const matchedRoutes = _matchRoutes(routes, location) as RouteMatch[];\n\n if (matchedRoutes) {\n for (const match of matchedRoutes) {\n if (routeIsDescendant(match.route) && pickSplat(match)) {\n return true;\n }\n }\n }\n\n return false;\n}\n\n/**\n * Returns a fallback transaction name from location pathname.\n */\nfunction getFallbackTransactionName(location: Location, basename: string): string {\n return _stripBasename ? stripBasenameFromPathname(location.pathname, basename) : location.pathname || '';\n}\n\n/**\n * Gets a normalized route name and transaction source from the current routes and location.\n */\nexport function getNormalizedName(\n routes: RouteObject[],\n location: Location,\n branches: RouteMatch[],\n basename: string = '',\n): [string, TransactionSource] {\n if (!routes || routes.length === 0) {\n return [_stripBasename ? stripBasenameFromPathname(location.pathname, basename) : location.pathname, 'url'];\n }\n\n if (!branches) {\n return [getFallbackTransactionName(location, basename), 'url'];\n }\n\n let pathBuilder = '';\n\n for (const branch of branches) {\n const route = branch.route;\n if (!route) {\n continue;\n }\n\n // Early return for index routes\n if (route.index) {\n return sendIndexPath(pathBuilder, branch.pathname, basename);\n }\n\n const path = route.path;\n if (!path || pathIsWildcardAndHasChildren(path, branch)) {\n continue;\n }\n\n // Build the route path\n const newPath = path[0] === '/' || pathBuilder[pathBuilder.length - 1] === '/' ? path : `/${path}`;\n pathBuilder = trimSlash(pathBuilder) + prefixWithSlash(newPath);\n\n // Check if this path matches the current location\n if (trimSlash(location.pathname) !== trimSlash(basename + branch.pathname)) {\n continue;\n }\n\n // Check if this is a parameterized route like /stores/:storeId/products/:productId\n if (\n getNumberOfUrlSegments(pathBuilder) !== getNumberOfUrlSegments(branch.pathname) &&\n !pathEndsWithWildcard(pathBuilder)\n ) {\n return [(_stripBasename ? '' : basename) + newPath, 'route'];\n }\n\n // Handle wildcard routes with children - strip trailing wildcard\n if (pathIsWildcardAndHasChildren(pathBuilder, branch)) {\n pathBuilder = pathBuilder.slice(0, -1);\n }\n\n return [(_stripBasename ? '' : basename) + pathBuilder, 'route'];\n }\n\n // Fallback when no matching route found\n return [getFallbackTransactionName(location, basename), 'url'];\n}\n\n/**\n * Shared helper function to resolve route name and source\n */\nexport function resolveRouteNameAndSource(\n location: Location,\n routes: RouteObject[],\n allRoutes: RouteObject[],\n branches: RouteMatch[],\n basename: string = '',\n lazyRouteManifest?: string[],\n enableAsyncRouteHandlers?: boolean,\n): [string, TransactionSource] {\n // When lazy route manifest is provided, use it as the primary source for transaction names\n if (enableAsyncRouteHandlers && lazyRouteManifest && lazyRouteManifest.length > 0) {\n const manifestMatch = matchRouteManifest(location.pathname, lazyRouteManifest, basename);\n if (manifestMatch) {\n return [(_stripBasename ? '' : basename) + manifestMatch, 'route'];\n }\n }\n\n // Fall back to React Router route matching\n let name: string | undefined;\n let source: TransactionSource = 'url';\n\n const isInDescendantRoute = locationIsInsideDescendantRoute(location, allRoutes);\n\n if (isInDescendantRoute) {\n name = prefixWithSlash(rebuildRoutePathFromAllRoutes(allRoutes, location));\n source = 'route';\n }\n\n if (!isInDescendantRoute || !name) {\n [name, source] = getNormalizedName(routes, location, branches, basename);\n }\n\n // Guard against orphaned descendant subtrees stealing the transaction name: if the location is\n // anchored by a descendant-parent route (`.../*`) whose prefix was dropped, reconstruct with it.\n const anchoredName = reconstructNameFromDescendantParent(location, allRoutes, name);\n if (anchoredName) {\n return [anchoredName, 'route'];\n }\n\n return [name || location.pathname, source];\n}\n\n/**\n * Gets the active root span if it's a pageload or navigation span.\n */\nexport function getActiveRootSpan(): Span | undefined {\n const span = getActiveSpan();\n const rootSpan = span ? getRootSpan(span) : undefined;\n\n if (!rootSpan) {\n return undefined;\n }\n\n const op = spanToJSON(rootSpan).attributes[SENTRY_OP];\n\n // Only use this root span if it is a pageload or navigation span\n return op === 'navigation' || op === 'pageload' ? rootSpan : undefined;\n}\n"],"names":["DEBUG_BUILD","debug","stripBasenameFromPathname","matchRouteManifest","getActiveSpan","getRootSpan","spanToJSON","SENTRY_OP"],"mappings":";;;;;;;AAQA,IAAI,YAAA;AACJ,IAAI,cAAA,GAA0B,KAAA;AAU9B,MAAM,0BAA+C,EAAC;AACtD,MAAM,sBAAA,GAAyB,EAAA;AAMxB,SAAS,oBAAA,CAAqB,YAAgC,IAAA,EAAgC;AACnG,EAAA,MAAM,QAAQ,EAAC;AAEf,EAAA,IAAI,uBAAA,CAAwB,UAAU,sBAAA,EAAwB;AAC5D,IAAAA,sBAAA,IAAeC,UAAA,CAAM,KAAK,4EAA4E,CAAA;AACtG,IAAA,uBAAA,CAAwB,KAAA,EAAM;AAAA,EAChC;AACA,EAAA,uBAAA,CAAwB,IAAA,CAAK,EAAE,KAAA,EAAO,UAAA,EAAY,MAAM,CAAA;AACxD,EAAA,OAAO,KAAA;AACT;AAOO,SAAS,uBAAuB,KAAA,EAAqB;AAC1D,EAAA,MAAM,GAAA,GAAM,uBAAA,CAAwB,uBAAA,CAAwB,MAAA,GAAS,CAAC,CAAA;AACtE,EAAA,IAAI,GAAA,EAAK,UAAU,KAAA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Aa,QAAA,GAAW,MAAA;AAC/D;;;;;;;;;;;;;;;;;;"}
@@ -1,9 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const instrumentation = require('./reactrouter-compat-utils/instrumentation.js');
4
- require('@sentry/core/browser');
5
- require('@sentry/browser');
6
- require('@sentry/core');
7
4
 
8
5
  function reactRouterBrowserTracingIntegration(options) {
9
6
  return instrumentation.createReactRouterV6CompatibleTracingIntegration(options, "");
@@ -1 +1 @@
1
- {"version":3,"file":"reactrouter.compat.js","sources":["../../src/reactrouter.compat.tsx"],"sourcesContent":["import type { browserTracingIntegration } from '@sentry/browser';\nimport type { Integration } from '@sentry/core';\nimport type { ReactRouterOptions } from './reactrouter-compat-utils';\nimport {\n createReactRouterV6CompatibleTracingIntegration,\n createV6CompatibleWithSentryReactRouterRouting,\n createV6CompatibleWrapCreateBrowserRouter,\n createV6CompatibleWrapCreateMemoryRouter,\n createV6CompatibleWrapUseRoutes,\n} from './reactrouter-compat-utils';\nimport type { CreateRouterFunction, Router, RouterState, UseRoutes } from './types';\n\n/**\n * A browser tracing integration that uses React Router to instrument navigations.\n * Expects `useEffect`, `useLocation`, `useNavigationType`, `createRoutesFromChildren` and `matchRoutes` to be passed as options.\n *\n * Works with React Router v6+.\n */\nexport function reactRouterBrowserTracingIntegration(\n options: Parameters<typeof browserTracingIntegration>[0] & ReactRouterOptions,\n): Integration {\n return createReactRouterV6CompatibleTracingIntegration(options, '');\n}\n\n/**\n * A higher-order component that adds Sentry routing instrumentation to a React Router Route component.\n * This is used to automatically capture route changes as transactions.\n *\n * Works with React Router v6+.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function wrapReactRouterRouting<P extends Record<string, any>, R extends React.FC<P>>(routes: R): R {\n return createV6CompatibleWithSentryReactRouterRouting<P, R>(routes, '');\n}\n\n/**\n * A wrapper function that adds Sentry routing instrumentation to a React Router createBrowserRouter function.\n * This is used to automatically capture route changes as transactions when using the createBrowserRouter API.\n *\n * Works with React Router v6+.\n */\nexport function wrapCreateBrowserRouter<\n TState extends RouterState = RouterState,\n TRouter extends Router<TState> = Router<TState>,\n>(createRouterFunction: CreateRouterFunction<TState, TRouter>): CreateRouterFunction<TState, TRouter> {\n return createV6CompatibleWrapCreateBrowserRouter(createRouterFunction, '');\n}\n\n/**\n * A wrapper function that adds Sentry routing instrumentation to a React Router createMemoryRouter function.\n * This is used to automatically capture route changes as transactions when using the createMemoryRouter API.\n * The difference between createBrowserRouter and createMemoryRouter is that with createMemoryRouter,\n * optional `initialEntries` are also taken into account.\n *\n * Works with React Router v6+.\n */\nexport function wrapCreateMemoryRouter<\n TState extends RouterState = RouterState,\n TRouter extends Router<TState> = Router<TState>,\n>(createMemoryRouterFunction: CreateRouterFunction<TState, TRouter>): CreateRouterFunction<TState, TRouter> {\n return createV6CompatibleWrapCreateMemoryRouter(createMemoryRouterFunction, '');\n}\n\n/**\n * A wrapper function that adds Sentry routing instrumentation to a React Router useRoutes hook.\n * This is used to automatically capture route changes as transactions when using the useRoutes hook.\n *\n * Works with React Router v6+.\n */\nexport function wrapUseRoutes(origUseRoutes: UseRoutes): UseRoutes {\n return createV6CompatibleWrapUseRoutes(origUseRoutes, '');\n}\n"],"names":["createReactRouterV6CompatibleTracingIntegration","createV6CompatibleWithSentryReactRouterRouting","createV6CompatibleWrapCreateBrowserRouter","createV6CompatibleWrapCreateMemoryRouter","createV6CompatibleWrapUseRoutes"],"mappings":";;;;;;;AAkBO,SAAS,qCACd,OAAA,EACa;AACb,EAAA,OAAOA,+DAAA,CAAgD,SAAS,EAAE,CAAA;AACpE;AASO,SAAS,uBAA6E,MAAA,EAAc;AACzG,EAAA,OAAOC,8DAAA,CAAqD,QAAQ,EAAE,CAAA;AACxE;AAQO,SAAS,wBAGd,oBAAA,EAAoG;AACpG,EAAA,OAAOC,yDAAA,CAA0C,sBAAsB,EAAE,CAAA;AAC3E;AAUO,SAAS,uBAGd,0BAAA,EAA0G;AAC1G,EAAA,OAAOC,wDAAA,CAAyC,4BAA4B,EAAE,CAAA;AAChF;AAQO,SAAS,cAAc,aAAA,EAAqC;AACjE,EAAA,OAAOC,+CAAA,CAAgC,eAAe,EAAE,CAAA;AAC1D;;;;;;;;"}
1
+ {"version":3,"file":"reactrouter.compat.js","sources":["../../src/reactrouter.compat.tsx"],"sourcesContent":["import type { browserTracingIntegration } from '@sentry/browser';\nimport type { Integration } from '@sentry/core';\nimport type { ReactRouterOptions } from './reactrouter-compat-utils';\nimport {\n createReactRouterV6CompatibleTracingIntegration,\n createV6CompatibleWithSentryReactRouterRouting,\n createV6CompatibleWrapCreateBrowserRouter,\n createV6CompatibleWrapCreateMemoryRouter,\n createV6CompatibleWrapUseRoutes,\n} from './reactrouter-compat-utils';\nimport type { CreateRouterFunction, Router, RouterState, UseRoutes } from './types';\n\n/**\n * A browser tracing integration that uses React Router to instrument navigations.\n * Expects `useEffect`, `useLocation`, `useNavigationType`, `createRoutesFromChildren` and `matchRoutes` to be passed as options.\n *\n * Works with React Router v6+.\n */\nexport function reactRouterBrowserTracingIntegration(\n options: Parameters<typeof browserTracingIntegration>[0] & ReactRouterOptions,\n): Integration {\n return createReactRouterV6CompatibleTracingIntegration(options, '');\n}\n\n/**\n * A higher-order component that adds Sentry routing instrumentation to a React Router Route component.\n * This is used to automatically capture route changes as transactions.\n *\n * Works with React Router v6+.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function wrapReactRouterRouting<P extends Record<string, any>, R extends React.FC<P>>(routes: R): R {\n return createV6CompatibleWithSentryReactRouterRouting<P, R>(routes, '');\n}\n\n/**\n * A wrapper function that adds Sentry routing instrumentation to a React Router createBrowserRouter function.\n * This is used to automatically capture route changes as transactions when using the createBrowserRouter API.\n *\n * Works with React Router v6+.\n */\nexport function wrapCreateBrowserRouter<\n TState extends RouterState = RouterState,\n TRouter extends Router<TState> = Router<TState>,\n>(createRouterFunction: CreateRouterFunction<TState, TRouter>): CreateRouterFunction<TState, TRouter> {\n return createV6CompatibleWrapCreateBrowserRouter(createRouterFunction, '');\n}\n\n/**\n * A wrapper function that adds Sentry routing instrumentation to a React Router createMemoryRouter function.\n * This is used to automatically capture route changes as transactions when using the createMemoryRouter API.\n * The difference between createBrowserRouter and createMemoryRouter is that with createMemoryRouter,\n * optional `initialEntries` are also taken into account.\n *\n * Works with React Router v6+.\n */\nexport function wrapCreateMemoryRouter<\n TState extends RouterState = RouterState,\n TRouter extends Router<TState> = Router<TState>,\n>(createMemoryRouterFunction: CreateRouterFunction<TState, TRouter>): CreateRouterFunction<TState, TRouter> {\n return createV6CompatibleWrapCreateMemoryRouter(createMemoryRouterFunction, '');\n}\n\n/**\n * A wrapper function that adds Sentry routing instrumentation to a React Router useRoutes hook.\n * This is used to automatically capture route changes as transactions when using the useRoutes hook.\n *\n * Works with React Router v6+.\n */\nexport function wrapUseRoutes(origUseRoutes: UseRoutes): UseRoutes {\n return createV6CompatibleWrapUseRoutes(origUseRoutes, '');\n}\n"],"names":["createReactRouterV6CompatibleTracingIntegration","createV6CompatibleWithSentryReactRouterRouting","createV6CompatibleWrapCreateBrowserRouter","createV6CompatibleWrapCreateMemoryRouter","createV6CompatibleWrapUseRoutes"],"mappings":";;;;AAkBO,SAAS,qCACd,OAAA,EACa;AACb,EAAA,OAAOA,+DAAA,CAAgD,SAAS,EAAE,CAAA;AACpE;AASO,SAAS,uBAA6E,MAAA,EAAc;AACzG,EAAA,OAAOC,8DAAA,CAAqD,QAAQ,EAAE,CAAA;AACxE;AAQO,SAAS,wBAGd,oBAAA,EAAoG;AACpG,EAAA,OAAOC,yDAAA,CAA0C,sBAAsB,EAAE,CAAA;AAC3E;AAUO,SAAS,uBAGd,0BAAA,EAA0G;AAC1G,EAAA,OAAOC,wDAAA,CAAyC,4BAA4B,EAAE,CAAA;AAChF;AAQO,SAAS,cAAc,aAAA,EAAqC;AACjE,EAAA,OAAOC,+CAAA,CAAgC,eAAe,EAAE,CAAA;AAC1D;;;;;;;;"}
@@ -5,6 +5,7 @@ const core = require('@sentry/core');
5
5
  const React = require('react');
6
6
  const hoistNonReactStatics = require('./hoist-non-react-statics.js');
7
7
  const attributes = require('@sentry/conventions/attributes');
8
+ const op = require('@sentry/conventions/op');
8
9
 
9
10
  function reactRouterV4BrowserTracingIntegration(options) {
10
11
  const integration = browser.browserTracingIntegration({
@@ -79,11 +80,12 @@ function instrumentReactRouter(client, instrumentPageLoad, instrumentNavigation,
79
80
  if (initPathName) {
80
81
  const [name, source] = normalizeTransactionName(initPathName);
81
82
  browser.startBrowserTracingPageLoadSpan(client, {
82
- name,
83
+ // With span streaming, span names have to be low cardinality, so we can't fall back to the URL.
84
+ name: source === "route" || !core.hasSpanStreamingEnabled(client) ? name : core.PAGELOAD_SPAN_NAME_FALLBACK,
83
85
  attributes: {
84
- [core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: "pageload",
86
+ [attributes.SENTRY_OP]: op.PAGELOAD,
85
87
  [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.pageload.react.${instrumentationName}`,
86
- [core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,
88
+ [attributes.SENTRY_SEGMENT_NAME_SOURCE]: source,
87
89
  ...source === "route" && { [attributes.URL_TEMPLATE]: name }
88
90
  }
89
91
  });
@@ -94,11 +96,12 @@ function instrumentReactRouter(client, instrumentPageLoad, instrumentNavigation,
94
96
  if (action && (action === "PUSH" || action === "POP")) {
95
97
  const [name, source] = normalizeTransactionName(location.pathname);
96
98
  browser.startBrowserTracingNavigationSpan(client, {
97
- name,
99
+ // With span streaming, span names have to be low cardinality, so we can't fall back to the URL.
100
+ name: source === "route" || !core.hasSpanStreamingEnabled(client) ? name : core.NAVIGATION_SPAN_NAME_FALLBACK,
98
101
  attributes: {
99
- [core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: "navigation",
102
+ [attributes.SENTRY_OP]: op.NAVIGATION,
100
103
  [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.navigation.react.${instrumentationName}`,
101
- [core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,
104
+ [attributes.SENTRY_SEGMENT_NAME_SOURCE]: source,
102
105
  ...source === "route" && { [attributes.URL_TEMPLATE]: name }
103
106
  }
104
107
  });
@@ -135,7 +138,7 @@ function withSentryRouting(Route) {
135
138
  if (activeRootSpan) {
136
139
  activeRootSpan.updateName(route);
137
140
  activeRootSpan.setAttributes({
138
- [core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: "route",
141
+ [attributes.SENTRY_SEGMENT_NAME_SOURCE]: "route",
139
142
  [attributes.URL_TEMPLATE]: route
140
143
  });
141
144
  }
@@ -1 +1 @@
1
- {"version":3,"file":"reactrouter.js","sources":["../../src/reactrouter.tsx"],"sourcesContent":["import {\n browserTracingIntegration,\n startBrowserTracingNavigationSpan,\n startBrowserTracingPageLoadSpan,\n WINDOW,\n} from '@sentry/browser';\nimport type { Client, Integration, Span, TransactionSource } from '@sentry/core';\nimport {\n getActiveSpan,\n getCurrentScope,\n getRootSpan,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n spanToJSON,\n} from '@sentry/core';\nimport type { ReactElement } from 'react';\nimport * as React from 'react';\nimport { hoistNonReactStatics } from './hoist-non-react-statics';\nimport type { Action, Location } from './types';\nimport { URL_TEMPLATE } from '@sentry/conventions/attributes';\n\n// We need to disable eslint no-explicit-any because any is required for the\n// react-router typings.\ntype Match = { path: string; url: string; params: Record<string, any>; isExact: boolean }; // eslint-disable-line @typescript-eslint/no-explicit-any\n\nexport type RouterHistory = {\n location?: Location;\n listen?(cb: (location: Location, action: Action) => void): void;\n} & Record<string, any>; // eslint-disable-line @typescript-eslint/no-explicit-any\n\nexport type RouteConfig = {\n [propName: string]: unknown;\n path?: string | string[];\n exact?: boolean;\n component?: ReactElement;\n routes?: RouteConfig[];\n};\n\nexport type MatchPath = (pathname: string, props: string | string[] | any, parent?: Match | null) => Match | null; // eslint-disable-line @typescript-eslint/no-explicit-any\n\ninterface ReactRouterOptions {\n history: RouterHistory;\n routes?: RouteConfig[];\n matchPath?: MatchPath;\n}\n\n/**\n * A browser tracing integration that uses React Router v4 to instrument navigations.\n * Expects `history` (and optionally `routes` and `matchPath`) to be passed as options.\n */\nexport function reactRouterV4BrowserTracingIntegration(\n options: Parameters<typeof browserTracingIntegration>[0] & ReactRouterOptions,\n): Integration {\n const integration = browserTracingIntegration({\n ...options,\n instrumentPageLoad: false,\n instrumentNavigation: false,\n });\n\n const { history, routes, matchPath, instrumentPageLoad = true, instrumentNavigation = true } = options;\n\n return {\n ...integration,\n afterAllSetup(client) {\n integration.afterAllSetup(client);\n\n instrumentReactRouter(\n client,\n instrumentPageLoad,\n instrumentNavigation,\n history,\n 'reactrouter_v4',\n routes,\n matchPath,\n );\n },\n };\n}\n\n/**\n * A browser tracing integration that uses React Router v5 to instrument navigations.\n * Expects `history` (and optionally `routes` and `matchPath`) to be passed as options.\n */\nexport function reactRouterV5BrowserTracingIntegration(\n options: Parameters<typeof browserTracingIntegration>[0] & ReactRouterOptions,\n): Integration {\n const integration = browserTracingIntegration({\n ...options,\n instrumentPageLoad: false,\n instrumentNavigation: false,\n });\n\n const { history, routes, matchPath, instrumentPageLoad = true, instrumentNavigation = true } = options;\n\n return {\n ...integration,\n afterAllSetup(client) {\n integration.afterAllSetup(client);\n\n instrumentReactRouter(\n client,\n instrumentPageLoad,\n instrumentNavigation,\n history,\n 'reactrouter_v5',\n routes,\n matchPath,\n );\n },\n };\n}\n\nfunction instrumentReactRouter(\n client: Client,\n instrumentPageLoad: boolean,\n instrumentNavigation: boolean,\n history: RouterHistory,\n instrumentationName: string,\n allRoutes: RouteConfig[] = [],\n matchPath?: MatchPath,\n): void {\n function getInitPathName(): string | undefined {\n if (history.location) {\n return history.location.pathname;\n }\n\n if (WINDOW.location) {\n return WINDOW.location.pathname;\n }\n\n return undefined;\n }\n\n /**\n * Normalizes a transaction name. Returns the new name as well as the\n * source of the transaction.\n *\n * @param pathname The initial pathname we normalize\n */\n function normalizeTransactionName(pathname: string): [string, TransactionSource] {\n if (allRoutes.length === 0 || !matchPath) {\n return [pathname, 'url'];\n }\n\n const branches = matchRoutes(allRoutes, pathname, matchPath);\n for (const branch of branches) {\n if (branch.match.isExact) {\n return [branch.match.path, 'route'];\n }\n }\n\n return [pathname, 'url'];\n }\n\n if (instrumentPageLoad) {\n const initPathName = getInitPathName();\n if (initPathName) {\n const [name, source] = normalizeTransactionName(initPathName);\n startBrowserTracingPageLoadSpan(client, {\n name,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.pageload.react.${instrumentationName}`,\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,\n ...(source === 'route' && { [URL_TEMPLATE]: name }),\n },\n });\n }\n }\n\n if (instrumentNavigation && history.listen) {\n history.listen((location, action) => {\n if (action && (action === 'PUSH' || action === 'POP')) {\n const [name, source] = normalizeTransactionName(location.pathname);\n startBrowserTracingNavigationSpan(client, {\n name,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.navigation.react.${instrumentationName}`,\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,\n ...(source === 'route' && { [URL_TEMPLATE]: name }),\n },\n });\n }\n });\n }\n}\n\n/**\n * Matches a set of routes to a pathname\n * Based on implementation from\n */\nfunction matchRoutes(\n routes: RouteConfig[],\n pathname: string,\n matchPath: MatchPath,\n branch: Array<{ route: RouteConfig; match: Match }> = [],\n): Array<{ route: RouteConfig; match: Match }> {\n routes.some(route => {\n const match = route.path\n ? matchPath(pathname, route)\n : branch.length\n ? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n branch[branch.length - 1]!.match // use parent match\n : computeRootMatch(pathname); // use default \"root\" match\n\n if (match) {\n branch.push({ route, match });\n\n if (route.routes) {\n matchRoutes(route.routes, pathname, matchPath, branch);\n }\n }\n\n return !!match;\n });\n\n return branch;\n}\n\nfunction computeRootMatch(pathname: string): Match {\n return { path: '/', url: '/', params: {}, isExact: pathname === '/' };\n}\n\n/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */\nexport function withSentryRouting<P extends Record<string, any>, R extends React.ComponentType<P>>(Route: R): R {\n const componentDisplayName = Route.displayName || Route.name;\n\n const WrappedRoute: React.FC<P> = (props: P) => {\n if (props?.computedMatch?.isExact) {\n const route = props.computedMatch.path;\n const activeRootSpan = getActiveRootSpan();\n\n getCurrentScope().setTransactionName(route);\n\n if (activeRootSpan) {\n activeRootSpan.updateName(route);\n activeRootSpan.setAttributes({\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',\n [URL_TEMPLATE]: route,\n });\n }\n }\n\n // @ts-expect-error Setting more specific React Component typing for `R` generic above\n // will break advanced type inference done by react router params:\n // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/13dc4235c069e25fe7ee16e11f529d909f9f3ff8/types/react-router/index.d.ts#L154-L164\n return <Route {...props} />;\n };\n\n WrappedRoute.displayName = `sentryRoute(${componentDisplayName})`;\n hoistNonReactStatics(WrappedRoute, Route);\n // @ts-expect-error Setting more specific React Component typing for `R` generic above\n // will break advanced type inference done by react router params:\n // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/13dc4235c069e25fe7ee16e11f529d909f9f3ff8/types/react-router/index.d.ts#L154-L164\n return WrappedRoute;\n}\n/* eslint-enable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */\n\nfunction getActiveRootSpan(): Span | undefined {\n const span = getActiveSpan();\n const rootSpan = span && getRootSpan(span);\n\n if (!rootSpan) {\n return undefined;\n }\n\n const op = spanToJSON(rootSpan).attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP];\n\n // Only use this root span if it is a pageload or navigation span\n return op === 'navigation' || op === 'pageload' ? rootSpan : undefined;\n}\n"],"names":["browserTracingIntegration","WINDOW","startBrowserTracingPageLoadSpan","SEMANTIC_ATTRIBUTE_SENTRY_OP","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","URL_TEMPLATE","startBrowserTracingNavigationSpan","getCurrentScope","hoistNonReactStatics","getActiveSpan","getRootSpan","spanToJSON"],"mappings":";;;;;;;;AAmDO,SAAS,uCACd,OAAA,EACa;AACb,EAAA,MAAM,cAAcA,iCAAA,CAA0B;AAAA,IAC5C,GAAG,OAAA;AAAA,IACH,kBAAA,EAAoB,KAAA;AAAA,IACpB,oBAAA,EAAsB;AAAA,GACvB,CAAA;AAED,EAAA,MAAM,EAAE,SAAS,MAAA,EAAQ,SAAA,EAAW,qBAAqB,IAAA,EAAM,oBAAA,GAAuB,MAAK,GAAI,OAAA;AAE/F,EAAA,OAAO;AAAA,IACL,GAAG,WAAA;AAAA,IACH,cAAc,MAAA,EAAQ;AACpB,MAAA,WAAA,CAAY,cAAc,MAAM,CAAA;AAEhC,MAAA,qBAAA;AAAA,QACE,MAAA;AAAA,QACA,kBAAA;AAAA,QACA,oBAAA;AAAA,QACA,OAAA;AAAA,QACA,gBAAA;AAAA,QACA,MAAA;AAAA,QACA;AAAA,OACF;AAAA,IACF;AAAA,GACF;AACF;AAMO,SAAS,uCACd,OAAA,EACa;AACb,EAAA,MAAM,cAAcA,iCAAA,CAA0B;AAAA,IAC5C,GAAG,OAAA;AAAA,IACH,kBAAA,EAAoB,KAAA;AAAA,IACpB,oBAAA,EAAsB;AAAA,GACvB,CAAA;AAED,EAAA,MAAM,EAAE,SAAS,MAAA,EAAQ,SAAA,EAAW,qBAAqB,IAAA,EAAM,oBAAA,GAAuB,MAAK,GAAI,OAAA;AAE/F,EAAA,OAAO;AAAA,IACL,GAAG,WAAA;AAAA,IACH,cAAc,MAAA,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O,KAAA,CAAA,aAAA,CAAC,KAAA,EAAA,EAAO,GAAG,KAAA,EAAO,CAAA;AAAA,EAC3B,CAAA;AAEA,EAAA,YAAA,CAAa,WAAA,GAAc,eAAe,oBAAoB,CAAA,CAAA,CAAA;AAC9D,EAAAG,yCAAA,CAAqB,cAAc,KAAK,CAAA;AAIxC,EAAA,OAAO,YAAA;AACT;AAGA,SAAS,iBAAA,GAAsC;AAC7C,EAAA,MAAM,OAAOC,kBAAA,EAAc;AAC3B,EAAA,MAAM,QAAA,GAAW,IAAA,IAAQC,gBAAA,CAAY,IAAI,CAAA;AAEzC,EAAA,IAAI,CAAC,QAAA,EAAU;AACb,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,MAAM,EAAA,GAAKC,eAAA,CAAW,QAAQ,CAAA,CAAE,WAAWT,iCAA4B,CAAA;AAGvE,EAAA,OAAO,EAAA,KAAO,YAAA,IAAgB,EAAA,KAAO,UAAA,GAAa,QAAA,GAAW,MAAA;AAC/D;;;;;;"}
1
+ {"version":3,"file":"reactrouter.js","sources":["../../src/reactrouter.tsx"],"sourcesContent":["import {\n browserTracingIntegration,\n startBrowserTracingNavigationSpan,\n startBrowserTracingPageLoadSpan,\n WINDOW,\n} from '@sentry/browser';\nimport type { Client, Integration, Span, TransactionSource } from '@sentry/core';\nimport {\n getActiveSpan,\n getCurrentScope,\n getRootSpan,\n hasSpanStreamingEnabled,\n NAVIGATION_SPAN_NAME_FALLBACK,\n PAGELOAD_SPAN_NAME_FALLBACK,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n spanToJSON,\n} from '@sentry/core';\nimport type { ReactElement } from 'react';\nimport * as React from 'react';\nimport { hoistNonReactStatics } from './hoist-non-react-statics';\nimport type { Action, Location } from './types';\nimport { SENTRY_OP, SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes';\nimport { NAVIGATION, PAGELOAD } from '@sentry/conventions/op';\n\n// We need to disable eslint no-explicit-any because any is required for the\n// react-router typings.\ntype Match = { path: string; url: string; params: Record<string, any>; isExact: boolean }; // eslint-disable-line @typescript-eslint/no-explicit-any\n\nexport type RouterHistory = {\n location?: Location;\n listen?(cb: (location: Location, action: Action) => void): void;\n} & Record<string, any>; // eslint-disable-line @typescript-eslint/no-explicit-any\n\nexport type RouteConfig = {\n [propName: string]: unknown;\n path?: string | string[];\n exact?: boolean;\n component?: ReactElement;\n routes?: RouteConfig[];\n};\n\nexport type MatchPath = (pathname: string, props: string | string[] | any, parent?: Match | null) => Match | null; // eslint-disable-line @typescript-eslint/no-explicit-any\n\ninterface ReactRouterOptions {\n history: RouterHistory;\n routes?: RouteConfig[];\n matchPath?: MatchPath;\n}\n\n/**\n * A browser tracing integration that uses React Router v4 to instrument navigations.\n * Expects `history` (and optionally `routes` and `matchPath`) to be passed as options.\n */\nexport function reactRouterV4BrowserTracingIntegration(\n options: Parameters<typeof browserTracingIntegration>[0] & ReactRouterOptions,\n): Integration {\n const integration = browserTracingIntegration({\n ...options,\n instrumentPageLoad: false,\n instrumentNavigation: false,\n });\n\n const { history, routes, matchPath, instrumentPageLoad = true, instrumentNavigation = true } = options;\n\n return {\n ...integration,\n afterAllSetup(client) {\n integration.afterAllSetup(client);\n\n instrumentReactRouter(\n client,\n instrumentPageLoad,\n instrumentNavigation,\n history,\n 'reactrouter_v4',\n routes,\n matchPath,\n );\n },\n };\n}\n\n/**\n * A browser tracing integration that uses React Router v5 to instrument navigations.\n * Expects `history` (and optionally `routes` and `matchPath`) to be passed as options.\n */\nexport function reactRouterV5BrowserTracingIntegration(\n options: Parameters<typeof browserTracingIntegration>[0] & ReactRouterOptions,\n): Integration {\n const integration = browserTracingIntegration({\n ...options,\n instrumentPageLoad: false,\n instrumentNavigation: false,\n });\n\n const { history, routes, matchPath, instrumentPageLoad = true, instrumentNavigation = true } = options;\n\n return {\n ...integration,\n afterAllSetup(client) {\n integration.afterAllSetup(client);\n\n instrumentReactRouter(\n client,\n instrumentPageLoad,\n instrumentNavigation,\n history,\n 'reactrouter_v5',\n routes,\n matchPath,\n );\n },\n };\n}\n\nfunction instrumentReactRouter(\n client: Client,\n instrumentPageLoad: boolean,\n instrumentNavigation: boolean,\n history: RouterHistory,\n instrumentationName: string,\n allRoutes: RouteConfig[] = [],\n matchPath?: MatchPath,\n): void {\n function getInitPathName(): string | undefined {\n if (history.location) {\n return history.location.pathname;\n }\n\n if (WINDOW.location) {\n return WINDOW.location.pathname;\n }\n\n return undefined;\n }\n\n /**\n * Normalizes a transaction name. Returns the new name as well as the\n * source of the transaction.\n *\n * @param pathname The initial pathname we normalize\n */\n function normalizeTransactionName(pathname: string): [string, TransactionSource] {\n if (allRoutes.length === 0 || !matchPath) {\n return [pathname, 'url'];\n }\n\n const branches = matchRoutes(allRoutes, pathname, matchPath);\n for (const branch of branches) {\n if (branch.match.isExact) {\n return [branch.match.path, 'route'];\n }\n }\n\n return [pathname, 'url'];\n }\n\n if (instrumentPageLoad) {\n const initPathName = getInitPathName();\n if (initPathName) {\n const [name, source] = normalizeTransactionName(initPathName);\n startBrowserTracingPageLoadSpan(client, {\n // With span streaming, span names have to be low cardinality, so we can't fall back to the URL.\n name: source === 'route' || !hasSpanStreamingEnabled(client) ? name : PAGELOAD_SPAN_NAME_FALLBACK,\n attributes: {\n [SENTRY_OP]: PAGELOAD,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.pageload.react.${instrumentationName}`,\n [SENTRY_SEGMENT_NAME_SOURCE]: source,\n ...(source === 'route' && { [URL_TEMPLATE]: name }),\n },\n });\n }\n }\n\n if (instrumentNavigation && history.listen) {\n history.listen((location, action) => {\n if (action && (action === 'PUSH' || action === 'POP')) {\n const [name, source] = normalizeTransactionName(location.pathname);\n startBrowserTracingNavigationSpan(client, {\n // With span streaming, span names have to be low cardinality, so we can't fall back to the URL.\n name: source === 'route' || !hasSpanStreamingEnabled(client) ? name : NAVIGATION_SPAN_NAME_FALLBACK,\n attributes: {\n [SENTRY_OP]: NAVIGATION,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.navigation.react.${instrumentationName}`,\n [SENTRY_SEGMENT_NAME_SOURCE]: source,\n ...(source === 'route' && { [URL_TEMPLATE]: name }),\n },\n });\n }\n });\n }\n}\n\n/**\n * Matches a set of routes to a pathname\n * Based on implementation from\n */\nfunction matchRoutes(\n routes: RouteConfig[],\n pathname: string,\n matchPath: MatchPath,\n branch: Array<{ route: RouteConfig; match: Match }> = [],\n): Array<{ route: RouteConfig; match: Match }> {\n routes.some(route => {\n const match = route.path\n ? matchPath(pathname, route)\n : branch.length\n ? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n branch[branch.length - 1]!.match // use parent match\n : computeRootMatch(pathname); // use default \"root\" match\n\n if (match) {\n branch.push({ route, match });\n\n if (route.routes) {\n matchRoutes(route.routes, pathname, matchPath, branch);\n }\n }\n\n return !!match;\n });\n\n return branch;\n}\n\nfunction computeRootMatch(pathname: string): Match {\n return { path: '/', url: '/', params: {}, isExact: pathname === '/' };\n}\n\n/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */\nexport function withSentryRouting<P extends Record<string, any>, R extends React.ComponentType<P>>(Route: R): R {\n const componentDisplayName = Route.displayName || Route.name;\n\n const WrappedRoute: React.FC<P> = (props: P) => {\n if (props?.computedMatch?.isExact) {\n const route = props.computedMatch.path;\n const activeRootSpan = getActiveRootSpan();\n\n getCurrentScope().setTransactionName(route);\n\n if (activeRootSpan) {\n activeRootSpan.updateName(route);\n activeRootSpan.setAttributes({\n [SENTRY_SEGMENT_NAME_SOURCE]: 'route',\n [URL_TEMPLATE]: route,\n });\n }\n }\n\n // @ts-expect-error Setting more specific React Component typing for `R` generic above\n // will break advanced type inference done by react router params:\n // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/13dc4235c069e25fe7ee16e11f529d909f9f3ff8/types/react-router/index.d.ts#L154-L164\n return <Route {...props} />;\n };\n\n WrappedRoute.displayName = `sentryRoute(${componentDisplayName})`;\n hoistNonReactStatics(WrappedRoute, Route);\n // @ts-expect-error Setting more specific React Component typing for `R` generic above\n // will break advanced type inference done by react router params:\n // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/13dc4235c069e25fe7ee16e11f529d909f9f3ff8/types/react-router/index.d.ts#L154-L164\n return WrappedRoute;\n}\n/* eslint-enable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */\n\nfunction getActiveRootSpan(): Span | undefined {\n const span = getActiveSpan();\n const rootSpan = span && getRootSpan(span);\n\n if (!rootSpan) {\n return undefined;\n }\n\n const op = spanToJSON(rootSpan).attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP];\n\n // Only use this root span if it is a pageload or navigation span\n return op === 'navigation' || op === 'pageload' ? rootSpan : undefined;\n}\n"],"names":["browserTracingIntegration","WINDOW","startBrowserTracingPageLoadSpan","hasSpanStreamingEnabled","PAGELOAD_SPAN_NAME_FALLBACK","SENTRY_OP","PAGELOAD","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SENTRY_SEGMENT_NAME_SOURCE","URL_TEMPLATE","startBrowserTracingNavigationSpan","NAVIGATION_SPAN_NAME_FALLBACK","NAVIGATION","getCurrentScope","hoistNonReactStatics","getActiveSpan","getRootSpan","spanToJSON","SEMANTIC_ATTRIBUTE_SENTRY_OP"],"mappings":";;;;;;;;;AAsDO,SAAS,uCACd,OAAA,EACa;AACb,EAAA,MAAM,cAAcA,iCAAA,CAA0B;AAAA,IAC5C,GAAG,OAAA;AAAA,IACH,kBAAA,EAAoB,KAAA;AAAA,IACpB,oBAAA,EAAsB;AAAA,GACvB,CAAA;AAED,EAAA,MAAM,EAAE,SAAS,MAAA,EAAQ,SAAA,EAAW,qBAAqB,IAAA,EAAM,oBAAA,GAAuB,MAAK,GAAI,OAAA;AAE/F,EAAA,OAAO;AAAA,IACL,GAAG,WAAA;AAAA,IACH,cAAc,MAAA,EAAQ;A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WC,iCAA4B,CAAA;AAGvE,EAAA,OAAO,EAAA,KAAO,YAAA,IAAgB,EAAA,KAAO,UAAA,GAAa,QAAA,GAAW,MAAA;AAC/D;;;;;;"}
@@ -1,8 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const browser = require('@sentry/browser');
4
- const browser$1 = require('@sentry/core/browser');
4
+ const core = require('@sentry/core');
5
5
  const attributes = require('@sentry/conventions/attributes');
6
+ const op = require('@sentry/conventions/op');
6
7
 
7
8
  function reactRouterV3BrowserTracingIntegration(options) {
8
9
  const integration = browser.browserTracingIntegration({
@@ -22,11 +23,12 @@ function reactRouterV3BrowserTracingIntegration(options) {
22
23
  match,
23
24
  (localName, source = "url") => {
24
25
  browser.startBrowserTracingPageLoadSpan(client, {
25
- name: localName,
26
+ // With span streaming, span names have to be low cardinality, so we can't fall back to the URL.
27
+ name: source === "route" || !core.hasSpanStreamingEnabled(client) ? localName : core.PAGELOAD_SPAN_NAME_FALLBACK,
26
28
  attributes: {
27
- [browser$1.SEMANTIC_ATTRIBUTE_SENTRY_OP]: "pageload",
28
- [browser$1.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.pageload.react.reactrouter_v3",
29
- [browser$1.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,
29
+ [attributes.SENTRY_OP]: op.PAGELOAD,
30
+ [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.pageload.react.reactrouter_v3",
31
+ [attributes.SENTRY_SEGMENT_NAME_SOURCE]: source,
30
32
  ...source === "route" && { [attributes.URL_TEMPLATE]: localName }
31
33
  }
32
34
  });
@@ -42,11 +44,12 @@ function reactRouterV3BrowserTracingIntegration(options) {
42
44
  match,
43
45
  (localName, source = "url") => {
44
46
  browser.startBrowserTracingNavigationSpan(client, {
45
- name: localName,
47
+ // With span streaming, span names have to be low cardinality, so we can't fall back to the URL.
48
+ name: source === "route" || !core.hasSpanStreamingEnabled(client) ? localName : core.NAVIGATION_SPAN_NAME_FALLBACK,
46
49
  attributes: {
47
- [browser$1.SEMANTIC_ATTRIBUTE_SENTRY_OP]: "navigation",
48
- [browser$1.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.navigation.react.reactrouter_v3",
49
- [browser$1.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,
50
+ [attributes.SENTRY_OP]: op.NAVIGATION,
51
+ [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.navigation.react.reactrouter_v3",
52
+ [attributes.SENTRY_SEGMENT_NAME_SOURCE]: source,
50
53
  ...source === "route" && { [attributes.URL_TEMPLATE]: localName }
51
54
  }
52
55
  });
@@ -1 +1 @@
1
- {"version":3,"file":"reactrouterv3.js","sources":["../../src/reactrouterv3.ts"],"sourcesContent":["import {\n browserTracingIntegration,\n startBrowserTracingNavigationSpan,\n startBrowserTracingPageLoadSpan,\n WINDOW,\n} from '@sentry/browser';\nimport type { Integration, TransactionSource } from '@sentry/core/browser';\nimport {\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n} from '@sentry/core/browser';\nimport type { Location } from './types';\nimport { URL_TEMPLATE } from '@sentry/conventions/attributes';\n\n// Many of the types below had to be mocked out to prevent typescript issues\n// these types are required for correct functionality.\n\ntype HistoryV3 = {\n location?: Location;\n listen?(cb: (location: Location) => void): void;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n} & Record<string, any>;\n\nexport type Route = { path?: string; childRoutes?: Route[] };\n\nexport type Match = (\n props: { location: Location; routes: Route[] },\n cb: (error?: Error, _redirectLocation?: Location, renderProps?: { routes?: Route[] }) => void,\n) => void;\n\ntype ReactRouterV3TransactionSource = Extract<TransactionSource, 'url' | 'route'>;\n\ninterface ReactRouterOptions {\n history: HistoryV3;\n routes: Route[];\n match: Match;\n}\n\n/**\n * A browser tracing integration that uses React Router v3 to instrument navigations.\n * Expects `history` (and optionally `routes` and `matchPath`) to be passed as options.\n */\nexport function reactRouterV3BrowserTracingIntegration(\n options: Parameters<typeof browserTracingIntegration>[0] & ReactRouterOptions,\n): Integration {\n const integration = browserTracingIntegration({\n ...options,\n instrumentPageLoad: false,\n instrumentNavigation: false,\n });\n\n const { history, routes, match, instrumentPageLoad = true, instrumentNavigation = true } = options;\n\n return {\n ...integration,\n afterAllSetup(client) {\n integration.afterAllSetup(client);\n\n if (instrumentPageLoad && WINDOW.location) {\n normalizeTransactionName(\n routes,\n WINDOW.location,\n match,\n (localName: string, source: ReactRouterV3TransactionSource = 'url') => {\n startBrowserTracingPageLoadSpan(client, {\n name: localName,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v3',\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,\n ...(source === 'route' && { [URL_TEMPLATE]: localName }),\n },\n });\n },\n );\n }\n\n if (instrumentNavigation && history.listen) {\n history.listen(location => {\n if (location.action === 'PUSH' || location.action === 'POP') {\n normalizeTransactionName(\n routes,\n location,\n match,\n (localName: string, source: TransactionSource = 'url') => {\n startBrowserTracingNavigationSpan(client, {\n name: localName,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v3',\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,\n ...(source === 'route' && { [URL_TEMPLATE]: localName }),\n },\n });\n },\n );\n }\n });\n }\n },\n };\n}\n\n/**\n * Normalize transaction names using `Router.match`\n */\nfunction normalizeTransactionName(\n appRoutes: Route[],\n location: Location,\n match: Match,\n callback: (pathname: string, source?: ReactRouterV3TransactionSource) => void,\n): void {\n let name = location.pathname;\n match(\n {\n location,\n routes: appRoutes,\n },\n (error, _redirectLocation, renderProps) => {\n if (error || !renderProps) {\n return callback(name);\n }\n\n const routePath = getRouteStringFromRoutes(renderProps.routes || []);\n if (routePath.length === 0 || routePath === '/*') {\n return callback(name);\n }\n\n name = routePath;\n return callback(name, 'route');\n },\n );\n}\n\n/**\n * Generate route name from array of routes\n */\nfunction getRouteStringFromRoutes(routes: Route[]): string {\n if (!Array.isArray(routes) || routes.length === 0) {\n return '';\n }\n\n const routesWithPaths: Route[] = routes.filter((route: Route) => !!route.path);\n\n let index = -1;\n for (let x = routesWithPaths.length - 1; x >= 0; x--) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const route = routesWithPaths[x]!;\n if (route.path?.startsWith('/')) {\n index = x;\n break;\n }\n }\n\n return routesWithPaths.slice(index).reduce((acc, { path }) => {\n const pathSegment = acc === '/' || acc === '' ? path : `/${path}`;\n return `${acc}${pathSegment}`;\n }, '');\n}\n"],"names":["browserTracingIntegration","WINDOW","startBrowserTracingPageLoadSpan","SEMANTIC_ATTRIBUTE_SENTRY_OP","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","URL_TEMPLATE","startBrowserTracingNavigationSpan"],"mappings":";;;;;;AA2CO,SAAS,uCACd,OAAA,EACa;AACb,EAAA,MAAM,cAAcA,iCAAA,CAA0B;AAAA,IAC5C,GAAG,OAAA;AAAA,IACH,kBAAA,EAAoB,KAAA;AAAA,IACpB,oBAAA,EAAsB;AAAA,GACvB,CAAA;AAED,EAAA,MAAM,EAAE,SAAS,MAAA,EAAQ,KAAA,EAAO,qBAAqB,IAAA,EAAM,oBAAA,GAAuB,MAAK,GAAI,OAAA;AAE3F,EAAA,OAAO;AAAA,IACL,GAAG,WAAA;AAAA,IACH,cAAc,MAAA,EAAQ;AACpB,MAAA,WAAA,CAAY,cAAc,MAAM,CAAA;AAEhC,MAAA,IAAI,kBAAA,IAAsBC,eAAO,QAAA,EAAU;AACzC,QAAA,wBAAA;A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AM,KAAK,CAAA,CAAE,OAAO,CAAC,GAAA,EAAK,EAAE,IAAA,EAAK,KAAM;AAC5D,IAAA,MAAM,cAAc,GAAA,KAAQ,GAAA,IAAO,QAAQ,EAAA,GAAK,IAAA,GAAO,IAAI,IAAI,CAAA,CAAA;AAC/D,IAAA,OAAO,CAAA,EAAG,GAAG,CAAA,EAAG,WAAW,CAAA,CAAA;AAAA,EAC7B,GAAG,EAAE,CAAA;AACP;;;;"}
1
+ {"version":3,"file":"reactrouterv3.js","sources":["../../src/reactrouterv3.ts"],"sourcesContent":["import {\n browserTracingIntegration,\n startBrowserTracingNavigationSpan,\n startBrowserTracingPageLoadSpan,\n WINDOW,\n} from '@sentry/browser';\nimport type { Integration, TransactionSource } from '@sentry/core';\nimport {\n hasSpanStreamingEnabled,\n NAVIGATION_SPAN_NAME_FALLBACK,\n PAGELOAD_SPAN_NAME_FALLBACK,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n} from '@sentry/core';\nimport type { Location } from './types';\nimport { SENTRY_OP, SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes';\nimport { NAVIGATION, PAGELOAD } from '@sentry/conventions/op';\n\n// Many of the types below had to be mocked out to prevent typescript issues\n// these types are required for correct functionality.\n\ntype HistoryV3 = {\n location?: Location;\n listen?(cb: (location: Location) => void): void;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n} & Record<string, any>;\n\nexport type Route = { path?: string; childRoutes?: Route[] };\n\nexport type Match = (\n props: { location: Location; routes: Route[] },\n cb: (error?: Error, _redirectLocation?: Location, renderProps?: { routes?: Route[] }) => void,\n) => void;\n\ntype ReactRouterV3TransactionSource = Extract<TransactionSource, 'url' | 'route'>;\n\ninterface ReactRouterOptions {\n history: HistoryV3;\n routes: Route[];\n match: Match;\n}\n\n/**\n * A browser tracing integration that uses React Router v3 to instrument navigations.\n * Expects `history` (and optionally `routes` and `matchPath`) to be passed as options.\n */\nexport function reactRouterV3BrowserTracingIntegration(\n options: Parameters<typeof browserTracingIntegration>[0] & ReactRouterOptions,\n): Integration {\n const integration = browserTracingIntegration({\n ...options,\n instrumentPageLoad: false,\n instrumentNavigation: false,\n });\n\n const { history, routes, match, instrumentPageLoad = true, instrumentNavigation = true } = options;\n\n return {\n ...integration,\n afterAllSetup(client) {\n integration.afterAllSetup(client);\n\n if (instrumentPageLoad && WINDOW.location) {\n normalizeTransactionName(\n routes,\n WINDOW.location,\n match,\n (localName: string, source: ReactRouterV3TransactionSource = 'url') => {\n startBrowserTracingPageLoadSpan(client, {\n // With span streaming, span names have to be low cardinality, so we can't fall back to the URL.\n name: source === 'route' || !hasSpanStreamingEnabled(client) ? localName : PAGELOAD_SPAN_NAME_FALLBACK,\n attributes: {\n [SENTRY_OP]: PAGELOAD,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v3',\n [SENTRY_SEGMENT_NAME_SOURCE]: source,\n ...(source === 'route' && { [URL_TEMPLATE]: localName }),\n },\n });\n },\n );\n }\n\n if (instrumentNavigation && history.listen) {\n history.listen(location => {\n if (location.action === 'PUSH' || location.action === 'POP') {\n normalizeTransactionName(\n routes,\n location,\n match,\n (localName: string, source: TransactionSource = 'url') => {\n startBrowserTracingNavigationSpan(client, {\n // With span streaming, span names have to be low cardinality, so we can't fall back to the URL.\n name:\n source === 'route' || !hasSpanStreamingEnabled(client) ? localName : NAVIGATION_SPAN_NAME_FALLBACK,\n attributes: {\n [SENTRY_OP]: NAVIGATION,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v3',\n [SENTRY_SEGMENT_NAME_SOURCE]: source,\n ...(source === 'route' && { [URL_TEMPLATE]: localName }),\n },\n });\n },\n );\n }\n });\n }\n },\n };\n}\n\n/**\n * Normalize transaction names using `Router.match`\n */\nfunction normalizeTransactionName(\n appRoutes: Route[],\n location: Location,\n match: Match,\n callback: (pathname: string, source?: ReactRouterV3TransactionSource) => void,\n): void {\n let name = location.pathname;\n match(\n {\n location,\n routes: appRoutes,\n },\n (error, _redirectLocation, renderProps) => {\n if (error || !renderProps) {\n return callback(name);\n }\n\n const routePath = getRouteStringFromRoutes(renderProps.routes || []);\n if (routePath.length === 0 || routePath === '/*') {\n return callback(name);\n }\n\n name = routePath;\n return callback(name, 'route');\n },\n );\n}\n\n/**\n * Generate route name from array of routes\n */\nfunction getRouteStringFromRoutes(routes: Route[]): string {\n if (!Array.isArray(routes) || routes.length === 0) {\n return '';\n }\n\n const routesWithPaths: Route[] = routes.filter((route: Route) => !!route.path);\n\n let index = -1;\n for (let x = routesWithPaths.length - 1; x >= 0; x--) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const route = routesWithPaths[x]!;\n if (route.path?.startsWith('/')) {\n index = x;\n break;\n }\n }\n\n return routesWithPaths.slice(index).reduce((acc, { path }) => {\n const pathSegment = acc === '/' || acc === '' ? path : `/${path}`;\n return `${acc}${pathSegment}`;\n }, '');\n}\n"],"names":["browserTracingIntegration","WINDOW","startBrowserTracingPageLoadSpan","hasSpanStreamingEnabled","PAGELOAD_SPAN_NAME_FALLBACK","SENTRY_OP","PAGELOAD","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SENTRY_SEGMENT_NAME_SOURCE","URL_TEMPLATE","startBrowserTracingNavigationSpan","NAVIGATION_SPAN_NAME_FALLBACK","NAVIGATION"],"mappings":";;;;;;;AA6CO,SAAS,uCACd,OAAA,EACa;AACb,EAAA,MAAM,cAAcA,iCAAA,CAA0B;AAAA,IAC5C,GAAG,OAAA;AAAA,IACH,kBAAA,EAAoB,KAAA;AAAA,IACpB,oBAAA,EAAsB;AAAA,GACvB,CAAA;AAED,EAAA,MAAM,EAAE,SAAS,MAAA,EAAQ,KAAA,EAAO,qBAAqB,IAAA,EAAM,oBAAA,GAAuB,MAAK,GAAI,OAAA;AAE3F,EAAA,OAAO;AAAA,IACL,GAAG,WAAA;AAAA,IACH,cAAc,MAAA,E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EAAG,CAAA,IAAK,GAAG,CAAA,EAAA,EAAK;AAEpD,IAAA,MAAM,KAAA,GAAQ,gBAAgB,CAAC,CAAA;AAC/B,IAAA,IAAI,KAAA,CAAM,IAAA,EAAM,UAAA,CAAW,GAAG,CAAA,EAAG;AAC/B,MAAA,KAAA,GAAQ,CAAA;AACR,MAAA;AAAA,IACF;AAAA,EACF;AAEA,EAAA,OAAO,eAAA,CAAgB,MAAM,KAAK,CAAA,CAAE,OAAO,CAAC,GAAA,EAAK,EAAE,IAAA,EAAK,KAAM;AAC5D,IAAA,MAAM,cAAc,GAAA,KAAQ,GAAA,IAAO,QAAQ,EAAA,GAAK,IAAA,GAAO,IAAI,IAAI,CAAA,CAAA;AAC/D,IAAA,OAAO,CAAA,EAAG,GAAG,CAAA,EAAG,WAAW,CAAA,CAAA;AAAA,EAC7B,GAAG,EAAE,CAAA;AACP;;;;"}
@@ -1,9 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const instrumentation = require('./reactrouter-compat-utils/instrumentation.js');
4
- require('@sentry/core/browser');
5
- require('@sentry/browser');
6
- require('@sentry/core');
7
4
 
8
5
  function reactRouterV6BrowserTracingIntegration(options) {
9
6
  return instrumentation.createReactRouterV6CompatibleTracingIntegration(options, "6");
@@ -1 +1 @@
1
- {"version":3,"file":"reactrouterv6.js","sources":["../../src/reactrouterv6.tsx"],"sourcesContent":["import type { browserTracingIntegration } from '@sentry/browser';\nimport type { Integration } from '@sentry/core';\nimport type { ReactRouterOptions } from './reactrouter-compat-utils';\nimport {\n createReactRouterV6CompatibleTracingIntegration,\n createV6CompatibleWithSentryReactRouterRouting,\n createV6CompatibleWrapCreateBrowserRouter,\n createV6CompatibleWrapCreateMemoryRouter,\n createV6CompatibleWrapUseRoutes,\n} from './reactrouter-compat-utils';\nimport type { CreateRouterFunction, Router, RouterState, UseRoutes } from './types';\n\n/**\n * A browser tracing integration that uses React Router v6 to instrument navigations.\n * Expects `useEffect`, `useLocation`, `useNavigationType`, `createRoutesFromChildren` and `matchRoutes` to be passed as options.\n *\n * @deprecated Use `reactRouterBrowserTracingIntegration` instead.\n */\nexport function reactRouterV6BrowserTracingIntegration(\n options: Parameters<typeof browserTracingIntegration>[0] & ReactRouterOptions,\n): Integration {\n return createReactRouterV6CompatibleTracingIntegration(options, '6');\n}\n\n/**\n * A wrapper function that adds Sentry routing instrumentation to a React Router v6 useRoutes hook.\n * This is used to automatically capture route changes as transactions when using the useRoutes hook.\n *\n * @deprecated Use `wrapUseRoutes` instead.\n */\nexport function wrapUseRoutesV6(origUseRoutes: UseRoutes): UseRoutes {\n return createV6CompatibleWrapUseRoutes(origUseRoutes, '6');\n}\n\n/**\n * A wrapper function that adds Sentry routing instrumentation to a React Router v6 createBrowserRouter function.\n * This is used to automatically capture route changes as transactions when using the createBrowserRouter API.\n *\n * @deprecated Use `wrapCreateBrowserRouter` instead.\n */\nexport function wrapCreateBrowserRouterV6<\n TState extends RouterState = RouterState,\n TRouter extends Router<TState> = Router<TState>,\n>(createRouterFunction: CreateRouterFunction<TState, TRouter>): CreateRouterFunction<TState, TRouter> {\n return createV6CompatibleWrapCreateBrowserRouter(createRouterFunction, '6');\n}\n\n/**\n * A wrapper function that adds Sentry routing instrumentation to a React Router v6 createMemoryRouter function.\n * This is used to automatically capture route changes as transactions when using the createMemoryRouter API.\n * The difference between createBrowserRouter and createMemoryRouter is that with createMemoryRouter,\n * optional `initialEntries` are also taken into account.\n *\n * @deprecated Use `wrapCreateMemoryRouter` instead.\n */\nexport function wrapCreateMemoryRouterV6<\n TState extends RouterState = RouterState,\n TRouter extends Router<TState> = Router<TState>,\n>(createMemoryRouterFunction: CreateRouterFunction<TState, TRouter>): CreateRouterFunction<TState, TRouter> {\n return createV6CompatibleWrapCreateMemoryRouter(createMemoryRouterFunction, '6');\n}\n\n/**\n * A higher-order component that adds Sentry routing instrumentation to a React Router v6 Route component.\n * This is used to automatically capture route changes as transactions.\n *\n * @deprecated Use `wrapReactRouterRouting` instead.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function withSentryReactRouterV6Routing<P extends Record<string, any>, R extends React.FC<P>>(routes: R): R {\n return createV6CompatibleWithSentryReactRouterRouting<P, R>(routes, '6');\n}\n"],"names":["createReactRouterV6CompatibleTracingIntegration","createV6CompatibleWrapUseRoutes","createV6CompatibleWrapCreateBrowserRouter","createV6CompatibleWrapCreateMemoryRouter","createV6CompatibleWithSentryReactRouterRouting"],"mappings":";;;;;;;AAkBO,SAAS,uCACd,OAAA,EACa;AACb,EAAA,OAAOA,+DAAA,CAAgD,SAAS,GAAG,CAAA;AACrE;AAQO,SAAS,gBAAgB,aAAA,EAAqC;AACnE,EAAA,OAAOC,+CAAA,CAAgC,eAAe,GAAG,CAAA;AAC3D;AAQO,SAAS,0BAGd,oBAAA,EAAoG;AACpG,EAAA,OAAOC,yDAAA,CAA0C,sBAAsB,GAAG,CAAA;AAC5E;AAUO,SAAS,yBAGd,0BAAA,EAA0G;AAC1G,EAAA,OAAOC,wDAAA,CAAyC,4BAA4B,GAAG,CAAA;AACjF;AASO,SAAS,+BAAqF,MAAA,EAAc;AACjH,EAAA,OAAOC,8DAAA,CAAqD,QAAQ,GAAG,CAAA;AACzE;;;;;;;;"}
1
+ {"version":3,"file":"reactrouterv6.js","sources":["../../src/reactrouterv6.tsx"],"sourcesContent":["import type { browserTracingIntegration } from '@sentry/browser';\nimport type { Integration } from '@sentry/core';\nimport type { ReactRouterOptions } from './reactrouter-compat-utils';\nimport {\n createReactRouterV6CompatibleTracingIntegration,\n createV6CompatibleWithSentryReactRouterRouting,\n createV6CompatibleWrapCreateBrowserRouter,\n createV6CompatibleWrapCreateMemoryRouter,\n createV6CompatibleWrapUseRoutes,\n} from './reactrouter-compat-utils';\nimport type { CreateRouterFunction, Router, RouterState, UseRoutes } from './types';\n\n/**\n * A browser tracing integration that uses React Router v6 to instrument navigations.\n * Expects `useEffect`, `useLocation`, `useNavigationType`, `createRoutesFromChildren` and `matchRoutes` to be passed as options.\n *\n * @deprecated Use `reactRouterBrowserTracingIntegration` instead.\n */\nexport function reactRouterV6BrowserTracingIntegration(\n options: Parameters<typeof browserTracingIntegration>[0] & ReactRouterOptions,\n): Integration {\n return createReactRouterV6CompatibleTracingIntegration(options, '6');\n}\n\n/**\n * A wrapper function that adds Sentry routing instrumentation to a React Router v6 useRoutes hook.\n * This is used to automatically capture route changes as transactions when using the useRoutes hook.\n *\n * @deprecated Use `wrapUseRoutes` instead.\n */\nexport function wrapUseRoutesV6(origUseRoutes: UseRoutes): UseRoutes {\n return createV6CompatibleWrapUseRoutes(origUseRoutes, '6');\n}\n\n/**\n * A wrapper function that adds Sentry routing instrumentation to a React Router v6 createBrowserRouter function.\n * This is used to automatically capture route changes as transactions when using the createBrowserRouter API.\n *\n * @deprecated Use `wrapCreateBrowserRouter` instead.\n */\nexport function wrapCreateBrowserRouterV6<\n TState extends RouterState = RouterState,\n TRouter extends Router<TState> = Router<TState>,\n>(createRouterFunction: CreateRouterFunction<TState, TRouter>): CreateRouterFunction<TState, TRouter> {\n return createV6CompatibleWrapCreateBrowserRouter(createRouterFunction, '6');\n}\n\n/**\n * A wrapper function that adds Sentry routing instrumentation to a React Router v6 createMemoryRouter function.\n * This is used to automatically capture route changes as transactions when using the createMemoryRouter API.\n * The difference between createBrowserRouter and createMemoryRouter is that with createMemoryRouter,\n * optional `initialEntries` are also taken into account.\n *\n * @deprecated Use `wrapCreateMemoryRouter` instead.\n */\nexport function wrapCreateMemoryRouterV6<\n TState extends RouterState = RouterState,\n TRouter extends Router<TState> = Router<TState>,\n>(createMemoryRouterFunction: CreateRouterFunction<TState, TRouter>): CreateRouterFunction<TState, TRouter> {\n return createV6CompatibleWrapCreateMemoryRouter(createMemoryRouterFunction, '6');\n}\n\n/**\n * A higher-order component that adds Sentry routing instrumentation to a React Router v6 Route component.\n * This is used to automatically capture route changes as transactions.\n *\n * @deprecated Use `wrapReactRouterRouting` instead.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function withSentryReactRouterV6Routing<P extends Record<string, any>, R extends React.FC<P>>(routes: R): R {\n return createV6CompatibleWithSentryReactRouterRouting<P, R>(routes, '6');\n}\n"],"names":["createReactRouterV6CompatibleTracingIntegration","createV6CompatibleWrapUseRoutes","createV6CompatibleWrapCreateBrowserRouter","createV6CompatibleWrapCreateMemoryRouter","createV6CompatibleWithSentryReactRouterRouting"],"mappings":";;;;AAkBO,SAAS,uCACd,OAAA,EACa;AACb,EAAA,OAAOA,+DAAA,CAAgD,SAAS,GAAG,CAAA;AACrE;AAQO,SAAS,gBAAgB,aAAA,EAAqC;AACnE,EAAA,OAAOC,+CAAA,CAAgC,eAAe,GAAG,CAAA;AAC3D;AAQO,SAAS,0BAGd,oBAAA,EAAoG;AACpG,EAAA,OAAOC,yDAAA,CAA0C,sBAAsB,GAAG,CAAA;AAC5E;AAUO,SAAS,yBAGd,0BAAA,EAA0G;AAC1G,EAAA,OAAOC,wDAAA,CAAyC,4BAA4B,GAAG,CAAA;AACjF;AASO,SAAS,+BAAqF,MAAA,EAAc;AACjH,EAAA,OAAOC,8DAAA,CAAqD,QAAQ,GAAG,CAAA;AACzE;;;;;;;;"}
@@ -1,9 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const instrumentation = require('./reactrouter-compat-utils/instrumentation.js');
4
- require('@sentry/core/browser');
5
- require('@sentry/browser');
6
- require('@sentry/core');
7
4
 
8
5
  function reactRouterV7BrowserTracingIntegration(options) {
9
6
  return instrumentation.createReactRouterV6CompatibleTracingIntegration(options, "7");
@@ -1 +1 @@
1
- {"version":3,"file":"reactrouterv7.js","sources":["../../src/reactrouterv7.tsx"],"sourcesContent":["// React Router v7 uses the same integration as v6\nimport type { browserTracingIntegration } from '@sentry/browser';\nimport type { Integration } from '@sentry/core';\nimport type { ReactRouterOptions } from './reactrouter-compat-utils';\nimport {\n createReactRouterV6CompatibleTracingIntegration,\n createV6CompatibleWithSentryReactRouterRouting,\n createV6CompatibleWrapCreateBrowserRouter,\n createV6CompatibleWrapCreateMemoryRouter,\n createV6CompatibleWrapUseRoutes,\n} from './reactrouter-compat-utils';\nimport type { CreateRouterFunction, Router, RouterState, UseRoutes } from './types';\n\n/**\n * A browser tracing integration that uses React Router v7 to instrument navigations.\n * Expects `useEffect`, `useLocation`, `useNavigationType`, `createRoutesFromChildren` and `matchRoutes` to be passed as options.\n *\n * @deprecated Use `reactRouterBrowserTracingIntegration` instead.\n */\nexport function reactRouterV7BrowserTracingIntegration(\n options: Parameters<typeof browserTracingIntegration>[0] & ReactRouterOptions,\n): Integration {\n return createReactRouterV6CompatibleTracingIntegration(options, '7');\n}\n\n/**\n * A higher-order component that adds Sentry routing instrumentation to a React Router v7 Route component.\n * This is used to automatically capture route changes as transactions.\n *\n * @deprecated Use `wrapReactRouterRouting` instead.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function withSentryReactRouterV7Routing<P extends Record<string, any>, R extends React.FC<P>>(routes: R): R {\n return createV6CompatibleWithSentryReactRouterRouting<P, R>(routes, '7');\n}\n\n/**\n * A wrapper function that adds Sentry routing instrumentation to a React Router v7 createBrowserRouter function.\n * This is used to automatically capture route changes as transactions when using the createBrowserRouter API.\n *\n * @deprecated Use `wrapCreateBrowserRouter` instead.\n */\nexport function wrapCreateBrowserRouterV7<\n TState extends RouterState = RouterState,\n TRouter extends Router<TState> = Router<TState>,\n>(createRouterFunction: CreateRouterFunction<TState, TRouter>): CreateRouterFunction<TState, TRouter> {\n return createV6CompatibleWrapCreateBrowserRouter(createRouterFunction, '7');\n}\n\n/**\n * A wrapper function that adds Sentry routing instrumentation to a React Router v7 createMemoryRouter function.\n * This is used to automatically capture route changes as transactions when using the createMemoryRouter API.\n * The difference between createBrowserRouter and createMemoryRouter is that with createMemoryRouter,\n * optional `initialEntries` are also taken into account.\n *\n * @deprecated Use `wrapCreateMemoryRouter` instead.\n */\nexport function wrapCreateMemoryRouterV7<\n TState extends RouterState = RouterState,\n TRouter extends Router<TState> = Router<TState>,\n>(createMemoryRouterFunction: CreateRouterFunction<TState, TRouter>): CreateRouterFunction<TState, TRouter> {\n return createV6CompatibleWrapCreateMemoryRouter(createMemoryRouterFunction, '7');\n}\n\n/**\n * A wrapper function that adds Sentry routing instrumentation to a React Router v7 useRoutes hook.\n * This is used to automatically capture route changes as transactions when using the useRoutes hook.\n *\n * @deprecated Use `wrapUseRoutes` instead.\n */\nexport function wrapUseRoutesV7(origUseRoutes: UseRoutes): UseRoutes {\n return createV6CompatibleWrapUseRoutes(origUseRoutes, '7');\n}\n"],"names":["createReactRouterV6CompatibleTracingIntegration","createV6CompatibleWithSentryReactRouterRouting","createV6CompatibleWrapCreateBrowserRouter","createV6CompatibleWrapCreateMemoryRouter","createV6CompatibleWrapUseRoutes"],"mappings":";;;;;;;AAmBO,SAAS,uCACd,OAAA,EACa;AACb,EAAA,OAAOA,+DAAA,CAAgD,SAAS,GAAG,CAAA;AACrE;AASO,SAAS,+BAAqF,MAAA,EAAc;AACjH,EAAA,OAAOC,8DAAA,CAAqD,QAAQ,GAAG,CAAA;AACzE;AAQO,SAAS,0BAGd,oBAAA,EAAoG;AACpG,EAAA,OAAOC,yDAAA,CAA0C,sBAAsB,GAAG,CAAA;AAC5E;AAUO,SAAS,yBAGd,0BAAA,EAA0G;AAC1G,EAAA,OAAOC,wDAAA,CAAyC,4BAA4B,GAAG,CAAA;AACjF;AAQO,SAAS,gBAAgB,aAAA,EAAqC;AACnE,EAAA,OAAOC,+CAAA,CAAgC,eAAe,GAAG,CAAA;AAC3D;;;;;;;;"}
1
+ {"version":3,"file":"reactrouterv7.js","sources":["../../src/reactrouterv7.tsx"],"sourcesContent":["// React Router v7 uses the same integration as v6\nimport type { browserTracingIntegration } from '@sentry/browser';\nimport type { Integration } from '@sentry/core';\nimport type { ReactRouterOptions } from './reactrouter-compat-utils';\nimport {\n createReactRouterV6CompatibleTracingIntegration,\n createV6CompatibleWithSentryReactRouterRouting,\n createV6CompatibleWrapCreateBrowserRouter,\n createV6CompatibleWrapCreateMemoryRouter,\n createV6CompatibleWrapUseRoutes,\n} from './reactrouter-compat-utils';\nimport type { CreateRouterFunction, Router, RouterState, UseRoutes } from './types';\n\n/**\n * A browser tracing integration that uses React Router v7 to instrument navigations.\n * Expects `useEffect`, `useLocation`, `useNavigationType`, `createRoutesFromChildren` and `matchRoutes` to be passed as options.\n *\n * @deprecated Use `reactRouterBrowserTracingIntegration` instead.\n */\nexport function reactRouterV7BrowserTracingIntegration(\n options: Parameters<typeof browserTracingIntegration>[0] & ReactRouterOptions,\n): Integration {\n return createReactRouterV6CompatibleTracingIntegration(options, '7');\n}\n\n/**\n * A higher-order component that adds Sentry routing instrumentation to a React Router v7 Route component.\n * This is used to automatically capture route changes as transactions.\n *\n * @deprecated Use `wrapReactRouterRouting` instead.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function withSentryReactRouterV7Routing<P extends Record<string, any>, R extends React.FC<P>>(routes: R): R {\n return createV6CompatibleWithSentryReactRouterRouting<P, R>(routes, '7');\n}\n\n/**\n * A wrapper function that adds Sentry routing instrumentation to a React Router v7 createBrowserRouter function.\n * This is used to automatically capture route changes as transactions when using the createBrowserRouter API.\n *\n * @deprecated Use `wrapCreateBrowserRouter` instead.\n */\nexport function wrapCreateBrowserRouterV7<\n TState extends RouterState = RouterState,\n TRouter extends Router<TState> = Router<TState>,\n>(createRouterFunction: CreateRouterFunction<TState, TRouter>): CreateRouterFunction<TState, TRouter> {\n return createV6CompatibleWrapCreateBrowserRouter(createRouterFunction, '7');\n}\n\n/**\n * A wrapper function that adds Sentry routing instrumentation to a React Router v7 createMemoryRouter function.\n * This is used to automatically capture route changes as transactions when using the createMemoryRouter API.\n * The difference between createBrowserRouter and createMemoryRouter is that with createMemoryRouter,\n * optional `initialEntries` are also taken into account.\n *\n * @deprecated Use `wrapCreateMemoryRouter` instead.\n */\nexport function wrapCreateMemoryRouterV7<\n TState extends RouterState = RouterState,\n TRouter extends Router<TState> = Router<TState>,\n>(createMemoryRouterFunction: CreateRouterFunction<TState, TRouter>): CreateRouterFunction<TState, TRouter> {\n return createV6CompatibleWrapCreateMemoryRouter(createMemoryRouterFunction, '7');\n}\n\n/**\n * A wrapper function that adds Sentry routing instrumentation to a React Router v7 useRoutes hook.\n * This is used to automatically capture route changes as transactions when using the useRoutes hook.\n *\n * @deprecated Use `wrapUseRoutes` instead.\n */\nexport function wrapUseRoutesV7(origUseRoutes: UseRoutes): UseRoutes {\n return createV6CompatibleWrapUseRoutes(origUseRoutes, '7');\n}\n"],"names":["createReactRouterV6CompatibleTracingIntegration","createV6CompatibleWithSentryReactRouterRouting","createV6CompatibleWrapCreateBrowserRouter","createV6CompatibleWrapCreateMemoryRouter","createV6CompatibleWrapUseRoutes"],"mappings":";;;;AAmBO,SAAS,uCACd,OAAA,EACa;AACb,EAAA,OAAOA,+DAAA,CAAgD,SAAS,GAAG,CAAA;AACrE;AASO,SAAS,+BAAqF,MAAA,EAAc;AACjH,EAAA,OAAOC,8DAAA,CAAqD,QAAQ,GAAG,CAAA;AACzE;AAQO,SAAS,0BAGd,oBAAA,EAAoG;AACpG,EAAA,OAAOC,yDAAA,CAA0C,sBAAsB,GAAG,CAAA;AAC5E;AAUO,SAAS,yBAGd,0BAAA,EAA0G;AAC1G,EAAA,OAAOC,wDAAA,CAAyC,4BAA4B,GAAG,CAAA;AACjF;AAQO,SAAS,gBAAgB,aAAA,EAAqC;AACnE,EAAA,OAAOC,+CAAA,CAAgC,eAAe,GAAG,CAAA;AAC3D;;;;;;;;"}
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- const browser = require('@sentry/core/browser');
3
+ const core = require('@sentry/core');
4
4
 
5
5
  const ACTION_BREADCRUMB_CATEGORY = "redux.action";
6
6
  const ACTION_BREADCRUMB_TYPE = "info";
@@ -15,7 +15,7 @@ function createReduxEnhancer(enhancerOptions) {
15
15
  ...enhancerOptions
16
16
  };
17
17
  return (next) => (reducer, initialState) => {
18
- options.attachReduxState && browser.getGlobalScope().addEventProcessor((event, hint) => {
18
+ options.attachReduxState && core.getGlobalScope().addEventProcessor((event, hint) => {
19
19
  try {
20
20
  if (event.type === void 0 && event.contexts.state.state.type === "redux") {
21
21
  hint.attachments = [
@@ -31,10 +31,10 @@ function createReduxEnhancer(enhancerOptions) {
31
31
  function sentryWrapReducer(reducer2) {
32
32
  return (state, action) => {
33
33
  const newState = reducer2(state, action);
34
- const scope = browser.getCurrentScope();
34
+ const scope = core.getCurrentScope();
35
35
  const transformedAction = options.actionTransformer(action);
36
36
  if (typeof transformedAction !== "undefined" && transformedAction !== null) {
37
- browser.addBreadcrumb({
37
+ core.addBreadcrumb({
38
38
  category: ACTION_BREADCRUMB_CATEGORY,
39
39
  data: transformedAction,
40
40
  type: ACTION_BREADCRUMB_TYPE
@@ -42,11 +42,11 @@ function createReduxEnhancer(enhancerOptions) {
42
42
  }
43
43
  const transformedState = options.stateTransformer(newState);
44
44
  if (typeof transformedState !== "undefined" && transformedState !== null) {
45
- const client = browser.getClient();
45
+ const client = core.getClient();
46
46
  const options2 = client?.getOptions();
47
47
  const normalizationDepth = options2?.normalizeDepth || 3;
48
48
  const newStateContext = { state: { type: "redux", value: transformedState } };
49
- browser.setNormalizationDepthOverrideHint(
49
+ core.setNormalizationDepthOverrideHint(
50
50
  newStateContext,
51
51
  3 + // 3 layers for `state.value.transformedState`
52
52
  normalizationDepth
@@ -1 +1 @@
1
- {"version":3,"file":"redux.js","sources":["../../src/redux.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { Scope } from '@sentry/core/browser';\nimport {\n addBreadcrumb,\n getClient,\n getCurrentScope,\n getGlobalScope,\n setNormalizationDepthOverrideHint,\n} from '@sentry/core/browser';\n\ninterface Action<T = any> {\n type: T;\n}\n\ninterface AnyAction extends Action {\n [extraProps: string]: any;\n}\n\ntype Reducer<S = any, A extends Action = AnyAction> = (state: S | undefined, action: A) => S;\n\ntype Dispatch<A extends Action = AnyAction> = <T extends A>(action: T, ...extraArgs: any[]) => T;\n\ntype ExtendState<State, Extension> = [Extension] extends [never] ? State : State & Extension;\n\ntype Unsubscribe = () => void;\n\ninterface Store<S = any, A extends Action = AnyAction, StateExt = never, Ext = Record<string, unknown>> {\n dispatch: Dispatch<A>;\n getState(): S;\n subscribe(listener: () => void): Unsubscribe;\n replaceReducer<NewState, NewActions extends Action>(\n nextReducer: Reducer<NewState, NewActions>,\n ): Store<ExtendState<NewState, StateExt>, NewActions, StateExt, Ext> & Ext;\n}\n\ndeclare const $CombinedState: unique symbol;\n\ntype CombinedState<S> = { readonly [$CombinedState]?: undefined } & S;\n\ntype PreloadedState<S> =\n Required<S> extends {\n [$CombinedState]: undefined;\n }\n ? S extends CombinedState<infer S1>\n ? { [K in keyof S1]?: S1[K] extends Record<string, unknown> ? PreloadedState<S1[K]> : S1[K] }\n : never\n : { [K in keyof S]: S[K] extends string | number | boolean | symbol ? S[K] : PreloadedState<S[K]> };\n\ntype StoreEnhancerStoreCreator<Ext = Record<string, unknown>, StateExt = never> = <\n S = any,\n A extends Action = AnyAction,\n>(\n reducer: Reducer<S, A>,\n preloadedState?: PreloadedState<S>,\n) => Store<ExtendState<S, StateExt>, A, StateExt, Ext> & Ext;\n\nexport interface SentryEnhancerOptions<S = any> {\n /**\n * Redux state in attachments or not.\n * @default true\n */\n attachReduxState?: boolean;\n\n /**\n * Transforms the state before attaching it to an event.\n * Use this to remove any private data before sending it to Sentry.\n * Return null to not attach the state.\n */\n stateTransformer(state: S | undefined): (S & any) | null;\n /**\n * Transforms the action before sending it as a breadcrumb.\n * Use this to remove any private data before sending it to Sentry.\n * Return null to not send the breadcrumb.\n */\n actionTransformer(action: AnyAction): AnyAction | null;\n /**\n * Called on every state update, configure the Sentry Scope with the redux state.\n */\n configureScopeWithState?(scope: Scope, state: S): void;\n}\n\nconst ACTION_BREADCRUMB_CATEGORY = 'redux.action';\nconst ACTION_BREADCRUMB_TYPE = 'info';\n\nconst defaultOptions: SentryEnhancerOptions = {\n attachReduxState: true,\n actionTransformer: action => action,\n stateTransformer: state => state || null,\n};\n\n/**\n * Creates an enhancer that would be passed to Redux's createStore to log actions and the latest state to Sentry.\n *\n * @param enhancerOptions Options to pass to the enhancer\n */\nfunction createReduxEnhancer(enhancerOptions?: Partial<SentryEnhancerOptions>): any {\n // Note: We return an any type as to not have type conflicts.\n const options = {\n ...defaultOptions,\n ...enhancerOptions,\n };\n\n return (next: StoreEnhancerStoreCreator): StoreEnhancerStoreCreator =>\n <S = any, A extends Action = AnyAction>(reducer: Reducer<S, A>, initialState?: PreloadedState<S>) => {\n options.attachReduxState &&\n getGlobalScope().addEventProcessor((event, hint) => {\n try {\n // @ts-expect-error try catch to reduce bundle size\n if (event.type === undefined && event.contexts.state.state.type === 'redux') {\n hint.attachments = [\n ...(hint.attachments || []),\n // @ts-expect-error try catch to reduce bundle size\n { filename: 'redux_state.json', data: JSON.stringify(event.contexts.state.state.value) },\n ];\n }\n } catch {\n // empty\n }\n return event;\n });\n\n function sentryWrapReducer(reducer: Reducer<S, A>): Reducer<S, A> {\n return (state, action): S => {\n const newState = reducer(state, action);\n\n const scope = getCurrentScope();\n\n /* Action breadcrumbs */\n const transformedAction = options.actionTransformer(action);\n if (typeof transformedAction !== 'undefined' && transformedAction !== null) {\n addBreadcrumb({\n category: ACTION_BREADCRUMB_CATEGORY,\n data: transformedAction,\n type: ACTION_BREADCRUMB_TYPE,\n });\n }\n\n /* Set latest state to scope */\n const transformedState = options.stateTransformer(newState);\n if (typeof transformedState !== 'undefined' && transformedState !== null) {\n const client = getClient();\n const options = client?.getOptions();\n const normalizationDepth = options?.normalizeDepth || 3; // default state normalization depth to 3\n\n // Set the normalization depth of the redux state to the configured `normalizeDepth` option or a sane number as a fallback\n const newStateContext = { state: { type: 'redux', value: transformedState } };\n setNormalizationDepthOverrideHint(\n newStateContext,\n 3 + // 3 layers for `state.value.transformedState`\n normalizationDepth, // rest for the actual state\n );\n\n scope.setContext('state', newStateContext);\n } else {\n scope.setContext('state', null);\n }\n\n /* Allow user to configure scope with latest state */\n const { configureScopeWithState } = options;\n if (typeof configureScopeWithState === 'function') {\n configureScopeWithState(scope, newState);\n }\n\n return newState;\n };\n }\n\n const store = next(sentryWrapReducer(reducer), initialState);\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n store.replaceReducer = new Proxy(store.replaceReducer, {\n apply: function (target, thisArg, args) {\n target.apply(thisArg, [sentryWrapReducer(args[0])]);\n },\n });\n\n return store;\n };\n}\n\nexport { createReduxEnhancer };\n"],"names":["getGlobalScope","reducer","getCurrentScope","addBreadcrumb","getClient","options","setNormalizationDepthOverrideHint"],"mappings":";;;;AAiFA,MAAM,0BAAA,GAA6B,cAAA;AACnC,MAAM,sBAAA,GAAyB,MAAA;AAE/B,MAAM,cAAA,GAAwC;AAAA,EAC5C,gBAAA,EAAkB,IAAA;AAAA,EAClB,mBAAmB,CAAA,MAAA,KAAU,MAAA;AAAA,EAC7B,gBAAA,EAAkB,WAAS,KAAA,IAAS;AACtC,CAAA;AAOA,SAAS,oBAAoB,eAAA,EAAuD;AAElF,EAAA,MAAM,OAAA,GAAU;AAAA,IACd,GAAG,cAAA;AAAA,IACH,GAAG;AAAA,GACL;AAEA,EAAA,OAAO,CAAC,IAAA,KACN,CAAwC,OAAA,EAAwB,YAAA,KAAqC;AACnG,IAAA,OAAA,CAAQ,oBACNA,sBAAA,EAAe,CAAE,iBAAA,CAAkB,CAAC,OAAO,IAAA,KAAS;AAClD,MAAA,IAAI;AAEF,QAAA,IAAI,KAAA,CAAM,SAAS,KAAA,CAAA,IAAa,KAAA,CAAM,SAAS,KAAA,CAAM,KAAA,CAAM,SAAS,OAAA,EAAS;AAC3E,UAAA,IAAA,CAAK,WAAA,GAAc;AAAA,YACjB,GAAI,IAAA,CAAK,WAAA,IAAe,EAAC;AAAA;AAAA,YAEzB,EAAE,QAAA,EAAU,kBAAA,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,CAAA;AAAA,QAC3C,CAAA,MAAO;AACL,UAAA,KAAA,CAAM,UAAA,CAAW,SAAS,IAAI,CAAA;AAAA,QAChC;AAGA,QAAA,MAAM,EAAE,yBAAwB,GAAI,OAAA;AACpC,QAAA,IAAI,OAAO,4BAA4B,UAAA,EAAY;AACjD,UAAA,uBAAA,CAAwB,OAAO,QAAQ,CAAA;AAAA,QACzC;AAEA,QAAA,OAAO,QAAA;AAAA,MACT,CAAA;AAAA,IACF;AAEA,IAAA,MAAM,KAAA,GAAQ,IAAA,CAAK,iBAAA,CAAkB,OAAO,GAAG,YAAY,CAAA;AAG3D,IAAA,KAAA,CAAM,cAAA,GAAiB,IAAI,KAAA,CAAM,KAAA,CAAM,cAAA,EAAgB;AAAA,MACrD,KAAA,EAAO,SAAU,MAAA,EAAQ,OAAA,EAAS,IAAA,EAAM;AACtC,QAAA,MAAA,CAAO,KAAA,CAAM,SAAS,CAAC,iBAAA,CAAkB,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;AAAA,MACpD;AAAA,KACD,CAAA;AAED,IAAA,OAAO,KAAA;AAAA,EACT,CAAA;AACJ;;;;"}
1
+ {"version":3,"file":"redux.js","sources":["../../src/redux.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { Scope } from '@sentry/core';\nimport {\n addBreadcrumb,\n getClient,\n getCurrentScope,\n getGlobalScope,\n setNormalizationDepthOverrideHint,\n} from '@sentry/core';\n\ninterface Action<T = any> {\n type: T;\n}\n\ninterface AnyAction extends Action {\n [extraProps: string]: any;\n}\n\ntype Reducer<S = any, A extends Action = AnyAction> = (state: S | undefined, action: A) => S;\n\ntype Dispatch<A extends Action = AnyAction> = <T extends A>(action: T, ...extraArgs: any[]) => T;\n\ntype ExtendState<State, Extension> = [Extension] extends [never] ? State : State & Extension;\n\ntype Unsubscribe = () => void;\n\ninterface Store<S = any, A extends Action = AnyAction, StateExt = never, Ext = Record<string, unknown>> {\n dispatch: Dispatch<A>;\n getState(): S;\n subscribe(listener: () => void): Unsubscribe;\n replaceReducer<NewState, NewActions extends Action>(\n nextReducer: Reducer<NewState, NewActions>,\n ): Store<ExtendState<NewState, StateExt>, NewActions, StateExt, Ext> & Ext;\n}\n\ndeclare const $CombinedState: unique symbol;\n\ntype CombinedState<S> = { readonly [$CombinedState]?: undefined } & S;\n\ntype PreloadedState<S> =\n Required<S> extends {\n [$CombinedState]: undefined;\n }\n ? S extends CombinedState<infer S1>\n ? { [K in keyof S1]?: S1[K] extends Record<string, unknown> ? PreloadedState<S1[K]> : S1[K] }\n : never\n : { [K in keyof S]: S[K] extends string | number | boolean | symbol ? S[K] : PreloadedState<S[K]> };\n\ntype StoreEnhancerStoreCreator<Ext = Record<string, unknown>, StateExt = never> = <\n S = any,\n A extends Action = AnyAction,\n>(\n reducer: Reducer<S, A>,\n preloadedState?: PreloadedState<S>,\n) => Store<ExtendState<S, StateExt>, A, StateExt, Ext> & Ext;\n\nexport interface SentryEnhancerOptions<S = any> {\n /**\n * Redux state in attachments or not.\n * @default true\n */\n attachReduxState?: boolean;\n\n /**\n * Transforms the state before attaching it to an event.\n * Use this to remove any private data before sending it to Sentry.\n * Return null to not attach the state.\n */\n stateTransformer(state: S | undefined): (S & any) | null;\n /**\n * Transforms the action before sending it as a breadcrumb.\n * Use this to remove any private data before sending it to Sentry.\n * Return null to not send the breadcrumb.\n */\n actionTransformer(action: AnyAction): AnyAction | null;\n /**\n * Called on every state update, configure the Sentry Scope with the redux state.\n */\n configureScopeWithState?(scope: Scope, state: S): void;\n}\n\nconst ACTION_BREADCRUMB_CATEGORY = 'redux.action';\nconst ACTION_BREADCRUMB_TYPE = 'info';\n\nconst defaultOptions: SentryEnhancerOptions = {\n attachReduxState: true,\n actionTransformer: action => action,\n stateTransformer: state => state || null,\n};\n\n/**\n * Creates an enhancer that would be passed to Redux's createStore to log actions and the latest state to Sentry.\n *\n * @param enhancerOptions Options to pass to the enhancer\n */\nfunction createReduxEnhancer(enhancerOptions?: Partial<SentryEnhancerOptions>): any {\n // Note: We return an any type as to not have type conflicts.\n const options = {\n ...defaultOptions,\n ...enhancerOptions,\n };\n\n return (next: StoreEnhancerStoreCreator): StoreEnhancerStoreCreator =>\n <S = any, A extends Action = AnyAction>(reducer: Reducer<S, A>, initialState?: PreloadedState<S>) => {\n options.attachReduxState &&\n getGlobalScope().addEventProcessor((event, hint) => {\n try {\n // @ts-expect-error try catch to reduce bundle size\n if (event.type === undefined && event.contexts.state.state.type === 'redux') {\n hint.attachments = [\n ...(hint.attachments || []),\n // @ts-expect-error try catch to reduce bundle size\n { filename: 'redux_state.json', data: JSON.stringify(event.contexts.state.state.value) },\n ];\n }\n } catch {\n // empty\n }\n return event;\n });\n\n function sentryWrapReducer(reducer: Reducer<S, A>): Reducer<S, A> {\n return (state, action): S => {\n const newState = reducer(state, action);\n\n const scope = getCurrentScope();\n\n /* Action breadcrumbs */\n const transformedAction = options.actionTransformer(action);\n if (typeof transformedAction !== 'undefined' && transformedAction !== null) {\n addBreadcrumb({\n category: ACTION_BREADCRUMB_CATEGORY,\n data: transformedAction,\n type: ACTION_BREADCRUMB_TYPE,\n });\n }\n\n /* Set latest state to scope */\n const transformedState = options.stateTransformer(newState);\n if (typeof transformedState !== 'undefined' && transformedState !== null) {\n const client = getClient();\n const options = client?.getOptions();\n const normalizationDepth = options?.normalizeDepth || 3; // default state normalization depth to 3\n\n // Set the normalization depth of the redux state to the configured `normalizeDepth` option or a sane number as a fallback\n const newStateContext = { state: { type: 'redux', value: transformedState } };\n setNormalizationDepthOverrideHint(\n newStateContext,\n 3 + // 3 layers for `state.value.transformedState`\n normalizationDepth, // rest for the actual state\n );\n\n scope.setContext('state', newStateContext);\n } else {\n scope.setContext('state', null);\n }\n\n /* Allow user to configure scope with latest state */\n const { configureScopeWithState } = options;\n if (typeof configureScopeWithState === 'function') {\n configureScopeWithState(scope, newState);\n }\n\n return newState;\n };\n }\n\n const store = next(sentryWrapReducer(reducer), initialState);\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n store.replaceReducer = new Proxy(store.replaceReducer, {\n apply: function (target, thisArg, args) {\n target.apply(thisArg, [sentryWrapReducer(args[0])]);\n },\n });\n\n return store;\n };\n}\n\nexport { createReduxEnhancer };\n"],"names":["getGlobalScope","reducer","getCurrentScope","addBreadcrumb","getClient","options","setNormalizationDepthOverrideHint"],"mappings":";;;;AAiFA,MAAM,0BAAA,GAA6B,cAAA;AACnC,MAAM,sBAAA,GAAyB,MAAA;AAE/B,MAAM,cAAA,GAAwC;AAAA,EAC5C,gBAAA,EAAkB,IAAA;AAAA,EAClB,mBAAmB,CAAA,MAAA,KAAU,MAAA;AAAA,EAC7B,gBAAA,EAAkB,WAAS,KAAA,IAAS;AACtC,CAAA;AAOA,SAAS,oBAAoB,eAAA,EAAuD;AAElF,EAAA,MAAM,OAAA,GAAU;AAAA,IACd,GAAG,cAAA;AAAA,IACH,GAAG;AAAA,GACL;AAEA,EAAA,OAAO,CAAC,IAAA,KACN,CAAwC,OAAA,EAAwB,YAAA,KAAqC;AACnG,IAAA,OAAA,CAAQ,oBACNA,mBAAA,EAAe,CAAE,iBAAA,CAAkB,CAAC,OAAO,IAAA,KAAS;AAClD,MAAA,IAAI;AAEF,QAAA,IAAI,KAAA,CAAM,SAAS,KAAA,CAAA,IAAa,KAAA,CAAM,SAAS,KAAA,CAAM,KAAA,CAAM,SAAS,OAAA,EAAS;AAC3E,UAAA,IAAA,CAAK,WAAA,GAAc;AAAA,YACjB,GAAI,IAAA,CAAK,WAAA,IAAe,EAAC;AAAA;AAAA,YAEzB,EAAE,QAAA,EAAU,kBAAA,EAAoB,IAAA,EAAM,IAAA,CAAK,SAAA,CAAU,KAAA,CAAM,QAAA,CAAS,KAAA,CAAM,KAAA,CAAM,KAAK,CAAA;AAAE,WACzF;AAAA,QACF;AAAA,MACF,CAAA,CAAA,MAAQ;AAAA,MAER;AACA,MAAA,OAAO,KAAA;AAAA,IACT,CAAC,CAAA;AAEH,IAAA,SAAS,kBAAkBC,Q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;AAEA,QAAA,OAAO,QAAA;AAAA,MACT,CAAA;AAAA,IACF;AAEA,IAAA,MAAM,KAAA,GAAQ,IAAA,CAAK,iBAAA,CAAkB,OAAO,GAAG,YAAY,CAAA;AAG3D,IAAA,KAAA,CAAM,cAAA,GAAiB,IAAI,KAAA,CAAM,KAAA,CAAM,cAAA,EAAgB;AAAA,MACrD,KAAA,EAAO,SAAU,MAAA,EAAQ,OAAA,EAAS,IAAA,EAAM;AACtC,QAAA,MAAA,CAAO,KAAA,CAAM,SAAS,CAAC,iBAAA,CAAkB,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;AAAA,MACpD;AAAA,KACD,CAAA;AAED,IAAA,OAAO,KAAA;AAAA,EACT,CAAA;AACJ;;;;"}
package/build/cjs/sdk.js CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- const browser$1 = require('@sentry/browser');
4
- const browser = require('@sentry/core/browser');
3
+ const browser = require('@sentry/browser');
4
+ const core = require('@sentry/core');
5
5
  const React = require('react');
6
6
  const isSyntheticEvent = require('./isSyntheticEvent.js');
7
7
 
@@ -9,17 +9,17 @@ function init(options) {
9
9
  const opts = {
10
10
  ...options
11
11
  };
12
- browser.applySdkMetadata(opts, "react");
13
- browser$1.setContext("react", { version: React.version });
14
- const client = browser$1.init(opts);
15
- browser.setNormalizeStringifier(normalizeStringifyValue);
12
+ core.applySdkMetadata(opts, "react");
13
+ browser.setContext("react", { version: React.version });
14
+ const client = browser.init(opts);
15
+ core.setNormalizeStringifier(normalizeStringifyValue);
16
16
  return client;
17
17
  }
18
18
  function normalizeStringifyValue(value) {
19
19
  if (isSyntheticEvent.isSyntheticEvent(value)) {
20
20
  return "[SyntheticEvent]";
21
21
  }
22
- return browser$1.normalizeStringifyValue(value);
22
+ return browser.normalizeStringifyValue(value);
23
23
  }
24
24
 
25
25
  exports.init = init;
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.js","sources":["../../src/sdk.ts"],"sourcesContent":["import type { BrowserOptions } from '@sentry/browser';\nimport {\n init as browserInit,\n normalizeStringifyValue as browserNormalizeStringifyValue,\n setContext,\n} from '@sentry/browser';\nimport type { Client } from '@sentry/core/browser';\nimport { applySdkMetadata, setNormalizeStringifier } from '@sentry/core/browser';\nimport { version } from 'react';\nimport { isSyntheticEvent } from './isSyntheticEvent';\n\n/**\n * Inits the React SDK\n */\nexport function init(options: BrowserOptions): Client | undefined {\n const opts = {\n ...options,\n };\n\n applySdkMetadata(opts, 'react');\n setContext('react', { version });\n const client = browserInit(opts);\n\n // Add react-specific stringification\n setNormalizeStringifier(normalizeStringifyValue);\n\n return client;\n}\n\nfunction normalizeStringifyValue(value: Exclude<unknown, string | number | boolean | null>): string | undefined {\n if (isSyntheticEvent(value)) {\n return '[SyntheticEvent]';\n }\n return browserNormalizeStringifyValue(value);\n}\n"],"names":["applySdkMetadata","setContext","version","browserInit","setNormalizeStringifier","isSyntheticEvent","browserNormalizeStringifyValue"],"mappings":";;;;;;;AAcO,SAAS,KAAK,OAAA,EAA6C;AAChE,EAAA,MAAM,IAAA,GAAO;AAAA,IACX,GAAG;AAAA,GACL;AAEA,EAAAA,wBAAA,CAAiB,MAAM,OAAO,CAAA;AAC9B,EAAAC,oBAAA,CAAW,OAAA,EAAS,WAAEC,aAAA,EAAS,CAAA;AAC/B,EAAA,MAAM,MAAA,GAASC,eAAY,IAAI,CAAA;AAG/B,EAAAC,+BAAA,CAAwB,uBAAuB,CAAA;AAE/C,EAAA,OAAO,MAAA;AACT;AAEA,SAAS,wBAAwB,KAAA,EAA+E;AAC9G,EAAA,IAAIC,iCAAA,CAAiB,KAAK,CAAA,EAAG;AAC3B,IAAA,OAAO,kBAAA;AAAA,EACT;AACA,EAAA,OAAOC,kCAA+B,KAAK,CAAA;AAC7C;;;;"}
1
+ {"version":3,"file":"sdk.js","sources":["../../src/sdk.ts"],"sourcesContent":["import type { BrowserOptions } from '@sentry/browser';\nimport {\n init as browserInit,\n normalizeStringifyValue as browserNormalizeStringifyValue,\n setContext,\n} from '@sentry/browser';\nimport type { Client } from '@sentry/core';\nimport { applySdkMetadata, setNormalizeStringifier } from '@sentry/core';\nimport { version } from 'react';\nimport { isSyntheticEvent } from './isSyntheticEvent';\n\n/**\n * Inits the React SDK\n */\nexport function init(options: BrowserOptions): Client | undefined {\n const opts = {\n ...options,\n };\n\n applySdkMetadata(opts, 'react');\n setContext('react', { version });\n const client = browserInit(opts);\n\n // Add react-specific stringification\n setNormalizeStringifier(normalizeStringifyValue);\n\n return client;\n}\n\nfunction normalizeStringifyValue(value: Exclude<unknown, string | number | boolean | null>): string | undefined {\n if (isSyntheticEvent(value)) {\n return '[SyntheticEvent]';\n }\n return browserNormalizeStringifyValue(value);\n}\n"],"names":["applySdkMetadata","setContext","version","browserInit","setNormalizeStringifier","isSyntheticEvent","browserNormalizeStringifyValue"],"mappings":";;;;;;;AAcO,SAAS,KAAK,OAAA,EAA6C;AAChE,EAAA,MAAM,IAAA,GAAO;AAAA,IACX,GAAG;AAAA,GACL;AAEA,EAAAA,qBAAA,CAAiB,MAAM,OAAO,CAAA;AAC9B,EAAAC,kBAAA,CAAW,OAAA,EAAS,WAAEC,aAAA,EAAS,CAAA;AAC/B,EAAA,MAAM,MAAA,GAASC,aAAY,IAAI,CAAA;AAG/B,EAAAC,4BAAA,CAAwB,uBAAuB,CAAA;AAE/C,EAAA,OAAO,MAAA;AACT;AAEA,SAAS,wBAAwB,KAAA,EAA+E;AAC9G,EAAA,IAAIC,iCAAA,CAAiB,KAAK,CAAA,EAAG;AAC3B,IAAA,OAAO,kBAAA;AAAA,EACT;AACA,EAAA,OAAOC,gCAA+B,KAAK,CAAA;AAC7C;;;;"}