@sentry/react 10.52.0 → 10.53.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 (53) hide show
  1. package/build/cjs/error.js +5 -5
  2. package/build/cjs/error.js.map +1 -1
  3. package/build/cjs/reactrouter-compat-utils/route-manifest.js +4 -4
  4. package/build/cjs/reactrouter-compat-utils/route-manifest.js.map +1 -1
  5. package/build/cjs/reactrouter-compat-utils/utils.js +5 -5
  6. package/build/cjs/reactrouter-compat-utils/utils.js.map +1 -1
  7. package/build/cjs/reactrouterv3.js +7 -7
  8. package/build/cjs/reactrouterv3.js.map +1 -1
  9. package/build/cjs/reactrouterv6.js +2 -1
  10. package/build/cjs/reactrouterv6.js.map +1 -1
  11. package/build/cjs/reactrouterv7.js +2 -1
  12. package/build/cjs/reactrouterv7.js.map +1 -1
  13. package/build/cjs/redux.js +6 -6
  14. package/build/cjs/redux.js.map +1 -1
  15. package/build/cjs/sdk.js +5 -5
  16. package/build/cjs/sdk.js.map +1 -1
  17. package/build/cjs/tanstackrouter.js +8 -8
  18. package/build/cjs/tanstackrouter.js.map +1 -1
  19. package/build/esm/error.js +1 -1
  20. package/build/esm/error.js.map +1 -1
  21. package/build/esm/package.json +1 -1
  22. package/build/esm/reactrouter-compat-utils/route-manifest.js +1 -1
  23. package/build/esm/reactrouter-compat-utils/route-manifest.js.map +1 -1
  24. package/build/esm/reactrouter-compat-utils/utils.js +1 -1
  25. package/build/esm/reactrouter-compat-utils/utils.js.map +1 -1
  26. package/build/esm/reactrouterv3.js +1 -1
  27. package/build/esm/reactrouterv3.js.map +1 -1
  28. package/build/esm/reactrouterv6.js +2 -1
  29. package/build/esm/reactrouterv6.js.map +1 -1
  30. package/build/esm/reactrouterv7.js +2 -1
  31. package/build/esm/reactrouterv7.js.map +1 -1
  32. package/build/esm/redux.js +1 -1
  33. package/build/esm/redux.js.map +1 -1
  34. package/build/esm/sdk.js +1 -1
  35. package/build/esm/sdk.js.map +1 -1
  36. package/build/esm/tanstackrouter.js +1 -1
  37. package/build/esm/tanstackrouter.js.map +1 -1
  38. package/build/types/reactrouter-compat-utils/utils.d.ts +1 -1
  39. package/build/types/reactrouter-compat-utils/utils.d.ts.map +1 -1
  40. package/build/types/reactrouterv3.d.ts +1 -1
  41. package/build/types/reactrouterv3.d.ts.map +1 -1
  42. package/build/types/redux.d.ts +1 -1
  43. package/build/types/redux.d.ts.map +1 -1
  44. package/build/types/sdk.d.ts +1 -1
  45. package/build/types/sdk.d.ts.map +1 -1
  46. package/build/types/tanstackrouter.d.ts +1 -1
  47. package/build/types/tanstackrouter.d.ts.map +1 -1
  48. package/build/types-ts3.8/reactrouter-compat-utils/utils.d.ts +1 -1
  49. package/build/types-ts3.8/reactrouterv3.d.ts +1 -1
  50. package/build/types-ts3.8/redux.d.ts +1 -1
  51. package/build/types-ts3.8/sdk.d.ts +1 -1
  52. package/build/types-ts3.8/tanstackrouter.d.ts +1 -1
  53. package/package.json +3 -3
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- const browser = require('@sentry/browser');
4
- const core = require('@sentry/core');
3
+ const browser$1 = require('@sentry/browser');
4
+ const browser = require('@sentry/core/browser');
5
5
  const React = require('react');
6
6
 
7
7
  /**
@@ -56,7 +56,7 @@ function captureReactException(
56
56
  // Although `componentDidCatch` is typed to accept an `Error` object, it can also be invoked
57
57
  // with non-error objects. This is why we need to check if the error is an error-like object.
58
58
  // See: https://github.com/getsentry/sentry-javascript/issues/6167
59
- if (isAtLeastReact17(React.version) && core.isError(error) && componentStack) {
59
+ if (isAtLeastReact17(React.version) && browser.isError(error) && componentStack) {
60
60
  const errorBoundaryError = new Error(error.message);
61
61
  errorBoundaryError.name = `React ErrorBoundary ${error.name}`;
62
62
  errorBoundaryError.stack = componentStack;
@@ -65,9 +65,9 @@ function captureReactException(
65
65
  setCause(error, errorBoundaryError);
66
66
  }
67
67
 
68
- return browser.withScope(scope => {
68
+ return browser$1.withScope(scope => {
69
69
  scope.setContext('react', { componentStack });
70
- return browser.captureException(error, hint);
70
+ return browser$1.captureException(error, hint);
71
71
  });
72
72
  }
73
73
 
@@ -1 +1 @@
1
- {"version":3,"file":"error.js","sources":["../../src/error.ts"],"sourcesContent":["import { captureException, withScope } from '@sentry/browser';\nimport { isError } from '@sentry/core';\nimport type { ErrorInfo } from 'react';\nimport { version } from 'react';\n\n/**\n * See if React major version is 17+ by parsing version string.\n */\nexport function isAtLeastReact17(reactVersion: string): boolean {\n const reactMajor = reactVersion.match(/^([^.]+)/);\n return reactMajor !== null && parseInt(reactMajor[0]) >= 17;\n}\n\n/**\n * Recurse through `error.cause` chain to set cause on an error.\n */\nexport function setCause(error: Error & { cause?: Error }, cause: Error): void {\n const seenErrors = new WeakSet();\n\n function recurse(error: Error & { cause?: Error }, cause: Error): void {\n // If we've already seen the error, there is a recursive loop somewhere in the error's\n // cause chain. Let's just bail out then to prevent a stack overflow.\n if (seenErrors.has(error)) {\n return;\n }\n if (error.cause) {\n seenErrors.add(error);\n return recurse(error.cause, cause);\n }\n error.cause = cause;\n }\n\n recurse(error, cause);\n}\n\n/**\n * Captures an error that was thrown by a React ErrorBoundary or React root.\n *\n * @param error The error to capture.\n * @param errorInfo The errorInfo provided by React.\n * @param hint Optional additional data to attach to the Sentry event.\n * @returns the id of the captured Sentry event.\n */\nexport function captureReactException(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n error: any,\n { componentStack }: ErrorInfo,\n hint?: Parameters<typeof captureException>[1],\n): string {\n // If on React version >= 17, create stack trace from componentStack param and links\n // to to the original error using `error.cause` otherwise relies on error param for stacktrace.\n // Linking errors requires the `LinkedErrors` integration be enabled.\n // See: https://reactjs.org/blog/2020/08/10/react-v17-rc.html#native-component-stacks\n //\n // Although `componentDidCatch` is typed to accept an `Error` object, it can also be invoked\n // with non-error objects. This is why we need to check if the error is an error-like object.\n // See: https://github.com/getsentry/sentry-javascript/issues/6167\n if (isAtLeastReact17(version) && isError(error) && componentStack) {\n const errorBoundaryError = new Error(error.message);\n errorBoundaryError.name = `React ErrorBoundary ${error.name}`;\n errorBoundaryError.stack = componentStack;\n\n // Using the `LinkedErrors` integration to link the errors together.\n setCause(error, errorBoundaryError);\n }\n\n return withScope(scope => {\n scope.setContext('react', { componentStack });\n return captureException(error, hint);\n });\n}\n\n/**\n * Creates an error handler that can be used with the `onCaughtError`, `onUncaughtError`,\n * and `onRecoverableError` options in `createRoot` and `hydrateRoot` React DOM methods.\n *\n * @param callback An optional callback that will be called after the error is captured.\n * Use this to add custom handling for errors.\n *\n * @example\n *\n * ```JavaScript\n * const root = createRoot(container, {\n * onCaughtError: Sentry.reactErrorHandler(),\n * onUncaughtError: Sentry.reactErrorHandler((error, errorInfo) => {\n * console.warn('Caught error', error, errorInfo.componentStack);\n * });\n * });\n * ```\n */\nexport function reactErrorHandler(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n callback?: (error: any, errorInfo: ErrorInfo, eventId: string) => void,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): (error: any, errorInfo: ErrorInfo) => void {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (error: any, errorInfo: ErrorInfo) => {\n const hasCallback = !!callback;\n const eventId = captureReactException(error, errorInfo, {\n mechanism: { handled: hasCallback, type: 'auto.function.react.error_handler' },\n });\n if (hasCallback) {\n callback(error, errorInfo, eventId);\n }\n };\n}\n"],"names":["version","isError","withScope","captureException"],"mappings":";;;;;;AAKA;AACA;AACA;AACO,SAAS,gBAAgB,CAAC,YAAY,EAAmB;AAChE,EAAE,MAAM,aAAa,YAAY,CAAC,KAAK,CAAC,UAAU,CAAC;AACnD,EAAE,OAAO,UAAA,KAAe,IAAA,IAAQ,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA,IAAK,EAAE;AAC7D;;AAEA;AACA;AACA;AACO,SAAS,QAAQ,CAAC,KAAK,EAA6B,KAAK,EAAe;AAC/E,EAAE,MAA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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAA,iBAAA;AACA;AACA,EAAA,QAAA;AACA;AACA,EAAA;AACA;AACA,EAAA,OAAA,CAAA,KAAA,EAAA,SAAA,KAAA;AACA,IAAA,MAAA,WAAA,GAAA,CAAA,CAAA,QAAA;AACA,IAAA,MAAA,OAAA,GAAA,qBAAA,CAAA,KAAA,EAAA,SAAA,EAAA;AACA,MAAA,SAAA,EAAA,EAAA,OAAA,EAAA,WAAA,EAAA,IAAA,EAAA,mCAAA,EAAA;AACA,KAAA,CAAA;AACA,IAAA,IAAA,WAAA,EAAA;AACA,MAAA,QAAA,CAAA,KAAA,EAAA,SAAA,EAAA,OAAA,CAAA;AACA,IAAA;AACA,EAAA,CAAA;AACA;;;;;;;"}
1
+ {"version":3,"file":"error.js","sources":["../../src/error.ts"],"sourcesContent":["import { captureException, withScope } from '@sentry/browser';\nimport { isError } from '@sentry/core/browser';\nimport type { ErrorInfo } from 'react';\nimport { version } from 'react';\n\n/**\n * See if React major version is 17+ by parsing version string.\n */\nexport function isAtLeastReact17(reactVersion: string): boolean {\n const reactMajor = reactVersion.match(/^([^.]+)/);\n return reactMajor !== null && parseInt(reactMajor[0]) >= 17;\n}\n\n/**\n * Recurse through `error.cause` chain to set cause on an error.\n */\nexport function setCause(error: Error & { cause?: Error }, cause: Error): void {\n const seenErrors = new WeakSet();\n\n function recurse(error: Error & { cause?: Error }, cause: Error): void {\n // If we've already seen the error, there is a recursive loop somewhere in the error's\n // cause chain. Let's just bail out then to prevent a stack overflow.\n if (seenErrors.has(error)) {\n return;\n }\n if (error.cause) {\n seenErrors.add(error);\n return recurse(error.cause, cause);\n }\n error.cause = cause;\n }\n\n recurse(error, cause);\n}\n\n/**\n * Captures an error that was thrown by a React ErrorBoundary or React root.\n *\n * @param error The error to capture.\n * @param errorInfo The errorInfo provided by React.\n * @param hint Optional additional data to attach to the Sentry event.\n * @returns the id of the captured Sentry event.\n */\nexport function captureReactException(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n error: any,\n { componentStack }: ErrorInfo,\n hint?: Parameters<typeof captureException>[1],\n): string {\n // If on React version >= 17, create stack trace from componentStack param and links\n // to to the original error using `error.cause` otherwise relies on error param for stacktrace.\n // Linking errors requires the `LinkedErrors` integration be enabled.\n // See: https://reactjs.org/blog/2020/08/10/react-v17-rc.html#native-component-stacks\n //\n // Although `componentDidCatch` is typed to accept an `Error` object, it can also be invoked\n // with non-error objects. This is why we need to check if the error is an error-like object.\n // See: https://github.com/getsentry/sentry-javascript/issues/6167\n if (isAtLeastReact17(version) && isError(error) && componentStack) {\n const errorBoundaryError = new Error(error.message);\n errorBoundaryError.name = `React ErrorBoundary ${error.name}`;\n errorBoundaryError.stack = componentStack;\n\n // Using the `LinkedErrors` integration to link the errors together.\n setCause(error, errorBoundaryError);\n }\n\n return withScope(scope => {\n scope.setContext('react', { componentStack });\n return captureException(error, hint);\n });\n}\n\n/**\n * Creates an error handler that can be used with the `onCaughtError`, `onUncaughtError`,\n * and `onRecoverableError` options in `createRoot` and `hydrateRoot` React DOM methods.\n *\n * @param callback An optional callback that will be called after the error is captured.\n * Use this to add custom handling for errors.\n *\n * @example\n *\n * ```JavaScript\n * const root = createRoot(container, {\n * onCaughtError: Sentry.reactErrorHandler(),\n * onUncaughtError: Sentry.reactErrorHandler((error, errorInfo) => {\n * console.warn('Caught error', error, errorInfo.componentStack);\n * });\n * });\n * ```\n */\nexport function reactErrorHandler(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n callback?: (error: any, errorInfo: ErrorInfo, eventId: string) => void,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): (error: any, errorInfo: ErrorInfo) => void {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (error: any, errorInfo: ErrorInfo) => {\n const hasCallback = !!callback;\n const eventId = captureReactException(error, errorInfo, {\n mechanism: { handled: hasCallback, type: 'auto.function.react.error_handler' },\n });\n if (hasCallback) {\n callback(error, errorInfo, eventId);\n }\n };\n}\n"],"names":["version","isError","withScope","captureException"],"mappings":";;;;;;AAKA;AACA;AACA;AACO,SAAS,gBAAgB,CAAC,YAAY,EAAmB;AAChE,EAAE,MAAM,aAAa,YAAY,CAAC,KAAK,CAAC,UAAU,CAAC;AACnD,EAAE,OAAO,UAAA,KAAe,IAAA,IAAQ,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA,IAAK,EAAE;AAC7D;;AAEA;AACA;AACA;AACO,SAAS,QAAQ,CAAC,KAAK,EAA6B,KAAK,EAAe;AAC/E,EAAE,MAAM,UAAA,GAAa,IAAI,OAAO,EAAE;;AAElC,EAAE,SAAS,OAAO,CAAC,KAAK,EAA6B,KAAK,EAAe;AACzE;AACA;AACA,IAAI,IAAI,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;AAC/B,MAAM;AACN,IAAI;AACJ,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE;AACrB,MAAM,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC;AAC3B,MAAM,OAAO,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC;AACxC,IAAI;AACJ,IAAI,KAAK,CAAC,KAAA,GAAQ,KAAK;AACvB,EAAE;;AAEF,EAAE,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;AACvB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,qBAAqB;AACrC;AACA,EAAE,KAAK;AACP,EAAE,EAAE,gBAAgB;AACpB,EAAE,IAAI;AACN,EAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,IAAI,gBAAgB,CAACA,aAAO,CAAA,IAAKC,eAAO,CAAC,KAAK,CAAA,IAAK,cAAc,EAAE;AACrE,IAAI,MAAM,qBAAqB,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC;AACvD,IAAI,kBAAkB,CAAC,IAAA,GAAO,CAAC,oBAAoB,EAAE,KAAK,CAAC,IAAI,CAAC,CAAA;AACA,IAAA,kBAAA,CAAA,KAAA,GAAA,cAAA;;AAEA;AACA,IAAA,QAAA,CAAA,KAAA,EAAA,kBAAA,CAAA;AACA,EAAA;;AAEA,EAAA,OAAAC,mBAAA,CAAA,KAAA,IAAA;AACA,IAAA,KAAA,CAAA,UAAA,CAAA,OAAA,EAAA,EAAA,cAAA,EAAA,CAAA;AACA,IAAA,OAAAC,0BAAA,CAAA,KAAA,EAAA,IAAA,CAAA;AACA,EAAA,CAAA,CAAA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAA,iBAAA;AACA;AACA,EAAA,QAAA;AACA;AACA,EAAA;AACA;AACA,EAAA,OAAA,CAAA,KAAA,EAAA,SAAA,KAAA;AACA,IAAA,MAAA,WAAA,GAAA,CAAA,CAAA,QAAA;AACA,IAAA,MAAA,OAAA,GAAA,qBAAA,CAAA,KAAA,EAAA,SAAA,EAAA;AACA,MAAA,SAAA,EAAA,EAAA,OAAA,EAAA,WAAA,EAAA,IAAA,EAAA,mCAAA,EAAA;AACA,KAAA,CAAA;AACA,IAAA,IAAA,WAAA,EAAA;AACA,MAAA,QAAA,CAAA,KAAA,EAAA,SAAA,EAAA,OAAA,CAAA;AACA,IAAA;AACA,EAAA,CAAA;AACA;;;;;;;"}
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- const core = require('@sentry/core');
3
+ const browser = require('@sentry/core/browser');
4
4
  const debugBuild = require('../debug-build.js');
5
5
 
6
6
  /**
@@ -48,17 +48,17 @@ function matchRouteManifest(pathname, manifest, basename) {
48
48
  if (!sorted) {
49
49
  sorted = sortBySpecificity(manifest);
50
50
  SORTED_MANIFEST_CACHE.set(manifest, sorted);
51
- debugBuild.DEBUG_BUILD && core.debug.log('[React Router] Sorted route manifest by specificity:', sorted.length, 'patterns');
51
+ debugBuild.DEBUG_BUILD && browser.debug.log('[React Router] Sorted route manifest by specificity:', sorted.length, 'patterns');
52
52
  }
53
53
 
54
54
  for (const pattern of sorted) {
55
55
  if (matchesPattern(normalizedPathname, pattern)) {
56
- debugBuild.DEBUG_BUILD && core.debug.log('[React Router] Matched pathname', normalizedPathname, 'to pattern', pattern);
56
+ debugBuild.DEBUG_BUILD && browser.debug.log('[React Router] Matched pathname', normalizedPathname, 'to pattern', pattern);
57
57
  return pattern;
58
58
  }
59
59
  }
60
60
 
61
- debugBuild.DEBUG_BUILD && core.debug.log('[React Router] No manifest match found for pathname:', normalizedPathname);
61
+ debugBuild.DEBUG_BUILD && browser.debug.log('[React Router] No manifest match found for pathname:', normalizedPathname);
62
62
  return null;
63
63
  }
64
64
 
@@ -1 +1 @@
1
- {"version":3,"file":"route-manifest.js","sources":["../../../src/reactrouter-compat-utils/route-manifest.ts"],"sourcesContent":["import { debug } from '@sentry/core';\nimport { DEBUG_BUILD } from '../debug-build';\n\n/**\n * Strip the basename from a pathname if exists.\n *\n * Vendored and modified from `react-router`\n * https://github.com/remix-run/react-router/blob/462bb712156a3f739d6139a0f14810b76b002df6/packages/router/utils.ts#L1038\n */\nexport function stripBasenameFromPathname(pathname: string, basename: string): string {\n if (!basename || basename === '/') {\n return pathname;\n }\n\n if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {\n return pathname;\n }\n\n // We want to leave trailing slash behavior in the user's control, so if they\n // specify a basename with a trailing slash, we should support it\n const startIndex = basename.endsWith('/') ? basename.length - 1 : basename.length;\n const nextChar = pathname.charAt(startIndex);\n if (nextChar && nextChar !== '/') {\n // pathname does not start with basename/\n return pathname;\n }\n\n return pathname.slice(startIndex) || '/';\n}\n\n// Cache for sorted manifests - keyed by manifest array reference\nconst SORTED_MANIFEST_CACHE = new WeakMap<string[], string[]>();\n\n/**\n * Matches a pathname against a route manifest and returns the matching pattern.\n * Optionally strips a basename prefix before matching.\n */\nexport function matchRouteManifest(pathname: string, manifest: string[], basename?: string): string | null {\n if (!pathname || !manifest?.length) {\n return null;\n }\n\n const normalizedPathname = basename ? stripBasenameFromPathname(pathname, basename) : pathname;\n\n let sorted = SORTED_MANIFEST_CACHE.get(manifest);\n if (!sorted) {\n sorted = sortBySpecificity(manifest);\n SORTED_MANIFEST_CACHE.set(manifest, sorted);\n DEBUG_BUILD && debug.log('[React Router] Sorted route manifest by specificity:', sorted.length, 'patterns');\n }\n\n for (const pattern of sorted) {\n if (matchesPattern(normalizedPathname, pattern)) {\n DEBUG_BUILD && debug.log('[React Router] Matched pathname', normalizedPathname, 'to pattern', pattern);\n return pattern;\n }\n }\n\n DEBUG_BUILD && debug.log('[React Router] No manifest match found for pathname:', normalizedPathname);\n return null;\n}\n\n/**\n * Checks if a pathname matches a route pattern.\n */\nfunction matchesPattern(pathname: string, pattern: string): boolean {\n // Handle root path special case\n if (pattern === '/') {\n return pathname === '/' || pathname === '';\n }\n\n const pathSegments = splitPath(pathname);\n const patternSegments = splitPath(pattern);\n\n // Handle wildcard at end\n const hasWildcard = patternSegments.length > 0 && patternSegments[patternSegments.length - 1] === '*';\n\n if (hasWildcard) {\n // Pattern with wildcard: path must have at least as many segments as pattern (minus wildcard)\n const patternSegmentsWithoutWildcard = patternSegments.slice(0, -1);\n if (pathSegments.length < patternSegmentsWithoutWildcard.length) {\n return false;\n }\n for (const [i, patternSegment] of patternSegmentsWithoutWildcard.entries()) {\n if (!segmentMatches(pathSegments[i], patternSegment)) {\n return false;\n }\n }\n return true;\n }\n\n // Exact segment count match required\n if (pathSegments.length !== patternSegments.length) {\n return false;\n }\n\n for (const [i, patternSegment] of patternSegments.entries()) {\n if (!segmentMatches(pathSegments[i], patternSegment)) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Checks if a path segment matches a pattern segment.\n */\nfunction segmentMatches(pathSegment: string | undefined, patternSegment: string | undefined): boolean {\n if (pathSegment === undefined || patternSegment === undefined) {\n return false;\n }\n // Parameter matches anything\n if (PARAM_RE.test(patternSegment)) {\n return true;\n }\n // Literal must match exactly\n return pathSegment === patternSegment;\n}\n\n/**\n * Splits a path into segments, filtering out empty strings.\n */\nfunction splitPath(path: string): string[] {\n return path.split('/').filter(Boolean);\n}\n\n/**\n * React Router scoring weights and param detection.\n * https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/router/utils.ts\n */\nconst PARAM_RE = /^:[\\w-]+$/;\nconst STATIC_SEGMENT_SCORE = 10;\nconst DYNAMIC_SEGMENT_SCORE = 3;\nconst EMPTY_SEGMENT_SCORE = 1;\nconst SPLAT_PENALTY = -2;\n\n/**\n * Computes a specificity score for a route pattern.\n * Matches React Router's computeScore() algorithm exactly.\n */\nfunction computeScore(pattern: string): number {\n const segments = pattern.split('/');\n\n // Base score is segment count (including empty segment from leading slash)\n let score = segments.length;\n\n // Apply splat penalty once if pattern contains wildcard\n if (segments.includes('*')) {\n score += SPLAT_PENALTY;\n }\n\n for (const segment of segments) {\n if (segment === '*') {\n // Splat penalty already applied globally above\n continue;\n } else if (PARAM_RE.test(segment)) {\n score += DYNAMIC_SEGMENT_SCORE;\n } else if (segment === '') {\n score += EMPTY_SEGMENT_SCORE;\n } else {\n score += STATIC_SEGMENT_SCORE;\n }\n }\n\n return score;\n}\n\n/**\n * Sorts route patterns by specificity (most specific first).\n * Implements React Router's ranking algorithm from computeScore():\n * https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/router/utils.ts\n *\n * React Router scoring: base=segments.length, static=+10, dynamic=+3, empty=+1, splat=-2 (once)\n * Higher score = more specific pattern.\n * Equal scores preserve manifest order (same as React Router).\n *\n * Note: Users should order their manifest from most specific to least specific\n * when patterns have equal specificity (e.g., `/users/:id/settings` and `/:type/123/settings`).\n */\nfunction sortBySpecificity(manifest: string[]): string[] {\n return [...manifest].sort((a, b) => {\n const aScore = computeScore(a);\n const bScore = computeScore(b);\n\n return bScore - aScore;\n });\n}\n"],"names":["DEBUG_BUILD","debug"],"mappings":";;;;;AAGA;AACA;AACA;AACA;AACA;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MAAM,WAAW,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC;;AAErC;AACA,EAAE,IAAI,KAAA,GAAQ,QAAQ,CAAC,MAAM;;AAE7B;AACA,EAAE,IAAI,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;AAC9B,IAAI,KAAA,IAAS,aAAa;AAC1B,EAAE;;AAEF,EAAE,KAAK,MAAM,OAAA,IAAW,QAAQ,EAAE;AAClC,IAAI,IAAI,OAAA,KAAY,GAAG,EAAE;AACzB;AACA,MAAM;AACN,IAAI,CAAA,MAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;AACvC,MAAM,KAAA,IAAS,qBAAqB;AACpC,IAAI,OAAO,IAAI,OAAA,KAAY,EAAE,EAAE;AAC/B,MAAM,KAAA,IAAS,mBAAmB;AAClC,IAAI,OAAO;AACX,MAAM,KAAA,IAAS,oBAAoB;AACnC,IAAI;AACJ,EAAE;;AAEF,EAAE,OAAO,KAAK;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,iBAAiB,CAAC,QAAQ,EAAsB;AACzD,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK;AACtC,IAAI,MAAM,MAAA,GAAS,YAAY,CAAC,CAAC,CAAC;AAClC,IAAI,MAAM,MAAA,GAAS,YAAY,CAAC,CAAC,CAAC;;AAElC,IAAI,OAAO,MAAA,GAAS,MAAM;AAC1B,EAAE,CAAC,CAAC;AACJ;;;;;"}
1
+ {"version":3,"file":"route-manifest.js","sources":["../../../src/reactrouter-compat-utils/route-manifest.ts"],"sourcesContent":["import { debug } from '@sentry/core/browser';\nimport { DEBUG_BUILD } from '../debug-build';\n\n/**\n * Strip the basename from a pathname if exists.\n *\n * Vendored and modified from `react-router`\n * https://github.com/remix-run/react-router/blob/462bb712156a3f739d6139a0f14810b76b002df6/packages/router/utils.ts#L1038\n */\nexport function stripBasenameFromPathname(pathname: string, basename: string): string {\n if (!basename || basename === '/') {\n return pathname;\n }\n\n if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {\n return pathname;\n }\n\n // We want to leave trailing slash behavior in the user's control, so if they\n // specify a basename with a trailing slash, we should support it\n const startIndex = basename.endsWith('/') ? basename.length - 1 : basename.length;\n const nextChar = pathname.charAt(startIndex);\n if (nextChar && nextChar !== '/') {\n // pathname does not start with basename/\n return pathname;\n }\n\n return pathname.slice(startIndex) || '/';\n}\n\n// Cache for sorted manifests - keyed by manifest array reference\nconst SORTED_MANIFEST_CACHE = new WeakMap<string[], string[]>();\n\n/**\n * Matches a pathname against a route manifest and returns the matching pattern.\n * Optionally strips a basename prefix before matching.\n */\nexport function matchRouteManifest(pathname: string, manifest: string[], basename?: string): string | null {\n if (!pathname || !manifest?.length) {\n return null;\n }\n\n const normalizedPathname = basename ? stripBasenameFromPathname(pathname, basename) : pathname;\n\n let sorted = SORTED_MANIFEST_CACHE.get(manifest);\n if (!sorted) {\n sorted = sortBySpecificity(manifest);\n SORTED_MANIFEST_CACHE.set(manifest, sorted);\n DEBUG_BUILD && debug.log('[React Router] Sorted route manifest by specificity:', sorted.length, 'patterns');\n }\n\n for (const pattern of sorted) {\n if (matchesPattern(normalizedPathname, pattern)) {\n DEBUG_BUILD && debug.log('[React Router] Matched pathname', normalizedPathname, 'to pattern', pattern);\n return pattern;\n }\n }\n\n DEBUG_BUILD && debug.log('[React Router] No manifest match found for pathname:', normalizedPathname);\n return null;\n}\n\n/**\n * Checks if a pathname matches a route pattern.\n */\nfunction matchesPattern(pathname: string, pattern: string): boolean {\n // Handle root path special case\n if (pattern === '/') {\n return pathname === '/' || pathname === '';\n }\n\n const pathSegments = splitPath(pathname);\n const patternSegments = splitPath(pattern);\n\n // Handle wildcard at end\n const hasWildcard = patternSegments.length > 0 && patternSegments[patternSegments.length - 1] === '*';\n\n if (hasWildcard) {\n // Pattern with wildcard: path must have at least as many segments as pattern (minus wildcard)\n const patternSegmentsWithoutWildcard = patternSegments.slice(0, -1);\n if (pathSegments.length < patternSegmentsWithoutWildcard.length) {\n return false;\n }\n for (const [i, patternSegment] of patternSegmentsWithoutWildcard.entries()) {\n if (!segmentMatches(pathSegments[i], patternSegment)) {\n return false;\n }\n }\n return true;\n }\n\n // Exact segment count match required\n if (pathSegments.length !== patternSegments.length) {\n return false;\n }\n\n for (const [i, patternSegment] of patternSegments.entries()) {\n if (!segmentMatches(pathSegments[i], patternSegment)) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Checks if a path segment matches a pattern segment.\n */\nfunction segmentMatches(pathSegment: string | undefined, patternSegment: string | undefined): boolean {\n if (pathSegment === undefined || patternSegment === undefined) {\n return false;\n }\n // Parameter matches anything\n if (PARAM_RE.test(patternSegment)) {\n return true;\n }\n // Literal must match exactly\n return pathSegment === patternSegment;\n}\n\n/**\n * Splits a path into segments, filtering out empty strings.\n */\nfunction splitPath(path: string): string[] {\n return path.split('/').filter(Boolean);\n}\n\n/**\n * React Router scoring weights and param detection.\n * https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/router/utils.ts\n */\nconst PARAM_RE = /^:[\\w-]+$/;\nconst STATIC_SEGMENT_SCORE = 10;\nconst DYNAMIC_SEGMENT_SCORE = 3;\nconst EMPTY_SEGMENT_SCORE = 1;\nconst SPLAT_PENALTY = -2;\n\n/**\n * Computes a specificity score for a route pattern.\n * Matches React Router's computeScore() algorithm exactly.\n */\nfunction computeScore(pattern: string): number {\n const segments = pattern.split('/');\n\n // Base score is segment count (including empty segment from leading slash)\n let score = segments.length;\n\n // Apply splat penalty once if pattern contains wildcard\n if (segments.includes('*')) {\n score += SPLAT_PENALTY;\n }\n\n for (const segment of segments) {\n if (segment === '*') {\n // Splat penalty already applied globally above\n continue;\n } else if (PARAM_RE.test(segment)) {\n score += DYNAMIC_SEGMENT_SCORE;\n } else if (segment === '') {\n score += EMPTY_SEGMENT_SCORE;\n } else {\n score += STATIC_SEGMENT_SCORE;\n }\n }\n\n return score;\n}\n\n/**\n * Sorts route patterns by specificity (most specific first).\n * Implements React Router's ranking algorithm from computeScore():\n * https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/router/utils.ts\n *\n * React Router scoring: base=segments.length, static=+10, dynamic=+3, empty=+1, splat=-2 (once)\n * Higher score = more specific pattern.\n * Equal scores preserve manifest order (same as React Router).\n *\n * Note: Users should order their manifest from most specific to least specific\n * when patterns have equal specificity (e.g., `/users/:id/settings` and `/:type/123/settings`).\n */\nfunction sortBySpecificity(manifest: string[]): string[] {\n return [...manifest].sort((a, b) => {\n const aScore = computeScore(a);\n const bScore = computeScore(b);\n\n return bScore - aScore;\n });\n}\n"],"names":["DEBUG_BUILD","debug"],"mappings":";;;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,yBAAyB,CAAC,QAAQ,EAAU,QAAQ,EAAkB;AACtF,EAAE,IAAI,CAAC,QAAA,IAAY,QAAA,KAAa,GAAG,EAAE;AACrC,IAAI,OAAO,QAAQ;AACnB,EAAE;;AAEF,EAAE,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,EAAE;AAClE,IAAI,OAAO,QAAQ;AACnB,EAAE;;AAEF;AACA;AACA,EAAE,MAAM,UAAA,GAAa,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAA,GAAI,QAAQ,CAAC,MAAA,GAAS,IAAI,QAAQ,CAAC,MAAM;AACnF,EAAE,MAAM,WAAW,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC;AAC9C,EAAE,IAAI,QAAA,IAAY,QAAA,KAAa,GAAG,EAAE;AACpC;AACA,IAAI,OAAO,QAAQ;AACnB,EAAE;;AAEF,EAAE,OAAO,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAA,IAAK,GAAG;AAC1C;;AAEA;AACA,MAAM,qBAAA,GAAwB,IAAI,OAAO,EAAsB;;AAE/D;A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OAAO,CAAC,GAAG,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK;AACtC,IAAI,MAAM,MAAA,GAAS,YAAY,CAAC,CAAC,CAAC;AAClC,IAAI,MAAM,MAAA,GAAS,YAAY,CAAC,CAAC,CAAC;;AAElC,IAAI,OAAO,MAAA,GAAS,MAAM;AAC1B,EAAE,CAAC,CAAC;AACJ;;;;;"}
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- const core = require('@sentry/core');
3
+ const browser = require('@sentry/core/browser');
4
4
  const debugBuild = require('../debug-build.js');
5
5
  const routeManifest = require('./route-manifest.js');
6
6
 
@@ -22,7 +22,7 @@ function setNavigationContext(targetPath, span) {
22
22
  const token = {};
23
23
  // Prevent unbounded stack growth - oldest (likely stale) contexts are evicted first
24
24
  if (_navigationContextStack.length >= MAX_CONTEXT_STACK_SIZE) {
25
- debugBuild.DEBUG_BUILD && core.debug.warn('[React Router] Navigation context stack overflow - removing oldest context');
25
+ debugBuild.DEBUG_BUILD && browser.debug.warn('[React Router] Navigation context stack overflow - removing oldest context');
26
26
  _navigationContextStack.shift();
27
27
  }
28
28
  _navigationContextStack.push({ token, targetPath, span });
@@ -305,14 +305,14 @@ function resolveRouteNameAndSource(
305
305
  * Gets the active root span if it's a pageload or navigation span.
306
306
  */
307
307
  function getActiveRootSpan() {
308
- const span = core.getActiveSpan();
309
- const rootSpan = span ? core.getRootSpan(span) : undefined;
308
+ const span = browser.getActiveSpan();
309
+ const rootSpan = span ? browser.getRootSpan(span) : undefined;
310
310
 
311
311
  if (!rootSpan) {
312
312
  return undefined;
313
313
  }
314
314
 
315
- const op = core.spanToJSON(rootSpan).op;
315
+ const op = browser.spanToJSON(rootSpan).op;
316
316
 
317
317
  // Only use this root span if it is a pageload or navigation span
318
318
  return op === 'navigation' || op === 'pageload' ? rootSpan : undefined;
@@ -1 +1 @@
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';\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 * 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 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).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"],"mappings":";;;;;;AAMA;AACA,IAAI,YAAY;AAChB,IAAI,cAAc,GAAY,KAAK;;AAEnC;AACA;;AAOA,MAAM,uBAAuB,GAAwB,EAAE;AACvD,MAAM,sBAAA,GAAyB,EAAE;;AAEjC;AACA;AACA;AACA;AACO,SAAS,oBAAoB,CAAC,UAAU,EAAsB,IAAI,EAA4B;AACrG,EAAE,MAAM,KAAA,GAAQ,EAAE;AAClB;AACA,EAAE,IAAI,uBAAuB,CAAC,MAAA,IAAU,sBAAsB,EAAE;AAChE,IAAIA,0BAAeC,UAAK,CAAC,IAAI,CAAC,4EAA4E,CAAC;AAC3G,IAAI,uBAAuB,CAAC,KAAK,EAAE;AACnC,EAAE;AACF,EAAE,uBAAuB,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,IAAA,EAAM,CAAC;AAC3D,EAAE,OAAO,KAAK;AACd;;AAEA;AACA;AACA;AACA;AACA;AACO,SAAS,sBAAsB,CAAC,KAAK,EAAgB;AAC5D,EAAE,MAAM,GAAA,GAAM,uBAAuB,CAAC,uBAAuB,CAAC,MAAA,GAAS,CAAC,CAAC;A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A,EAAA;AACA,EAAA,MAAA,QAAA,GAAA,IAAA,GAAAC,gBAAA,CAAA,IAAA,CAAA,GAAA,SAAA;;AAEA,EAAA,IAAA,CAAA,QAAA,EAAA;AACA,IAAA,OAAA,SAAA;AACA,EAAA;;AAEA,EAAA,MAAA,EAAA,GAAAC,eAAA,CAAA,QAAA,CAAA,CAAA,EAAA;;AAEA;AACA,EAAA,OAAA,EAAA,KAAA,YAAA,IAAA,EAAA,KAAA,UAAA,GAAA,QAAA,GAAA,SAAA;AACA;;;;;;;;;;;;;;;;;;"}
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';\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 * 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 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).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"],"mappings":";;;;;;AAMA;AACA,IAAI,YAAY;AAChB,IAAI,cAAc,GAAY,KAAK;;AAEnC;AACA;;AAOA,MAAM,uBAAuB,GAAwB,EAAE;AACvD,MAAM,sBAAA,GAAyB,EAAE;;AAEjC;AACA;AACA;AACA;AACO,SAAS,oBAAoB,CAAC,UAAU,EAAsB,IAAI,EAA4B;AACrG,EAAE,MAAM,KAAA,GAAQ,EAAE;AAClB;AACA,EAAE,IAAI,uBAAuB,CAAC,MAAA,IAAU,sBAAsB,EAAE;AA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CAAA;AACA,IAAA,MAAA,GAAA,OAAA;AACA,EAAA;;AAEA,EAAA,IAAA,CAAA,mBAAA,IAAA,CAAA,IAAA,EAAA;AACA,IAAA,CAAA,IAAA,EAAA,MAAA,CAAA,GAAA,iBAAA,CAAA,MAAA,EAAA,QAAA,EAAA,QAAA,EAAA,QAAA,CAAA;AACA,EAAA;;AAEA,EAAA,OAAA,CAAA,IAAA,IAAA,QAAA,CAAA,QAAA,EAAA,MAAA,CAAA;AACA;;AAEA;AACA;AACA;AACA,SAAA,iBAAA,GAAA;AACA,EAAA,MAAA,IAAA,GAAAC,qBAAA,EAAA;AACA,EAAA,MAAA,QAAA,GAAA,IAAA,GAAAC,mBAAA,CAAA,IAAA,CAAA,GAAA,SAAA;;AAEA,EAAA,IAAA,CAAA,QAAA,EAAA;AACA,IAAA,OAAA,SAAA;AACA,EAAA;;AAEA,EAAA,MAAA,EAAA,GAAAC,kBAAA,CAAA,QAAA,CAAA,CAAA,EAAA;;AAEA;AACA,EAAA,OAAA,EAAA,KAAA,YAAA,IAAA,EAAA,KAAA,UAAA,GAAA,QAAA,GAAA,SAAA;AACA;;;;;;;;;;;;;;;;;;"}
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const browser = require('@sentry/browser');
4
- const core = require('@sentry/core');
4
+ const browser$1 = require('@sentry/core/browser');
5
5
 
6
6
  // Many of the types below had to be mocked out to prevent typescript issues
7
7
  // these types are required for correct functionality.
@@ -35,9 +35,9 @@ function reactRouterV3BrowserTracingIntegration(
35
35
  browser.startBrowserTracingPageLoadSpan(client, {
36
36
  name: localName,
37
37
  attributes: {
38
- [core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload',
39
- [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v3',
40
- [core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,
38
+ [browser$1.SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload',
39
+ [browser$1.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v3',
40
+ [browser$1.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,
41
41
  },
42
42
  });
43
43
  },
@@ -55,9 +55,9 @@ function reactRouterV3BrowserTracingIntegration(
55
55
  browser.startBrowserTracingNavigationSpan(client, {
56
56
  name: localName,
57
57
  attributes: {
58
- [core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',
59
- [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v3',
60
- [core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,
58
+ [browser$1.SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',
59
+ [browser$1.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v3',
60
+ [browser$1.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,
61
61
  },
62
62
  });
63
63
  },
@@ -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';\nimport {\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n} from '@sentry/core';\nimport type { Location } from './types';\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 as unknown as 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 },\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 },\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","startBrowserTracingNavigationSpan"],"mappings":";;;;;AAcA;AACA;;AAuBA;AACA;AACA;AACA;AACO,SAAS,sCAAsC;AACtD,EAAE,OAAO;AACT,EAAe;AACf,EAAE,MAAM,WAAA,GAAcA,iCAAyB,CAAC;AAChD,IAAI,GAAG,OAAO;AACd,IAAI,kBAAkB,EAAE,KAAK;AAC7B,IAAI,oBAAoB,EAAE,KAAK;AAC/B,GAAG,CAAC;;AAEJ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAA,GAAqB,IAAI,EAAE,oBAAA,GAAuB,IAAA,EAAK,GAAI,OAAO;;AA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CAAC,MAAA,GAAS,CAAC,EAAE,CAAA,IAAK,CAAC,EAAE,CAAC,EAAE,EAAE;AACxD;AACA,IAAI,MAAM,KAAA,GAAQ,eAAe,CAAC,CAAC,CAAC;AACpC,IAAI,IAAI,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE;AACrC,MAAM,KAAA,GAAQ,CAAC;AACf,MAAM;AACN,IAAI;AACJ,EAAE;;AAEF,EAAE,OAAO,eAAe,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,IAAA,EAAM,KAAK;AAChE,IAAI,MAAM,WAAA,GAAc,QAAQ,GAAA,IAAO,GAAA,KAAQ,EAAA,GAAK,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,CAAA;AACA,IAAA,OAAA,CAAA,EAAA,GAAA,CAAA,EAAA,WAAA,CAAA,CAAA;AACA,EAAA,CAAA,EAAA,EAAA,CAAA;AACA;;;;"}
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';\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 as unknown as 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 },\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 },\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","startBrowserTracingNavigationSpan"],"mappings":";;;;;AAcA;AACA;;AAuBA;AACA;AACA;AACA;AACO,SAAS,sCAAsC;AACtD,EAAE,OAAO;AACT,EAAe;AACf,EAAE,MAAM,WAAA,GAAcA,iCAAyB,CAAC;AAChD,IAAI,GAAG,OAAO;AACd,IAAI,kBAAkB,EAAE,KAAK;AAC7B,IAAI,oBAAoB,EAAE,KAAK;AAC/B,GAAG,CAAC;;AAEJ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAA,GAAqB,IAAI,EAAE,oBAAA,GAAuB,IAAA,EAAK,GAAI,OAAO;;AAEpG,EAAE,OAAO;AACT,IAAI,GAAG,WAAW;AAClB,IAAI,aAA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AAC,EAAE,EAAE;AACxD;AACA,IAAI,MAAM,KAAA,GAAQ,eAAe,CAAC,CAAC,CAAC;AACpC,IAAI,IAAI,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE;AACrC,MAAM,KAAA,GAAQ,CAAC;AACf,MAAM;AACN,IAAI;AACJ,EAAE;;AAEF,EAAE,OAAO,eAAe,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,IAAA,EAAM,KAAK;AAChE,IAAI,MAAM,WAAA,GAAc,QAAQ,GAAA,IAAO,GAAA,KAAQ,EAAA,GAAK,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,CAAA;AACA,IAAA,OAAA,CAAA,EAAA,GAAA,CAAA,EAAA,WAAA,CAAA,CAAA;AACA,EAAA,CAAA,EAAA,EAAA,CAAA;AACA;;;;"}
@@ -1,8 +1,9 @@
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');
4
+ require('@sentry/core/browser');
5
5
  require('@sentry/browser');
6
+ require('@sentry/core');
6
7
 
7
8
  /**
8
9
  * A browser tracing integration that uses React Router v6 to instrument navigations.
@@ -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 */\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 */\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 */\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 */\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// 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":";;;;;;AAYA;AACA;AACA;AACA;AACO,SAAS,sCAAsC;AACtD,EAAE,OAAO;AACT,EAAe;AACf,EAAE,OAAOA,+DAA+C,CAAC,OAAO,EAAE,GAAG,CAAC;AACtE;;AAEA;AACA;AACA;AACA;AACO,SAAS,eAAe,CAAC,aAAa,EAAwB;AACrE,EAAE,OAAOC,+CAA+B,CAAC,aAAa,EAAE,GAAG,CAAC;AAC5D;;AAEA;AACA;AACA;AACA;AACO,SAAS;;AAGhB,CAAE,oBAAoB,EAAgF;AACtG,EAAE,OAAOC,yDAAyC,CAAC,oBAAoB,EAAE,GAAG,CAAC;AAC7E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS;;AAGhB,CAAE,0BAA0B,EAAgF;AAC5G,EAAE,OAAOC,wDAAwC,CAAC,0BAA0B,EAAE,GAAG,CAAC;AAClF;;AAEA;AACA;AACA;AACA;AACA;AACO,SAAS,8BAA8B,CAAuD,MAAM,EAAQ;AACnH,EAAE,OAAOC,8DAA8C,CAAO,MAAM,EAAE,GAAG,CAAC;AAC1E;;;;;;;;"}
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 */\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 */\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 */\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 */\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// 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":";;;;;;;AAYA;AACA;AACA;AACA;AACO,SAAS,sCAAsC;AACtD,EAAE,OAAO;AACT,EAAe;AACf,EAAE,OAAOA,+DAA+C,CAAC,OAAO,EAAE,GAAG,CAAC;AACtE;;AAEA;AACA;AACA;AACA;AACO,SAAS,eAAe,CAAC,aAAa,EAAwB;AACrE,EAAE,OAAOC,+CAA+B,CAAC,aAAa,EAAE,GAAG,CAAC;AAC5D;;AAEA;AACA;AACA;AACA;AACO,SAAS;;AAGhB,CAAE,oBAAoB,EAAgF;AACtG,EAAE,OAAOC,yDAAyC,CAAC,oBAAoB,EAAE,GAAG,CAAC;AAC7E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS;;AAGhB,CAAE,0BAA0B,EAAgF;AAC5G,EAAE,OAAOC,wDAAwC,CAAC,0BAA0B,EAAE,GAAG,CAAC;AAClF;;AAEA;AACA;AACA;AACA;AACA;AACO,SAAS,8BAA8B,CAAuD,MAAM,EAAQ;AACnH,EAAE,OAAOC,8DAA8C,CAAO,MAAM,EAAE,GAAG,CAAC;AAC1E;;;;;;;;"}
@@ -1,8 +1,9 @@
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');
4
+ require('@sentry/core/browser');
5
5
  require('@sentry/browser');
6
+ require('@sentry/core');
6
7
 
7
8
  /**
8
9
  * A browser tracing integration that uses React Router v7 to instrument navigations.
@@ -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 */\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// 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 */\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 */\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 */\nexport function wrapUseRoutesV7(origUseRoutes: UseRoutes): UseRoutes {\n return createV6CompatibleWrapUseRoutes(origUseRoutes, '7');\n}\n"],"names":["createReactRouterV6CompatibleTracingIntegration","createV6CompatibleWithSentryReactRouterRouting","createV6CompatibleWrapCreateBrowserRouter","createV6CompatibleWrapCreateMemoryRouter","createV6CompatibleWrapUseRoutes"],"mappings":";;;;;;AAaA;AACA;AACA;AACA;AACO,SAAS,sCAAsC;AACtD,EAAE,OAAO;AACT,EAAe;AACf,EAAE,OAAOA,+DAA+C,CAAC,OAAO,EAAE,GAAG,CAAC;AACtE;;AAEA;AACA;AACA;AACA;AACA;AACO,SAAS,8BAA8B,CAAuD,MAAM,EAAQ;AACnH,EAAE,OAAOC,8DAA8C,CAAO,MAAM,EAAE,GAAG,CAAC;AAC1E;;AAEA;AACA;AACA;AACA;AACO,SAAS;;AAGhB,CAAE,oBAAoB,EAAgF;AACtG,EAAE,OAAOC,yDAAyC,CAAC,oBAAoB,EAAE,GAAG,CAAC;AAC7E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS;;AAGhB,CAAE,0BAA0B,EAAgF;AAC5G,EAAE,OAAOC,wDAAwC,CAAC,0BAA0B,EAAE,GAAG,CAAC;AAClF;;AAEA;AACA;AACA;AACA;AACO,SAAS,eAAe,CAAC,aAAa,EAAwB;AACrE,EAAE,OAAOC,+CAA+B,CAAC,aAAa,EAAE,GAAG,CAAC;AAC5D;;;;;;;;"}
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 */\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// 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 */\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 */\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 */\nexport function wrapUseRoutesV7(origUseRoutes: UseRoutes): UseRoutes {\n return createV6CompatibleWrapUseRoutes(origUseRoutes, '7');\n}\n"],"names":["createReactRouterV6CompatibleTracingIntegration","createV6CompatibleWithSentryReactRouterRouting","createV6CompatibleWrapCreateBrowserRouter","createV6CompatibleWrapCreateMemoryRouter","createV6CompatibleWrapUseRoutes"],"mappings":";;;;;;;AAaA;AACA;AACA;AACA;AACO,SAAS,sCAAsC;AACtD,EAAE,OAAO;AACT,EAAe;AACf,EAAE,OAAOA,+DAA+C,CAAC,OAAO,EAAE,GAAG,CAAC;AACtE;;AAEA;AACA;AACA;AACA;AACA;AACO,SAAS,8BAA8B,CAAuD,MAAM,EAAQ;AACnH,EAAE,OAAOC,8DAA8C,CAAO,MAAM,EAAE,GAAG,CAAC;AAC1E;;AAEA;AACA;AACA;AACA;AACO,SAAS;;AAGhB,CAAE,oBAAoB,EAAgF;AACtG,EAAE,OAAOC,yDAAyC,CAAC,oBAAoB,EAAE,GAAG,CAAC;AAC7E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS;;AAGhB,CAAE,0BAA0B,EAAgF;AAC5G,EAAE,OAAOC,wDAAwC,CAAC,0BAA0B,EAAE,GAAG,CAAC;AAClF;;AAEA;AACA;AACA;AACA;AACO,SAAS,eAAe,CAAC,aAAa,EAAwB;AACrE,EAAE,OAAOC,+CAA+B,CAAC,aAAa,EAAE,GAAG,CAAC;AAC5D;;;;;;;;"}
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- const core = require('@sentry/core');
3
+ const browser = require('@sentry/core/browser');
4
4
 
5
5
  const ACTION_BREADCRUMB_CATEGORY = 'redux.action';
6
6
  const ACTION_BREADCRUMB_TYPE = 'info';
@@ -26,7 +26,7 @@ function createReduxEnhancer(enhancerOptions) {
26
26
  return (next) =>
27
27
  (reducer, initialState) => {
28
28
  options.attachReduxState &&
29
- core.getGlobalScope().addEventProcessor((event, hint) => {
29
+ browser.getGlobalScope().addEventProcessor((event, hint) => {
30
30
  try {
31
31
  // @ts-expect-error try catch to reduce bundle size
32
32
  if (event.type === undefined && event.contexts.state.state.type === 'redux') {
@@ -46,12 +46,12 @@ function createReduxEnhancer(enhancerOptions) {
46
46
  return (state, action) => {
47
47
  const newState = reducer(state, action);
48
48
 
49
- const scope = core.getCurrentScope();
49
+ const scope = browser.getCurrentScope();
50
50
 
51
51
  /* Action breadcrumbs */
52
52
  const transformedAction = options.actionTransformer(action);
53
53
  if (typeof transformedAction !== 'undefined' && transformedAction !== null) {
54
- core.addBreadcrumb({
54
+ browser.addBreadcrumb({
55
55
  category: ACTION_BREADCRUMB_CATEGORY,
56
56
  data: transformedAction,
57
57
  type: ACTION_BREADCRUMB_TYPE,
@@ -61,13 +61,13 @@ function createReduxEnhancer(enhancerOptions) {
61
61
  /* Set latest state to scope */
62
62
  const transformedState = options.stateTransformer(newState);
63
63
  if (typeof transformedState !== 'undefined' && transformedState !== null) {
64
- const client = core.getClient();
64
+ const client = browser.getClient();
65
65
  const options = client?.getOptions();
66
66
  const normalizationDepth = options?.normalizeDepth || 3; // default state normalization depth to 3
67
67
 
68
68
  // Set the normalization depth of the redux state to the configured `normalizeDepth` option or a sane number as a fallback
69
69
  const newStateContext = { state: { type: 'redux', value: transformedState } };
70
- core.setNormalizationDepthOverrideHint(
70
+ browser.setNormalizationDepthOverrideHint(
71
71
  newStateContext,
72
72
  3 + // 3 layers for `state.value.transformedState`
73
73
  normalizationDepth, // rest for the actual state
@@ -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';\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","getCurrentScope","addBreadcrumb","getClient","setNormalizationDepthOverrideHint"],"mappings":";;;;AAiFA,MAAM,0BAAA,GAA6B,cAAc;AACjD,MAAM,sBAAA,GAAyB,MAAM;;AAErC,MAAM,cAAc,GAA0B;AAC9C,EAAE,gBAAgB,EAAE,IAAI;AACxB,EAAE,iBAAiB,EAAE,MAAA,IAAU,MAAM;AACrC,EAAE,gBAAgB,EAAE,KAAA,IAAS,KAAA,IAAS,IAAI;AAC1C,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,SAAS,mBAAmB,CAAC,eAAe,EAAwC;AACpF;AACA,EAAE,MAAM,UAAU;AAClB,IAAI,GAAG,cAAc;AACrB,IAAI,GAAG,eAAe;AACtB,GAAG;;AAEH,EAAE,OAAO,CAAC,IAAI;AACd,IAAI,CAAwC,OAAO,EAAiB,YAAY,KAAyB;AACzG,MAAM,OAAO,CAAC,gBAAA;AACd,QAAQA,mBAAc,EAAE,CAAC,iBAAiB,CAAC,CAAC,KAAK,EAAE,IAAI,KAAK;AAC5D,UAAU,IAAI;AACd;AACA,YAAY,IAAI,KAAK,CAAC,IAAA,KAAS,aAAa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CAAC,CAAA;;AAEnE;AACA,YAAY,MAAM,eAAA,GAAkB,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,gBAAA,IAAoB;AACzF,YAAYC,sCAAiC;AAC7C,cAAc,eAAe;AAC7B,cAAc,CAAA;AACd,gBAAgB,kBAAkB;AAClC,aAAa;;AAEb,YAAY,KAAK,CAAC,UAAU,CAAC,OAAO,EAAE,eAAe,CAAC;AACtD,UAAU,OAAO;AACjB,YAAY,KAAK,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC;AAC3C,UAAU;;AAEV;AACA,UAAU,MAAM,EAAE,uBAAA,EAAwB,GAAI,OAAO;AACrD,UAAU,IAAI,OAAO,uBAAA,KAA4B,UAAU,EAAE;AAC7D,YAAY,uBAAuB,CAAC,KAAK,EAAE,QAAQ,CAAC;AACpD,UAAU;;AAEV,UAAU,OAAO,QAAQ;AACzB,QAAQ,CAAC;AACT,MAAM;;AAEN,MAAM,MAAM,KAAA,GAAQ,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC;;AAElE;AACA,MAAM,KAAK,CAAC,cAAA,GAAiB,IAAI,KAAK,CAAC,KAAK,CAAC,cAAc,EAAE;AAC7D,QAAQ,KAAK,EAAE,UAAU,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE;AAChD,UAAU,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7D,QAAQ,CAAC;AACT,OAAO,CAAC;;AAER,MAAM,OAAO,KAAK;AAClB,IAAI,CAAC;AACL;;;;"}
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","getCurrentScope","addBreadcrumb","getClient","setNormalizationDepthOverrideHint"],"mappings":";;;;AAiFA,MAAM,0BAAA,GAA6B,cAAc;AACjD,MAAM,sBAAA,GAAyB,MAAM;;AAErC,MAAM,cAAc,GAA0B;AAC9C,EAAE,gBAAgB,EAAE,IAAI;AACxB,EAAE,iBAAiB,EAAE,MAAA,IAAU,MAAM;AACrC,EAAE,gBAAgB,EAAE,KAAA,IAAS,KAAA,IAAS,IAAI;AAC1C,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,SAAS,mBAAmB,CAAC,eAAe,EAAwC;AACpF;AACA,EAAE,MAAM,UAAU;AAClB,IAAI,GAAG,cAAc;AACrB,IAAI,GAAG,eAAe;AACtB,GAAG;;AAEH,EAAE,OAAO,CAAC,IAAI;AACd,IAAI,CAAwC,OAAO,EAAiB,YAAY,KAAyB;AACzG,MAAM,OAAO,CAAC,gBAAA;AACd,QAAQA,sBAAc,EAAE,CAAC,iBAAiB,CAAC,CAAC,KAAK,EAAE,IAAI,KAAK;AAC5D,UAAU,IAAI;AACd;AACA,YAAY,IAAI,KAAK,CAAC,IAAA,KAAS,aAAa,KAAK,CAAC,QAAQ,C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AACA,YAAY,MAAM,eAAA,GAAkB,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,gBAAA,IAAoB;AACzF,YAAYC,yCAAiC;AAC7C,cAAc,eAAe;AAC7B,cAAc,CAAA;AACd,gBAAgB,kBAAkB;AAClC,aAAa;;AAEb,YAAY,KAAK,CAAC,UAAU,CAAC,OAAO,EAAE,eAAe,CAAC;AACtD,UAAU,OAAO;AACjB,YAAY,KAAK,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC;AAC3C,UAAU;;AAEV;AACA,UAAU,MAAM,EAAE,uBAAA,EAAwB,GAAI,OAAO;AACrD,UAAU,IAAI,OAAO,uBAAA,KAA4B,UAAU,EAAE;AAC7D,YAAY,uBAAuB,CAAC,KAAK,EAAE,QAAQ,CAAC;AACpD,UAAU;;AAEV,UAAU,OAAO,QAAQ;AACzB,QAAQ,CAAC;AACT,MAAM;;AAEN,MAAM,MAAM,KAAA,GAAQ,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC;;AAElE;AACA,MAAM,KAAK,CAAC,cAAA,GAAiB,IAAI,KAAK,CAAC,KAAK,CAAC,cAAc,EAAE;AAC7D,QAAQ,KAAK,EAAE,UAAU,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE;AAChD,UAAU,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7D,QAAQ,CAAC;AACT,OAAO,CAAC;;AAER,MAAM,OAAO,KAAK;AAClB,IAAI,CAAC;AACL;;;;"}
package/build/cjs/sdk.js CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- const browser = require('@sentry/browser');
4
- const core = require('@sentry/core');
3
+ const browser$1 = require('@sentry/browser');
4
+ const browser = require('@sentry/core/browser');
5
5
  const React = require('react');
6
6
 
7
7
  /**
@@ -12,9 +12,9 @@ function init(options) {
12
12
  ...options,
13
13
  };
14
14
 
15
- core.applySdkMetadata(opts, 'react');
16
- browser.setContext('react', { version: React.version });
17
- return browser.init(opts);
15
+ browser.applySdkMetadata(opts, 'react');
16
+ browser$1.setContext('react', { version: React.version });
17
+ return browser$1.init(opts);
18
18
  }
19
19
 
20
20
  exports.init = init;
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.js","sources":["../../src/sdk.ts"],"sourcesContent":["import type { BrowserOptions } from '@sentry/browser';\nimport { init as browserInit, setContext } from '@sentry/browser';\nimport type { Client } from '@sentry/core';\nimport { applySdkMetadata } from '@sentry/core';\nimport { version } from 'react';\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 return browserInit(opts);\n}\n"],"names":["applySdkMetadata","setContext","version","browserInit"],"mappings":";;;;;;AAMA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAAsC;AAClE,EAAE,MAAM,OAAO;AACf,IAAI,GAAG,OAAO;AACd,GAAG;;AAEH,EAAEA,qBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC;AACjC,EAAEC,kBAAU,CAAC,OAAO,EAAE,WAAEC,aAAA,EAAS,CAAC;AAClC,EAAE,OAAOC,YAAW,CAAC,IAAI,CAAC;AAC1B;;;;"}
1
+ {"version":3,"file":"sdk.js","sources":["../../src/sdk.ts"],"sourcesContent":["import type { BrowserOptions } from '@sentry/browser';\nimport { init as browserInit, setContext } from '@sentry/browser';\nimport type { Client } from '@sentry/core/browser';\nimport { applySdkMetadata } from '@sentry/core/browser';\nimport { version } from 'react';\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 return browserInit(opts);\n}\n"],"names":["applySdkMetadata","setContext","version","browserInit"],"mappings":";;;;;;AAMA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAAsC;AAClE,EAAE,MAAM,OAAO;AACf,IAAI,GAAG,OAAO;AACd,GAAG;;AAEH,EAAEA,wBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC;AACjC,EAAEC,oBAAU,CAAC,OAAO,EAAE,WAAEC,aAAA,EAAS,CAAC;AAClC,EAAE,OAAOC,cAAW,CAAC,IAAI,CAAC;AAC1B;;;;"}
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const browser = require('@sentry/browser');
4
- const core = require('@sentry/core');
4
+ const browser$1 = require('@sentry/core/browser');
5
5
 
6
6
  /**
7
7
  * A custom browser tracing integration for TanStack Router.
@@ -47,9 +47,9 @@ function tanstackRouterBrowserTracingIntegration(
47
47
  browser.startBrowserTracingPageLoadSpan(client, {
48
48
  name: routeMatch ? routeMatch.routeId : initialWindowLocation.pathname,
49
49
  attributes: {
50
- [core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload',
51
- [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.tanstack_router',
52
- [core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: routeMatch ? 'route' : 'url',
50
+ [browser$1.SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload',
51
+ [browser$1.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.tanstack_router',
52
+ [browser$1.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: routeMatch ? 'route' : 'url',
53
53
  ...routeMatchToParamSpanAttributes(routeMatch),
54
54
  },
55
55
  });
@@ -82,9 +82,9 @@ function tanstackRouterBrowserTracingIntegration(
82
82
  const navigationSpan = browser.startBrowserTracingNavigationSpan(client, {
83
83
  name: onBeforeNavigateRouteMatch ? onBeforeNavigateRouteMatch.routeId : navigationLocation.pathname,
84
84
  attributes: {
85
- [core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',
86
- [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.tanstack_router',
87
- [core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: onBeforeNavigateRouteMatch ? 'route' : 'url',
85
+ [browser$1.SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',
86
+ [browser$1.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.tanstack_router',
87
+ [browser$1.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: onBeforeNavigateRouteMatch ? 'route' : 'url',
88
88
  },
89
89
  });
90
90
 
@@ -104,7 +104,7 @@ function tanstackRouterBrowserTracingIntegration(
104
104
 
105
105
  if (onResolvedRouteMatch) {
106
106
  navigationSpan.updateName(onResolvedRouteMatch.routeId);
107
- navigationSpan.setAttribute(core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route');
107
+ navigationSpan.setAttribute(browser$1.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route');
108
108
  navigationSpan.setAttributes(routeMatchToParamSpanAttributes(onResolvedRouteMatch));
109
109
  }
110
110
  }