@sentry/react 10.23.0 → 10.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/error.js.map +1 -1
- package/build/cjs/errorboundary.js.map +1 -1
- package/build/cjs/profiler.js.map +1 -1
- package/build/cjs/reactrouter-compat-utils/instrumentation.js.map +1 -1
- package/build/cjs/reactrouter-compat-utils/lazy-routes.js.map +1 -1
- package/build/cjs/reactrouter-compat-utils/utils.js.map +1 -1
- package/build/cjs/reactrouter.js.map +1 -1
- package/build/cjs/reactrouterv3.js.map +1 -1
- package/build/cjs/redux.js.map +1 -1
- package/build/cjs/tanstackrouter.js.map +1 -1
- package/build/esm/error.js.map +1 -1
- package/build/esm/errorboundary.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/profiler.js.map +1 -1
- package/build/esm/reactrouter-compat-utils/instrumentation.js.map +1 -1
- package/build/esm/reactrouter-compat-utils/lazy-routes.js.map +1 -1
- package/build/esm/reactrouter-compat-utils/utils.js.map +1 -1
- package/build/esm/reactrouter.js.map +1 -1
- package/build/esm/reactrouterv3.js.map +1 -1
- package/build/esm/redux.js.map +1 -1
- package/build/esm/tanstackrouter.js.map +1 -1
- package/package.json +3 -3
package/build/cjs/error.js.map
CHANGED
|
@@ -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,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;
|
|
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,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;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;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorboundary.js","sources":["../../src/errorboundary.tsx"],"sourcesContent":["import type { ReportDialogOptions } from '@sentry/browser';\nimport { getClient, showReportDialog, withScope } from '@sentry/browser';\nimport type { Scope } from '@sentry/core';\nimport { debug } from '@sentry/core';\nimport * as React from 'react';\nimport { DEBUG_BUILD } from './debug-build';\nimport { captureReactException } from './error';\nimport { hoistNonReactStatics } from './hoist-non-react-statics';\n\nexport const UNKNOWN_COMPONENT = 'unknown';\n\nexport type FallbackRender = (errorData: {\n error: unknown;\n componentStack: string;\n eventId: string;\n resetError(): void;\n}) => React.ReactElement;\n\ntype OnUnmountType = {\n (error: null, componentStack: null, eventId: null): void;\n (error: unknown, componentStack: string, eventId: string): void;\n};\n\nexport type ErrorBoundaryProps = {\n children?: React.ReactNode | (() => React.ReactNode);\n /** If a Sentry report dialog should be rendered on error */\n showDialog?: boolean | undefined;\n /**\n * Options to be passed into the Sentry report dialog.\n * No-op if {@link showDialog} is false.\n */\n dialogOptions?: ReportDialogOptions | undefined;\n /**\n * A fallback component that gets rendered when the error boundary encounters an error.\n *\n * Can either provide a React Component, or a function that returns React Component as\n * a valid fallback prop. If a function is provided, the function will be called with\n * the error, the component stack, and an function that resets the error boundary on error.\n *\n */\n fallback?: React.ReactElement | FallbackRender | undefined;\n /**\n * If set to `true` or `false`, the error `handled` property will be set to the given value.\n * If unset, the default behaviour is to rely on the presence of the `fallback` prop to determine\n * if the error was handled or not.\n */\n handled?: boolean | undefined;\n /** Called when the error boundary encounters an error */\n onError?: ((error: unknown, componentStack: string, eventId: string) => void) | undefined;\n /** Called on componentDidMount() */\n onMount?: (() => void) | undefined;\n /**\n * Called when the error boundary resets due to a reset call from the\n * fallback render props function.\n */\n onReset?: ((error: unknown, componentStack: string, eventId: string) => void) | undefined;\n /**\n * Called on componentWillUnmount() with the error, componentStack, and eventId.\n *\n * If the error boundary never encountered an error, the error\n * componentStack, and eventId will be null.\n */\n onUnmount?: OnUnmountType | undefined;\n /** Called before the error is captured by Sentry, allows for you to add tags or context using the scope */\n beforeCapture?: ((scope: Scope, error: unknown, componentStack: string) => void) | undefined;\n};\n\ntype ErrorBoundaryState =\n | {\n componentStack: null;\n error: null;\n eventId: null;\n }\n | {\n componentStack: React.ErrorInfo['componentStack'];\n error: unknown;\n eventId: string;\n };\n\nconst INITIAL_STATE: ErrorBoundaryState = {\n componentStack: null,\n error: null,\n eventId: null,\n};\n\n/**\n * A ErrorBoundary component that logs errors to Sentry.\n * NOTE: If you are a Sentry user, and you are seeing this stack frame, it means the\n * Sentry React SDK ErrorBoundary caught an error invoking your application code. This\n * is expected behavior and NOT indicative of a bug with the Sentry React SDK.\n */\nclass ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {\n public state: ErrorBoundaryState;\n\n private readonly _openFallbackReportDialog: boolean;\n\n private _lastEventId?: string;\n private _cleanupHook?: () => void;\n\n public constructor(props: ErrorBoundaryProps) {\n super(props);\n\n this.state = INITIAL_STATE;\n this._openFallbackReportDialog = true;\n\n const client = getClient();\n if (client && props.showDialog) {\n this._openFallbackReportDialog = false;\n this._cleanupHook = client.on('afterSendEvent', event => {\n if (!event.type && this._lastEventId && event.event_id === this._lastEventId) {\n showReportDialog({ ...props.dialogOptions, eventId: this._lastEventId });\n }\n });\n }\n }\n\n public componentDidCatch(error: unknown, errorInfo: React.ErrorInfo): void {\n const { componentStack } = errorInfo;\n const { beforeCapture, onError, showDialog, dialogOptions } = this.props;\n withScope(scope => {\n if (beforeCapture) {\n beforeCapture(scope, error, componentStack);\n }\n\n const handled = this.props.handled != null ? this.props.handled : !!this.props.fallback;\n const eventId = captureReactException(error, errorInfo, {\n mechanism: { handled, type: 'auto.function.react.error_boundary' },\n });\n\n if (onError) {\n onError(error, componentStack, eventId);\n }\n if (showDialog) {\n this._lastEventId = eventId;\n if (this._openFallbackReportDialog) {\n showReportDialog({ ...dialogOptions, eventId });\n }\n }\n\n // componentDidCatch is used over getDerivedStateFromError\n // so that componentStack is accessible through state.\n this.setState({ error, componentStack, eventId });\n });\n }\n\n public componentDidMount(): void {\n const { onMount } = this.props;\n if (onMount) {\n onMount();\n }\n }\n\n public componentWillUnmount(): void {\n const { error, componentStack, eventId } = this.state;\n const { onUnmount } = this.props;\n if (onUnmount) {\n if (this.state === INITIAL_STATE) {\n // If the error boundary never encountered an error, call onUnmount with null values\n onUnmount(null, null, null);\n } else {\n // `componentStack` and `eventId` are guaranteed to be non-null here because `onUnmount` is only called\n // when the error boundary has already encountered an error.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n onUnmount(error, componentStack!, eventId!);\n }\n }\n\n if (this._cleanupHook) {\n this._cleanupHook();\n this._cleanupHook = undefined;\n }\n }\n\n public resetErrorBoundary(): void {\n const { onReset } = this.props;\n const { error, componentStack, eventId } = this.state;\n if (onReset) {\n // `componentStack` and `eventId` are guaranteed to be non-null here because `onReset` is only called\n // when the error boundary has already encountered an error.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n onReset(error, componentStack!, eventId!);\n }\n this.setState(INITIAL_STATE);\n }\n\n public render(): React.ReactNode {\n const { fallback, children } = this.props;\n const state = this.state;\n\n // `componentStack` is only null in the initial state, when no error has been captured.\n // If an error has been captured, `componentStack` will be a string.\n // We cannot check `state.error` because null can be thrown as an error.\n if (state.componentStack === null) {\n return typeof children === 'function' ? children() : children;\n }\n\n const element =\n typeof fallback === 'function'\n ? React.createElement(fallback, {\n error: state.error,\n componentStack: state.componentStack,\n resetError: () => this.resetErrorBoundary(),\n eventId: state.eventId,\n })\n : fallback;\n\n if (React.isValidElement(element)) {\n return element;\n }\n\n if (fallback) {\n DEBUG_BUILD && debug.warn('fallback did not produce a valid ReactElement');\n }\n\n // Fail gracefully if no fallback provided or is not valid\n return null;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction withErrorBoundary<P extends Record<string, any>>(\n WrappedComponent: React.ComponentType<P>,\n errorBoundaryOptions: ErrorBoundaryProps,\n): React.FC<P> {\n const componentDisplayName = WrappedComponent.displayName || WrappedComponent.name || UNKNOWN_COMPONENT;\n\n const Wrapped = React.memo((props: P) => (\n <ErrorBoundary {...errorBoundaryOptions}>\n <WrappedComponent {...props} />\n </ErrorBoundary>\n )) as unknown as React.FC<P>;\n\n Wrapped.displayName = `errorBoundary(${componentDisplayName})`;\n\n // Copy over static methods from Wrapped component to Profiler HOC\n // See: https://reactjs.org/docs/higher-order-components.html#static-methods-must-be-copied-over\n hoistNonReactStatics(Wrapped, WrappedComponent);\n return Wrapped;\n}\n\nexport { ErrorBoundary, withErrorBoundary };\n"],"names":["getClient","showReportDialog","error","withScope","captureReactException","DEBUG_BUILD","debug","hoistNonReactStatics"],"mappings":";;;;;;;;;AASO,MAAM,iBAAA,GAAoB;;AAsEjC,MAAM,aAAa,GAAuB;AAC1C,EAAE,cAAc,EAAE,IAAI;AACtB,EAAE,KAAK,EAAE,IAAI;AACb,EAAE,OAAO,EAAE,IAAI;AACf,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,aAAA,SAAsB,KAAK,CAAC,SAAS,CAAyC;;AAQpF,GAAS,WAAW,CAAC,KAAK,EAAsB;AAChD,IAAI,KAAK,CAAC,KAAK,CAAC;;AAEhB,IAAI,IAAI,CAAC,KAAA,GAAQ,aAAa;AAC9B,IAAI,IAAI,CAAC,yBAAA,GAA4B,IAAI;;AAEzC,IAAI,MAAM,MAAA,GAASA,iBAAS,EAAE;AAC9B,IAAI,IAAI,MAAA,IAAU,KAAK,CAAC,UAAU,EAAE;AACpC,MAAM,IAAI,CAAC,yBAAA,GAA4B,KAAK;AAC5C,MAAM,IAAI,CAAC,YAAA,GAAe,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,KAAA,IAAS;AAC/D,QAAQ,IAAI,CAAC,KAAK,CAAC,IAAA,IAAQ,IAAI,CAAC,YAAA,IAAgB,KAAK,CAAC,QAAA,KAAa,IAAI,CAAC,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.js","sources":["../../src/errorboundary.tsx"],"sourcesContent":["import type { ReportDialogOptions } from '@sentry/browser';\nimport { getClient, showReportDialog, withScope } from '@sentry/browser';\nimport type { Scope } from '@sentry/core';\nimport { debug } from '@sentry/core';\nimport * as React from 'react';\nimport { DEBUG_BUILD } from './debug-build';\nimport { captureReactException } from './error';\nimport { hoistNonReactStatics } from './hoist-non-react-statics';\n\nexport const UNKNOWN_COMPONENT = 'unknown';\n\nexport type FallbackRender = (errorData: {\n error: unknown;\n componentStack: string;\n eventId: string;\n resetError(): void;\n}) => React.ReactElement;\n\ntype OnUnmountType = {\n (error: null, componentStack: null, eventId: null): void;\n (error: unknown, componentStack: string, eventId: string): void;\n};\n\nexport type ErrorBoundaryProps = {\n children?: React.ReactNode | (() => React.ReactNode);\n /** If a Sentry report dialog should be rendered on error */\n showDialog?: boolean | undefined;\n /**\n * Options to be passed into the Sentry report dialog.\n * No-op if {@link showDialog} is false.\n */\n dialogOptions?: ReportDialogOptions | undefined;\n /**\n * A fallback component that gets rendered when the error boundary encounters an error.\n *\n * Can either provide a React Component, or a function that returns React Component as\n * a valid fallback prop. If a function is provided, the function will be called with\n * the error, the component stack, and an function that resets the error boundary on error.\n *\n */\n fallback?: React.ReactElement | FallbackRender | undefined;\n /**\n * If set to `true` or `false`, the error `handled` property will be set to the given value.\n * If unset, the default behaviour is to rely on the presence of the `fallback` prop to determine\n * if the error was handled or not.\n */\n handled?: boolean | undefined;\n /** Called when the error boundary encounters an error */\n onError?: ((error: unknown, componentStack: string, eventId: string) => void) | undefined;\n /** Called on componentDidMount() */\n onMount?: (() => void) | undefined;\n /**\n * Called when the error boundary resets due to a reset call from the\n * fallback render props function.\n */\n onReset?: ((error: unknown, componentStack: string, eventId: string) => void) | undefined;\n /**\n * Called on componentWillUnmount() with the error, componentStack, and eventId.\n *\n * If the error boundary never encountered an error, the error\n * componentStack, and eventId will be null.\n */\n onUnmount?: OnUnmountType | undefined;\n /** Called before the error is captured by Sentry, allows for you to add tags or context using the scope */\n beforeCapture?: ((scope: Scope, error: unknown, componentStack: string) => void) | undefined;\n};\n\ntype ErrorBoundaryState =\n | {\n componentStack: null;\n error: null;\n eventId: null;\n }\n | {\n componentStack: React.ErrorInfo['componentStack'];\n error: unknown;\n eventId: string;\n };\n\nconst INITIAL_STATE: ErrorBoundaryState = {\n componentStack: null,\n error: null,\n eventId: null,\n};\n\n/**\n * A ErrorBoundary component that logs errors to Sentry.\n * NOTE: If you are a Sentry user, and you are seeing this stack frame, it means the\n * Sentry React SDK ErrorBoundary caught an error invoking your application code. This\n * is expected behavior and NOT indicative of a bug with the Sentry React SDK.\n */\nclass ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {\n public state: ErrorBoundaryState;\n\n private readonly _openFallbackReportDialog: boolean;\n\n private _lastEventId?: string;\n private _cleanupHook?: () => void;\n\n public constructor(props: ErrorBoundaryProps) {\n super(props);\n\n this.state = INITIAL_STATE;\n this._openFallbackReportDialog = true;\n\n const client = getClient();\n if (client && props.showDialog) {\n this._openFallbackReportDialog = false;\n this._cleanupHook = client.on('afterSendEvent', event => {\n if (!event.type && this._lastEventId && event.event_id === this._lastEventId) {\n showReportDialog({ ...props.dialogOptions, eventId: this._lastEventId });\n }\n });\n }\n }\n\n public componentDidCatch(error: unknown, errorInfo: React.ErrorInfo): void {\n const { componentStack } = errorInfo;\n const { beforeCapture, onError, showDialog, dialogOptions } = this.props;\n withScope(scope => {\n if (beforeCapture) {\n beforeCapture(scope, error, componentStack);\n }\n\n const handled = this.props.handled != null ? this.props.handled : !!this.props.fallback;\n const eventId = captureReactException(error, errorInfo, {\n mechanism: { handled, type: 'auto.function.react.error_boundary' },\n });\n\n if (onError) {\n onError(error, componentStack, eventId);\n }\n if (showDialog) {\n this._lastEventId = eventId;\n if (this._openFallbackReportDialog) {\n showReportDialog({ ...dialogOptions, eventId });\n }\n }\n\n // componentDidCatch is used over getDerivedStateFromError\n // so that componentStack is accessible through state.\n this.setState({ error, componentStack, eventId });\n });\n }\n\n public componentDidMount(): void {\n const { onMount } = this.props;\n if (onMount) {\n onMount();\n }\n }\n\n public componentWillUnmount(): void {\n const { error, componentStack, eventId } = this.state;\n const { onUnmount } = this.props;\n if (onUnmount) {\n if (this.state === INITIAL_STATE) {\n // If the error boundary never encountered an error, call onUnmount with null values\n onUnmount(null, null, null);\n } else {\n // `componentStack` and `eventId` are guaranteed to be non-null here because `onUnmount` is only called\n // when the error boundary has already encountered an error.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n onUnmount(error, componentStack!, eventId!);\n }\n }\n\n if (this._cleanupHook) {\n this._cleanupHook();\n this._cleanupHook = undefined;\n }\n }\n\n public resetErrorBoundary(): void {\n const { onReset } = this.props;\n const { error, componentStack, eventId } = this.state;\n if (onReset) {\n // `componentStack` and `eventId` are guaranteed to be non-null here because `onReset` is only called\n // when the error boundary has already encountered an error.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n onReset(error, componentStack!, eventId!);\n }\n this.setState(INITIAL_STATE);\n }\n\n public render(): React.ReactNode {\n const { fallback, children } = this.props;\n const state = this.state;\n\n // `componentStack` is only null in the initial state, when no error has been captured.\n // If an error has been captured, `componentStack` will be a string.\n // We cannot check `state.error` because null can be thrown as an error.\n if (state.componentStack === null) {\n return typeof children === 'function' ? children() : children;\n }\n\n const element =\n typeof fallback === 'function'\n ? React.createElement(fallback, {\n error: state.error,\n componentStack: state.componentStack,\n resetError: () => this.resetErrorBoundary(),\n eventId: state.eventId,\n })\n : fallback;\n\n if (React.isValidElement(element)) {\n return element;\n }\n\n if (fallback) {\n DEBUG_BUILD && debug.warn('fallback did not produce a valid ReactElement');\n }\n\n // Fail gracefully if no fallback provided or is not valid\n return null;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction withErrorBoundary<P extends Record<string, any>>(\n WrappedComponent: React.ComponentType<P>,\n errorBoundaryOptions: ErrorBoundaryProps,\n): React.FC<P> {\n const componentDisplayName = WrappedComponent.displayName || WrappedComponent.name || UNKNOWN_COMPONENT;\n\n const Wrapped = React.memo((props: P) => (\n <ErrorBoundary {...errorBoundaryOptions}>\n <WrappedComponent {...props} />\n </ErrorBoundary>\n )) as unknown as React.FC<P>;\n\n Wrapped.displayName = `errorBoundary(${componentDisplayName})`;\n\n // Copy over static methods from Wrapped component to Profiler HOC\n // See: https://reactjs.org/docs/higher-order-components.html#static-methods-must-be-copied-over\n hoistNonReactStatics(Wrapped, WrappedComponent);\n return Wrapped;\n}\n\nexport { ErrorBoundary, withErrorBoundary };\n"],"names":["getClient","showReportDialog","error","withScope","captureReactException","DEBUG_BUILD","debug","hoistNonReactStatics"],"mappings":";;;;;;;;;AASO,MAAM,iBAAA,GAAoB;;AAsEjC,MAAM,aAAa,GAAuB;AAC1C,EAAE,cAAc,EAAE,IAAI;AACtB,EAAE,KAAK,EAAE,IAAI;AACb,EAAE,OAAO,EAAE,IAAI;AACf,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,aAAA,SAAsB,KAAK,CAAC,SAAS,CAAyC;;AAQpF,GAAS,WAAW,CAAC,KAAK,EAAsB;AAChD,IAAI,KAAK,CAAC,KAAK,CAAC;;AAEhB,IAAI,IAAI,CAAC,KAAA,GAAQ,aAAa;AAC9B,IAAI,IAAI,CAAC,yBAAA,GAA4B,IAAI;;AAEzC,IAAI,MAAM,MAAA,GAASA,iBAAS,EAAE;AAC9B,IAAI,IAAI,MAAA,IAAU,KAAK,CAAC,UAAU,EAAE;AACpC,MAAM,IAAI,CAAC,yBAAA,GAA4B,KAAK;AAC5C,MAAM,IAAI,CAAC,YAAA,GAAe,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,KAAA,IAAS;AAC/D,QAAQ,IAAI,CAAC,KAAK,CAAC,IAAA,IAAQ,IAAI,CAAC,YAAA,IAAgB,KAAK,CAAC,QAAA,KAAa,IAAI,CAAC,YAAY,EAAE;AACtF,UAAUC,wBAAgB,CAAC,EAAE,GAAG,KAAK,CAAC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AE,gBAAgB,CAAC;AACjD,EAAE,OAAO,OAAO;AAChB;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profiler.js","sources":["../../src/profiler.tsx"],"sourcesContent":["import { startInactiveSpan } from '@sentry/browser';\nimport type { Span } from '@sentry/core';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON, timestampInSeconds, withActiveSpan } from '@sentry/core';\nimport * as React from 'react';\nimport { REACT_MOUNT_OP, REACT_RENDER_OP, REACT_UPDATE_OP } from './constants';\nimport { hoistNonReactStatics } from './hoist-non-react-statics';\n\nexport const UNKNOWN_COMPONENT = 'unknown';\n\nexport type ProfilerProps = {\n // The name of the component being profiled.\n name: string;\n // If the Profiler is disabled. False by default. This is useful if you want to disable profilers\n // in certain environments.\n disabled?: boolean;\n // If time component is on page should be displayed as spans. True by default.\n includeRender?: boolean;\n // If component updates should be displayed as spans. True by default.\n includeUpdates?: boolean;\n // Component that is being profiled.\n children?: React.ReactNode;\n // props given to component being profiled.\n updateProps: { [key: string]: unknown };\n};\n\n/**\n * The Profiler component leverages Sentry's Tracing integration to generate\n * spans based on component lifecycles.\n */\nclass Profiler extends React.Component<ProfilerProps> {\n /**\n * The span of the mount activity\n * Made protected for the React Native SDK to access\n */\n protected _mountSpan: Span | undefined;\n /**\n * The span that represents the duration of time between shouldComponentUpdate and componentDidUpdate\n */\n protected _updateSpan: Span | undefined;\n\n public constructor(props: ProfilerProps) {\n super(props);\n const { name, disabled = false } = this.props;\n\n if (disabled) {\n return;\n }\n\n this._mountSpan = startInactiveSpan({\n name: `<${name}>`,\n onlyIfParent: true,\n op: REACT_MOUNT_OP,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n 'ui.component_name': name,\n },\n });\n }\n\n // If a component mounted, we can finish the mount activity.\n public componentDidMount(): void {\n if (this._mountSpan) {\n this._mountSpan.end();\n }\n }\n\n public shouldComponentUpdate({ updateProps, includeUpdates = true }: ProfilerProps): boolean {\n // Only generate an update span if includeUpdates is true, if there is a valid mountSpan,\n // and if the updateProps have changed. It is ok to not do a deep equality check here as it is expensive.\n // We are just trying to give baseline clues for further investigation.\n if (includeUpdates && this._mountSpan && updateProps !== this.props.updateProps) {\n // See what props have changed between the previous props, and the current props. This is\n // set as data on the span. We just store the prop keys as the values could be potentially very large.\n const changedProps = Object.keys(updateProps).filter(k => updateProps[k] !== this.props.updateProps[k]);\n if (changedProps.length > 0) {\n const now = timestampInSeconds();\n this._updateSpan = withActiveSpan(this._mountSpan, () => {\n return startInactiveSpan({\n name: `<${this.props.name}>`,\n onlyIfParent: true,\n op: REACT_UPDATE_OP,\n startTime: now,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n 'ui.component_name': this.props.name,\n 'ui.react.changed_props': changedProps,\n },\n });\n });\n }\n }\n\n return true;\n }\n\n public componentDidUpdate(): void {\n if (this._updateSpan) {\n this._updateSpan.end();\n this._updateSpan = undefined;\n }\n }\n\n // If a component is unmounted, we can say it is no longer on the screen.\n // This means we can finish the span representing the component render.\n public componentWillUnmount(): void {\n const endTimestamp = timestampInSeconds();\n const { name, includeRender = true } = this.props;\n\n if (this._mountSpan && includeRender) {\n const startTime = spanToJSON(this._mountSpan).timestamp;\n withActiveSpan(this._mountSpan, () => {\n const renderSpan = startInactiveSpan({\n onlyIfParent: true,\n name: `<${name}>`,\n op: REACT_RENDER_OP,\n startTime,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n 'ui.component_name': name,\n },\n });\n if (renderSpan) {\n // Have to cast to Span because the type of _mountSpan is Span | undefined\n // and not getting narrowed properly\n renderSpan.end(endTimestamp);\n }\n });\n }\n }\n\n public render(): React.ReactNode {\n return this.props.children;\n }\n}\n\n// React.Component default props are defined as static property on the class\nObject.assign(Profiler, {\n defaultProps: {\n disabled: false,\n includeRender: true,\n includeUpdates: true,\n },\n});\n\n/**\n * withProfiler is a higher order component that wraps a\n * component in a {@link Profiler} component. It is recommended that\n * the higher order component be used over the regular {@link Profiler} component.\n *\n * @param WrappedComponent component that is wrapped by Profiler\n * @param options the {@link ProfilerProps} you can pass into the Profiler\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction withProfiler<P extends Record<string, any>>(\n WrappedComponent: React.ComponentType<P>,\n // We do not want to have `updateProps` given in options, it is instead filled through the HOC.\n options?: Pick<Partial<ProfilerProps>, Exclude<keyof ProfilerProps, 'updateProps' | 'children'>>,\n): React.FC<P> {\n const componentDisplayName =\n options?.name || WrappedComponent.displayName || WrappedComponent.name || UNKNOWN_COMPONENT;\n\n const Wrapped: React.FC<P> = (props: P) => (\n <Profiler {...options} name={componentDisplayName} updateProps={props}>\n <WrappedComponent {...props} />\n </Profiler>\n );\n\n Wrapped.displayName = `profiler(${componentDisplayName})`;\n\n // Copy over static methods from Wrapped component to Profiler HOC\n // See: https://reactjs.org/docs/higher-order-components.html#static-methods-must-be-copied-over\n hoistNonReactStatics(Wrapped, WrappedComponent);\n return Wrapped;\n}\n\n/**\n *\n * `useProfiler` is a React hook that profiles a React component.\n *\n * Requires React 16.8 or above.\n * @param name displayName of component being profiled\n */\nfunction useProfiler(\n name: string,\n options: { disabled?: boolean; hasRenderSpan?: boolean } = {\n disabled: false,\n hasRenderSpan: true,\n },\n): void {\n const [mountSpan] = React.useState(() => {\n if (options?.disabled) {\n return undefined;\n }\n\n return startInactiveSpan({\n name: `<${name}>`,\n onlyIfParent: true,\n op: REACT_MOUNT_OP,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n 'ui.component_name': name,\n },\n });\n });\n\n React.useEffect(() => {\n if (mountSpan) {\n mountSpan.end();\n }\n\n return (): void => {\n if (mountSpan && options.hasRenderSpan) {\n const startTime = spanToJSON(mountSpan).timestamp;\n const endTimestamp = timestampInSeconds();\n\n const renderSpan = startInactiveSpan({\n name: `<${name}>`,\n onlyIfParent: true,\n op: REACT_RENDER_OP,\n startTime,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n 'ui.component_name': name,\n },\n });\n if (renderSpan) {\n // Have to cast to Span because the type of _mountSpan is Span | undefined\n // and not getting narrowed properly\n renderSpan.end(endTimestamp);\n }\n }\n };\n // We only want this to run once.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n}\n\nexport { Profiler, useProfiler, withProfiler };\n"],"names":["startInactiveSpan","REACT_MOUNT_OP","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","timestampInSeconds","withActiveSpan","REACT_UPDATE_OP","spanToJSON","REACT_RENDER_OP","hoistNonReactStatics"],"mappings":";;;;;;;;AAOO,MAAM,iBAAA,GAAoB;;AAkBjC;AACA;AACA;AACA;AACA,MAAM,QAAA,SAAiB,KAAK,CAAC,SAAS,CAAgB;AACtD;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAGA,GAAS,WAAW,CAAC,KAAK,EAAiB;AAC3C,IAAI,KAAK,CAAC,KAAK,CAAC;AAChB,IAAI,MAAM,EAAE,IAAI,EAAE,QAAA,GAAW,KAAA,EAAM,GAAI,IAAI,CAAC,KAAK;;AAEjD,IAAI,IAAI,QAAQ,EAAE;AAClB,MAAM;AACN;;AAEA,IAAI,IAAI,CAAC,UAAA,GAAaA,yBAAiB,CAAC;AACxC,MAAM,IAAI,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;AACvB,MAAM,YAAY,EAAE,IAAI;AACxB,MAAM,EAAE,EAAEC,wBAAc;AACxB,MAAM,UAAU,EAAE;AAClB,QAAQ,CAACC,qCAAgC,GAAG,wBAAwB;AACpE,QAAQ,mBAAmB,EAAE,IAAI;AACjC,OAAO;AACP,KAAK,CAAC;AACN;;AAEA;AACA,GAAS,iBAAiB,GAAS;AACnC,IAAI,IAAI,IAAI,CAAC,UAAU,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AC,SAAS,CAAC,MAAM;AACxB,IAAI,IAAI,SAAS,EAAE;AACnB,MAAM,SAAS,CAAC,GAAG,EAAE;AACrB;;AAEA,IAAI,OAAO,MAAY;AACvB,MAAM,IAAI,SAAA,IAAa,OAAO,CAAC,aAAa,EAAE;AAC9C,QAAQ,MAAM,YAAYI,eAAU,CAAC,SAAS,CAAC,CAAC,SAAS;AACzD,QAAQ,MAAM,YAAA,GAAeH,uBAAkB,EAAE;;AAEjD,QAAQ,MAAM,UAAA,GAAaH,yBAAiB,CAAC;AAC7C,UAAU,IAAI,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;AAC3B,UAAU,YAAY,EAAE,IAAI;AAC5B,UAAU,EAAE,EAAEO,yBAAe;AAC7B,UAAU,SAAS;AACnB,UAAU,UAAU,EAAE;AACtB,YAAY,CAACL,qCAAgC,GAAG,wBAAwB;AACxE,YAAY,mBAAmB,EAAE,IAAI;AACrC,WAAW;AACX,SAAS,CAAC;AACV,QAAQ,IAAI,UAAU,EAAE;AACxB;AACA;AACA,UAAU,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC;AACtC;AACA;AACA,KAAK;AACL;AACA;AACA,GAAG,EAAE,EAAE,CAAC;AACR;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"profiler.js","sources":["../../src/profiler.tsx"],"sourcesContent":["import { startInactiveSpan } from '@sentry/browser';\nimport type { Span } from '@sentry/core';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON, timestampInSeconds, withActiveSpan } from '@sentry/core';\nimport * as React from 'react';\nimport { REACT_MOUNT_OP, REACT_RENDER_OP, REACT_UPDATE_OP } from './constants';\nimport { hoistNonReactStatics } from './hoist-non-react-statics';\n\nexport const UNKNOWN_COMPONENT = 'unknown';\n\nexport type ProfilerProps = {\n // The name of the component being profiled.\n name: string;\n // If the Profiler is disabled. False by default. This is useful if you want to disable profilers\n // in certain environments.\n disabled?: boolean;\n // If time component is on page should be displayed as spans. True by default.\n includeRender?: boolean;\n // If component updates should be displayed as spans. True by default.\n includeUpdates?: boolean;\n // Component that is being profiled.\n children?: React.ReactNode;\n // props given to component being profiled.\n updateProps: { [key: string]: unknown };\n};\n\n/**\n * The Profiler component leverages Sentry's Tracing integration to generate\n * spans based on component lifecycles.\n */\nclass Profiler extends React.Component<ProfilerProps> {\n /**\n * The span of the mount activity\n * Made protected for the React Native SDK to access\n */\n protected _mountSpan: Span | undefined;\n /**\n * The span that represents the duration of time between shouldComponentUpdate and componentDidUpdate\n */\n protected _updateSpan: Span | undefined;\n\n public constructor(props: ProfilerProps) {\n super(props);\n const { name, disabled = false } = this.props;\n\n if (disabled) {\n return;\n }\n\n this._mountSpan = startInactiveSpan({\n name: `<${name}>`,\n onlyIfParent: true,\n op: REACT_MOUNT_OP,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n 'ui.component_name': name,\n },\n });\n }\n\n // If a component mounted, we can finish the mount activity.\n public componentDidMount(): void {\n if (this._mountSpan) {\n this._mountSpan.end();\n }\n }\n\n public shouldComponentUpdate({ updateProps, includeUpdates = true }: ProfilerProps): boolean {\n // Only generate an update span if includeUpdates is true, if there is a valid mountSpan,\n // and if the updateProps have changed. It is ok to not do a deep equality check here as it is expensive.\n // We are just trying to give baseline clues for further investigation.\n if (includeUpdates && this._mountSpan && updateProps !== this.props.updateProps) {\n // See what props have changed between the previous props, and the current props. This is\n // set as data on the span. We just store the prop keys as the values could be potentially very large.\n const changedProps = Object.keys(updateProps).filter(k => updateProps[k] !== this.props.updateProps[k]);\n if (changedProps.length > 0) {\n const now = timestampInSeconds();\n this._updateSpan = withActiveSpan(this._mountSpan, () => {\n return startInactiveSpan({\n name: `<${this.props.name}>`,\n onlyIfParent: true,\n op: REACT_UPDATE_OP,\n startTime: now,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n 'ui.component_name': this.props.name,\n 'ui.react.changed_props': changedProps,\n },\n });\n });\n }\n }\n\n return true;\n }\n\n public componentDidUpdate(): void {\n if (this._updateSpan) {\n this._updateSpan.end();\n this._updateSpan = undefined;\n }\n }\n\n // If a component is unmounted, we can say it is no longer on the screen.\n // This means we can finish the span representing the component render.\n public componentWillUnmount(): void {\n const endTimestamp = timestampInSeconds();\n const { name, includeRender = true } = this.props;\n\n if (this._mountSpan && includeRender) {\n const startTime = spanToJSON(this._mountSpan).timestamp;\n withActiveSpan(this._mountSpan, () => {\n const renderSpan = startInactiveSpan({\n onlyIfParent: true,\n name: `<${name}>`,\n op: REACT_RENDER_OP,\n startTime,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n 'ui.component_name': name,\n },\n });\n if (renderSpan) {\n // Have to cast to Span because the type of _mountSpan is Span | undefined\n // and not getting narrowed properly\n renderSpan.end(endTimestamp);\n }\n });\n }\n }\n\n public render(): React.ReactNode {\n return this.props.children;\n }\n}\n\n// React.Component default props are defined as static property on the class\nObject.assign(Profiler, {\n defaultProps: {\n disabled: false,\n includeRender: true,\n includeUpdates: true,\n },\n});\n\n/**\n * withProfiler is a higher order component that wraps a\n * component in a {@link Profiler} component. It is recommended that\n * the higher order component be used over the regular {@link Profiler} component.\n *\n * @param WrappedComponent component that is wrapped by Profiler\n * @param options the {@link ProfilerProps} you can pass into the Profiler\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction withProfiler<P extends Record<string, any>>(\n WrappedComponent: React.ComponentType<P>,\n // We do not want to have `updateProps` given in options, it is instead filled through the HOC.\n options?: Pick<Partial<ProfilerProps>, Exclude<keyof ProfilerProps, 'updateProps' | 'children'>>,\n): React.FC<P> {\n const componentDisplayName =\n options?.name || WrappedComponent.displayName || WrappedComponent.name || UNKNOWN_COMPONENT;\n\n const Wrapped: React.FC<P> = (props: P) => (\n <Profiler {...options} name={componentDisplayName} updateProps={props}>\n <WrappedComponent {...props} />\n </Profiler>\n );\n\n Wrapped.displayName = `profiler(${componentDisplayName})`;\n\n // Copy over static methods from Wrapped component to Profiler HOC\n // See: https://reactjs.org/docs/higher-order-components.html#static-methods-must-be-copied-over\n hoistNonReactStatics(Wrapped, WrappedComponent);\n return Wrapped;\n}\n\n/**\n *\n * `useProfiler` is a React hook that profiles a React component.\n *\n * Requires React 16.8 or above.\n * @param name displayName of component being profiled\n */\nfunction useProfiler(\n name: string,\n options: { disabled?: boolean; hasRenderSpan?: boolean } = {\n disabled: false,\n hasRenderSpan: true,\n },\n): void {\n const [mountSpan] = React.useState(() => {\n if (options?.disabled) {\n return undefined;\n }\n\n return startInactiveSpan({\n name: `<${name}>`,\n onlyIfParent: true,\n op: REACT_MOUNT_OP,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n 'ui.component_name': name,\n },\n });\n });\n\n React.useEffect(() => {\n if (mountSpan) {\n mountSpan.end();\n }\n\n return (): void => {\n if (mountSpan && options.hasRenderSpan) {\n const startTime = spanToJSON(mountSpan).timestamp;\n const endTimestamp = timestampInSeconds();\n\n const renderSpan = startInactiveSpan({\n name: `<${name}>`,\n onlyIfParent: true,\n op: REACT_RENDER_OP,\n startTime,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n 'ui.component_name': name,\n },\n });\n if (renderSpan) {\n // Have to cast to Span because the type of _mountSpan is Span | undefined\n // and not getting narrowed properly\n renderSpan.end(endTimestamp);\n }\n }\n };\n // We only want this to run once.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n}\n\nexport { Profiler, useProfiler, withProfiler };\n"],"names":["startInactiveSpan","REACT_MOUNT_OP","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","timestampInSeconds","withActiveSpan","REACT_UPDATE_OP","spanToJSON","REACT_RENDER_OP","hoistNonReactStatics"],"mappings":";;;;;;;;AAOO,MAAM,iBAAA,GAAoB;;AAkBjC;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Y,EAAE,IAAI;AAC5B,UAAU,EAAE,EAAEO,yBAAe;AAC7B,UAAU,SAAS;AACnB,UAAU,UAAU,EAAE;AACtB,YAAY,CAACL,qCAAgC,GAAG,wBAAwB;AACxE,YAAY,mBAAmB,EAAE,IAAI;AACrC,WAAW;AACX,SAAS,CAAC;AACV,QAAQ,IAAI,UAAU,EAAE;AACxB;AACA;AACA,UAAU,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC;AACtC,QAAQ;AACR,MAAM;AACN,IAAI,CAAC;AACL;AACA;AACA,EAAE,CAAC,EAAE,EAAE,CAAC;AACR;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.js","sources":["../../../src/reactrouter-compat-utils/instrumentation.tsx"],"sourcesContent":["/* eslint-disable max-lines */\n// Inspired from Donnie McNeal's solution:\n// https://gist.github.com/wontondon/e8c4bdf2888875e4c755712e99279536\n\nimport {\n browserTracingIntegration,\n startBrowserTracingNavigationSpan,\n startBrowserTracingPageLoadSpan,\n WINDOW,\n} from '@sentry/browser';\nimport type { Client, Integration, Span } from '@sentry/core';\nimport {\n addNonEnumerableProperty,\n debug,\n getActiveSpan,\n getClient,\n getCurrentScope,\n getRootSpan,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n spanToJSON,\n} from '@sentry/core';\nimport * as React from 'react';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { hoistNonReactStatics } from '../hoist-non-react-statics';\nimport type {\n Action,\n AgnosticDataRouteMatch,\n CreateRouterFunction,\n CreateRoutesFromChildren,\n Location,\n MatchRoutes,\n RouteMatch,\n RouteObject,\n Router,\n RouterState,\n UseEffect,\n UseLocation,\n UseNavigationType,\n UseRoutes,\n} from '../types';\nimport { checkRouteForAsyncHandler } from './lazy-routes';\nimport { initializeRouterUtils, resolveRouteNameAndSource } from './utils';\n\nlet _useEffect: UseEffect;\nlet _useLocation: UseLocation;\nlet _useNavigationType: UseNavigationType;\nlet _createRoutesFromChildren: CreateRoutesFromChildren;\nlet _matchRoutes: MatchRoutes;\nlet _enableAsyncRouteHandlers: boolean = false;\n\nconst CLIENTS_WITH_INSTRUMENT_NAVIGATION = new WeakSet<Client>();\n\n/**\n * Adds resolved routes as children to the parent route.\n * Prevents duplicate routes by checking if they already exist.\n */\nexport function addResolvedRoutesToParent(resolvedRoutes: RouteObject[], parentRoute: RouteObject): void {\n const existingChildren = parentRoute.children || [];\n\n const newRoutes = resolvedRoutes.filter(\n newRoute =>\n !existingChildren.some(\n existing =>\n existing === newRoute ||\n (newRoute.path && existing.path === newRoute.path) ||\n (newRoute.id && existing.id === newRoute.id),\n ),\n );\n\n if (newRoutes.length > 0) {\n parentRoute.children = [...existingChildren, ...newRoutes];\n }\n}\n\nexport interface ReactRouterOptions {\n useEffect: UseEffect;\n useLocation: UseLocation;\n useNavigationType: UseNavigationType;\n createRoutesFromChildren: CreateRoutesFromChildren;\n matchRoutes: MatchRoutes;\n /**\n * Whether to strip the basename from the pathname when creating transactions.\n *\n * This is useful for applications that use a basename in their routing setup.\n * @default false\n */\n stripBasename?: boolean;\n /**\n * Enables support for async route handlers.\n *\n * This allows Sentry to track and instrument routes dynamically resolved from async handlers.\n * @default false\n */\n enableAsyncRouteHandlers?: boolean;\n}\n\ntype V6CompatibleVersion = '6' | '7';\n\n// Keeping as a global variable for cross-usage in multiple functions\n// only exported for testing purposes\nexport const allRoutes = new Set<RouteObject>();\n\n/**\n * Processes resolved routes by adding them to allRoutes and checking for nested async handlers.\n */\nexport function processResolvedRoutes(\n resolvedRoutes: RouteObject[],\n parentRoute?: RouteObject,\n currentLocation: Location | null = null,\n): void {\n resolvedRoutes.forEach(child => {\n allRoutes.add(child);\n // Only check for async handlers if the feature is enabled\n if (_enableAsyncRouteHandlers) {\n checkRouteForAsyncHandler(child, processResolvedRoutes);\n }\n });\n\n if (parentRoute) {\n // If a parent route is provided, add the resolved routes as children to the parent route\n addResolvedRoutesToParent(resolvedRoutes, parentRoute);\n }\n\n // After processing lazy routes, check if we need to update an active transaction\n const activeRootSpan = getActiveRootSpan();\n if (activeRootSpan) {\n const spanOp = spanToJSON(activeRootSpan).op;\n\n // Try to use the provided location first, then fall back to global window location if needed\n let location = currentLocation;\n if (!location) {\n if (typeof WINDOW !== 'undefined') {\n const globalLocation = WINDOW.location;\n if (globalLocation) {\n location = { pathname: globalLocation.pathname };\n }\n }\n }\n\n if (location) {\n if (spanOp === 'pageload') {\n // Re-run the pageload transaction update with the newly loaded routes\n updatePageloadTransaction({\n activeRootSpan,\n location: { pathname: location.pathname },\n routes: Array.from(allRoutes),\n allRoutes: Array.from(allRoutes),\n });\n } else if (spanOp === 'navigation') {\n // For navigation spans, update the name with the newly loaded routes\n updateNavigationSpan(activeRootSpan, location, Array.from(allRoutes), false, _matchRoutes);\n }\n }\n }\n}\n\n/**\n * Updates a navigation span with the correct route name after lazy routes have been loaded.\n */\nexport function updateNavigationSpan(\n activeRootSpan: Span,\n location: Location,\n allRoutes: RouteObject[],\n forceUpdate = false,\n matchRoutes: MatchRoutes,\n): void {\n // Check if this span has already been named to avoid multiple updates\n // But allow updates if this is a forced update (e.g., when lazy routes are loaded)\n const hasBeenNamed =\n !forceUpdate && (activeRootSpan as { __sentry_navigation_name_set__?: boolean })?.__sentry_navigation_name_set__;\n\n if (!hasBeenNamed) {\n // Get fresh branches for the current location with all loaded routes\n const currentBranches = matchRoutes(allRoutes, location);\n const [name, source] = resolveRouteNameAndSource(\n location,\n allRoutes,\n allRoutes,\n (currentBranches as RouteMatch[]) || [],\n '',\n );\n\n // Only update if we have a valid name and the span hasn't finished\n const spanJson = spanToJSON(activeRootSpan);\n if (name && !spanJson.timestamp) {\n activeRootSpan.updateName(name);\n activeRootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source);\n\n // Mark this span as having its name set to prevent future updates\n addNonEnumerableProperty(\n activeRootSpan as { __sentry_navigation_name_set__?: boolean },\n '__sentry_navigation_name_set__',\n true,\n );\n }\n }\n}\n\n/**\n * Creates a wrapCreateBrowserRouter function that can be used with all React Router v6 compatible versions.\n */\nexport function createV6CompatibleWrapCreateBrowserRouter<\n TState extends RouterState = RouterState,\n TRouter extends Router<TState> = Router<TState>,\n>(\n createRouterFunction: CreateRouterFunction<TState, TRouter>,\n version: V6CompatibleVersion,\n): CreateRouterFunction<TState, TRouter> {\n if (!_useEffect || !_useLocation || !_useNavigationType || !_matchRoutes) {\n DEBUG_BUILD &&\n debug.warn(\n `reactRouterV${version}Instrumentation was unable to wrap the \\`createRouter\\` function because of one or more missing parameters.`,\n );\n\n return createRouterFunction;\n }\n\n return function (routes: RouteObject[], opts?: Record<string, unknown> & { basename?: string }): TRouter {\n addRoutesToAllRoutes(routes);\n\n // Check for async handlers that might contain sub-route declarations (only if enabled)\n if (_enableAsyncRouteHandlers) {\n for (const route of routes) {\n checkRouteForAsyncHandler(route, processResolvedRoutes);\n }\n }\n\n // Wrap patchRoutesOnNavigation to detect when lazy routes are loaded\n const wrappedOpts = wrapPatchRoutesOnNavigation(opts);\n\n const router = createRouterFunction(routes, wrappedOpts);\n const basename = opts?.basename;\n\n const activeRootSpan = getActiveRootSpan();\n\n // Track whether we've completed the initial pageload to properly distinguish\n // between POPs that occur during pageload vs. legitimate back/forward navigation.\n let isInitialPageloadComplete = false;\n let hasSeenPageloadSpan = !!activeRootSpan && spanToJSON(activeRootSpan).op === 'pageload';\n let hasSeenPopAfterPageload = false;\n\n // The initial load ends when `createBrowserRouter` is called.\n // This is the earliest convenient time to update the transaction name.\n // Callbacks to `router.subscribe` are not called for the initial load.\n if (router.state.historyAction === 'POP' && activeRootSpan) {\n updatePageloadTransaction({\n activeRootSpan,\n location: router.state.location,\n routes,\n basename,\n allRoutes: Array.from(allRoutes),\n });\n }\n\n router.subscribe((state: RouterState) => {\n // Track pageload completion to distinguish POPs during pageload from legitimate back/forward navigation\n if (!isInitialPageloadComplete) {\n const currentRootSpan = getActiveRootSpan();\n const isCurrentlyInPageload = currentRootSpan && spanToJSON(currentRootSpan).op === 'pageload';\n\n if (isCurrentlyInPageload) {\n hasSeenPageloadSpan = true;\n } else if (hasSeenPageloadSpan) {\n // Pageload span was active but is now gone - pageload has completed\n if (state.historyAction === 'POP' && !hasSeenPopAfterPageload) {\n // Pageload ended: ignore the first POP after pageload\n hasSeenPopAfterPageload = true;\n } else {\n // Pageload ended: either non-POP action or subsequent POP\n isInitialPageloadComplete = true;\n }\n }\n // If we haven't seen a pageload span yet, keep waiting (don't mark as complete)\n }\n\n const shouldHandleNavigation =\n state.historyAction === 'PUSH' || (state.historyAction === 'POP' && isInitialPageloadComplete);\n\n if (shouldHandleNavigation) {\n const navigationHandler = (): void => {\n handleNavigation({\n location: state.location,\n routes,\n navigationType: state.historyAction,\n version,\n basename,\n allRoutes: Array.from(allRoutes),\n });\n };\n\n // Wait for the next render if loading an unsettled route\n if (state.navigation.state !== 'idle') {\n requestAnimationFrame(navigationHandler);\n } else {\n navigationHandler();\n }\n }\n });\n\n return router;\n };\n}\n\n/**\n * Creates a wrapCreateMemoryRouter function that can be used with all React Router v6 compatible versions.\n */\nexport function createV6CompatibleWrapCreateMemoryRouter<\n TState extends RouterState = RouterState,\n TRouter extends Router<TState> = Router<TState>,\n>(\n createRouterFunction: CreateRouterFunction<TState, TRouter>,\n version: V6CompatibleVersion,\n): CreateRouterFunction<TState, TRouter> {\n if (!_useEffect || !_useLocation || !_useNavigationType || !_matchRoutes) {\n DEBUG_BUILD &&\n debug.warn(\n `reactRouterV${version}Instrumentation was unable to wrap the \\`createMemoryRouter\\` function because of one or more missing parameters.`,\n );\n\n return createRouterFunction;\n }\n\n return function (\n routes: RouteObject[],\n opts?: Record<string, unknown> & {\n basename?: string;\n initialEntries?: (string | { pathname: string })[];\n initialIndex?: number;\n },\n ): TRouter {\n addRoutesToAllRoutes(routes);\n\n // Check for async handlers that might contain sub-route declarations (only if enabled)\n if (_enableAsyncRouteHandlers) {\n for (const route of routes) {\n checkRouteForAsyncHandler(route, processResolvedRoutes);\n }\n }\n\n // Wrap patchRoutesOnNavigation to detect when lazy routes are loaded\n const wrappedOpts = wrapPatchRoutesOnNavigation(opts, true);\n\n const router = createRouterFunction(routes, wrappedOpts);\n const basename = opts?.basename;\n\n let initialEntry = undefined;\n\n const initialEntries = opts?.initialEntries;\n const initialIndex = opts?.initialIndex;\n\n const hasOnlyOneInitialEntry = initialEntries && initialEntries.length === 1;\n const hasIndexedEntry = initialIndex !== undefined && initialEntries && initialEntries[initialIndex];\n\n initialEntry = hasOnlyOneInitialEntry\n ? initialEntries[0]\n : hasIndexedEntry\n ? initialEntries[initialIndex]\n : undefined;\n\n const location = initialEntry\n ? typeof initialEntry === 'string'\n ? { pathname: initialEntry }\n : initialEntry\n : router.state.location;\n\n const memoryActiveRootSpan = getActiveRootSpan();\n\n if (router.state.historyAction === 'POP' && memoryActiveRootSpan) {\n updatePageloadTransaction({\n activeRootSpan: memoryActiveRootSpan,\n location,\n routes,\n basename,\n allRoutes: Array.from(allRoutes),\n });\n }\n\n // Track whether we've completed the initial pageload to properly distinguish\n // between POPs that occur during pageload vs. legitimate back/forward navigation.\n let isInitialPageloadComplete = false;\n let hasSeenPageloadSpan = !!memoryActiveRootSpan && spanToJSON(memoryActiveRootSpan).op === 'pageload';\n let hasSeenPopAfterPageload = false;\n\n router.subscribe((state: RouterState) => {\n // Track pageload completion to distinguish POPs during pageload from legitimate back/forward navigation\n if (!isInitialPageloadComplete) {\n const currentRootSpan = getActiveRootSpan();\n const isCurrentlyInPageload = currentRootSpan && spanToJSON(currentRootSpan).op === 'pageload';\n\n if (isCurrentlyInPageload) {\n hasSeenPageloadSpan = true;\n } else if (hasSeenPageloadSpan) {\n // Pageload span was active but is now gone - pageload has completed\n if (state.historyAction === 'POP' && !hasSeenPopAfterPageload) {\n // Pageload ended: ignore the first POP after pageload\n hasSeenPopAfterPageload = true;\n } else {\n // Pageload ended: either non-POP action or subsequent POP\n isInitialPageloadComplete = true;\n }\n }\n // If we haven't seen a pageload span yet, keep waiting (don't mark as complete)\n }\n\n const location = state.location;\n\n const shouldHandleNavigation =\n state.historyAction === 'PUSH' || (state.historyAction === 'POP' && isInitialPageloadComplete);\n\n if (shouldHandleNavigation) {\n const navigationHandler = (): void => {\n handleNavigation({\n location,\n routes,\n navigationType: state.historyAction,\n version,\n basename,\n allRoutes: Array.from(allRoutes),\n });\n };\n\n // Wait for the next render if loading an unsettled route\n if (state.navigation.state !== 'idle') {\n requestAnimationFrame(navigationHandler);\n } else {\n navigationHandler();\n }\n }\n });\n\n return router;\n };\n}\n\n/**\n * Creates a browser tracing integration that can be used with all React Router v6 compatible versions.\n */\nexport function createReactRouterV6CompatibleTracingIntegration(\n options: Parameters<typeof browserTracingIntegration>[0] & ReactRouterOptions,\n version: V6CompatibleVersion,\n): Integration {\n const integration = browserTracingIntegration({ ...options, instrumentPageLoad: false, instrumentNavigation: false });\n\n const {\n useEffect,\n useLocation,\n useNavigationType,\n createRoutesFromChildren,\n matchRoutes,\n stripBasename,\n enableAsyncRouteHandlers = false,\n instrumentPageLoad = true,\n instrumentNavigation = true,\n } = options;\n\n return {\n ...integration,\n setup(client) {\n integration.setup(client);\n\n _useEffect = useEffect;\n _useLocation = useLocation;\n _useNavigationType = useNavigationType;\n _matchRoutes = matchRoutes;\n _createRoutesFromChildren = createRoutesFromChildren;\n _enableAsyncRouteHandlers = enableAsyncRouteHandlers;\n\n // Initialize the router utils with the required dependencies\n initializeRouterUtils(matchRoutes, stripBasename || false);\n },\n afterAllSetup(client) {\n integration.afterAllSetup(client);\n\n const initPathName = WINDOW.location?.pathname;\n if (instrumentPageLoad && initPathName) {\n startBrowserTracingPageLoadSpan(client, {\n name: initPathName,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url',\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.pageload.react.reactrouter_v${version}`,\n },\n });\n }\n\n if (instrumentNavigation) {\n CLIENTS_WITH_INSTRUMENT_NAVIGATION.add(client);\n }\n },\n };\n}\n\nexport function createV6CompatibleWrapUseRoutes(origUseRoutes: UseRoutes, version: V6CompatibleVersion): UseRoutes {\n if (!_useEffect || !_useLocation || !_useNavigationType || !_matchRoutes) {\n DEBUG_BUILD &&\n debug.warn(\n 'reactRouterV6Instrumentation was unable to wrap `useRoutes` because of one or more missing parameters.',\n );\n\n return origUseRoutes;\n }\n\n const SentryRoutes: React.FC<{\n children?: React.ReactNode;\n routes: RouteObject[];\n locationArg?: Partial<Location> | string;\n }> = (props: { children?: React.ReactNode; routes: RouteObject[]; locationArg?: Partial<Location> | string }) => {\n const isMountRenderPass = React.useRef(true);\n const { routes, locationArg } = props;\n\n const Routes = origUseRoutes(routes, locationArg);\n\n const location = _useLocation();\n const navigationType = _useNavigationType();\n\n // A value with stable identity to either pick `locationArg` if available or `location` if not\n const stableLocationParam =\n typeof locationArg === 'string' || locationArg?.pathname ? (locationArg as { pathname: string }) : location;\n\n _useEffect(() => {\n const normalizedLocation =\n typeof stableLocationParam === 'string' ? { pathname: stableLocationParam } : stableLocationParam;\n\n if (isMountRenderPass.current) {\n addRoutesToAllRoutes(routes);\n\n updatePageloadTransaction({\n activeRootSpan: getActiveRootSpan(),\n location: normalizedLocation,\n routes,\n allRoutes: Array.from(allRoutes),\n });\n isMountRenderPass.current = false;\n } else {\n handleNavigation({\n location: normalizedLocation,\n routes,\n navigationType,\n version,\n allRoutes: Array.from(allRoutes),\n });\n }\n }, [navigationType, stableLocationParam]);\n\n return Routes;\n };\n\n // eslint-disable-next-line react/display-name\n return (routes: RouteObject[], locationArg?: Partial<Location> | string): React.ReactElement | null => {\n return <SentryRoutes routes={routes} locationArg={locationArg} />;\n };\n}\n\nfunction wrapPatchRoutesOnNavigation(\n opts: Record<string, unknown> | undefined,\n isMemoryRouter = false,\n): Record<string, unknown> {\n if (!opts || !('patchRoutesOnNavigation' in opts) || typeof opts.patchRoutesOnNavigation !== 'function') {\n return opts || {};\n }\n\n const originalPatchRoutes = opts.patchRoutesOnNavigation;\n return {\n ...opts,\n patchRoutesOnNavigation: async (args: unknown) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n const targetPath = (args as any)?.path;\n\n // For browser router, wrap the patch function to update span during patching\n if (!isMemoryRouter) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n const originalPatch = (args as any)?.patch;\n if (originalPatch) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n (args as any).patch = (routeId: string, children: RouteObject[]) => {\n addRoutesToAllRoutes(children);\n const activeRootSpan = getActiveRootSpan();\n if (activeRootSpan && (spanToJSON(activeRootSpan) as { op?: string }).op === 'navigation') {\n updateNavigationSpan(\n activeRootSpan,\n { pathname: targetPath, search: '', hash: '', state: null, key: 'default' },\n Array.from(allRoutes),\n true, // forceUpdate = true since we're loading lazy routes\n _matchRoutes,\n );\n }\n return originalPatch(routeId, children);\n };\n }\n }\n\n const result = await originalPatchRoutes(args);\n\n // Update navigation span after routes are patched\n const activeRootSpan = getActiveRootSpan();\n if (activeRootSpan && (spanToJSON(activeRootSpan) as { op?: string }).op === 'navigation') {\n // Determine pathname based on router type\n let pathname: string | undefined;\n if (isMemoryRouter) {\n // For memory routers, only use targetPath\n pathname = targetPath;\n } else {\n // For browser routers, use targetPath or fall back to window.location\n pathname = targetPath || WINDOW.location?.pathname;\n }\n\n if (pathname) {\n updateNavigationSpan(\n activeRootSpan,\n { pathname, search: '', hash: '', state: null, key: 'default' },\n Array.from(allRoutes),\n false, // forceUpdate = false since this is after lazy routes are loaded\n _matchRoutes,\n );\n }\n }\n\n return result;\n },\n };\n}\n\nexport function handleNavigation(opts: {\n location: Location;\n routes: RouteObject[];\n navigationType: Action;\n version: V6CompatibleVersion;\n matches?: AgnosticDataRouteMatch;\n basename?: string;\n allRoutes?: RouteObject[];\n}): void {\n const { location, routes, navigationType, version, matches, basename, allRoutes } = opts;\n const branches = Array.isArray(matches) ? matches : _matchRoutes(routes, location, basename);\n\n const client = getClient();\n if (!client || !CLIENTS_WITH_INSTRUMENT_NAVIGATION.has(client)) {\n return;\n }\n\n // Avoid starting a navigation span on initial load when a pageload root span is active.\n // This commonly happens when lazy routes resolve during the first render and React Router emits a POP.\n const activeRootSpan = getActiveRootSpan();\n if (activeRootSpan && spanToJSON(activeRootSpan).op === 'pageload' && navigationType === 'POP') {\n return;\n }\n\n if ((navigationType === 'PUSH' || navigationType === 'POP') && branches) {\n const [name, source] = resolveRouteNameAndSource(\n location,\n routes,\n allRoutes || routes,\n branches as RouteMatch[],\n basename,\n );\n\n const activeSpan = getActiveSpan();\n const spanJson = activeSpan && spanToJSON(activeSpan);\n const isAlreadyInNavigationSpan = spanJson?.op === 'navigation';\n\n // Cross usage can result in multiple navigation spans being created without this check\n if (!isAlreadyInNavigationSpan) {\n const navigationSpan = startBrowserTracingNavigationSpan(client, {\n name,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.navigation.react.reactrouter_v${version}`,\n },\n });\n\n // Patch navigation span to handle early cancellation (e.g., document.hidden)\n if (navigationSpan) {\n patchNavigationSpanEnd(navigationSpan, location, routes, basename, allRoutes);\n }\n }\n }\n}\n\n/* Only exported for testing purposes */\nexport function addRoutesToAllRoutes(routes: RouteObject[]): void {\n routes.forEach(route => {\n const extractedChildRoutes = getChildRoutesRecursively(route);\n\n extractedChildRoutes.forEach(r => {\n allRoutes.add(r);\n });\n });\n}\n\nfunction getChildRoutesRecursively(route: RouteObject, allRoutes: Set<RouteObject> = new Set()): Set<RouteObject> {\n if (!allRoutes.has(route)) {\n allRoutes.add(route);\n\n if (route.children && !route.index) {\n route.children.forEach(child => {\n const childRoutes = getChildRoutesRecursively(child, allRoutes);\n\n childRoutes.forEach(r => {\n allRoutes.add(r);\n });\n });\n }\n }\n\n return allRoutes;\n}\n\nfunction updatePageloadTransaction({\n activeRootSpan,\n location,\n routes,\n matches,\n basename,\n allRoutes,\n}: {\n activeRootSpan: Span | undefined;\n location: Location;\n routes: RouteObject[];\n matches?: AgnosticDataRouteMatch;\n basename?: string;\n allRoutes?: RouteObject[];\n}): void {\n const branches = Array.isArray(matches)\n ? matches\n : (_matchRoutes(allRoutes || routes, location, basename) as unknown as RouteMatch[]);\n\n if (branches) {\n const [name, source] = resolveRouteNameAndSource(location, routes, allRoutes || routes, branches, basename);\n\n getCurrentScope().setTransactionName(name || '/');\n\n if (activeRootSpan) {\n activeRootSpan.updateName(name);\n activeRootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source);\n\n // Patch span.end() to ensure we update the name one last time before the span is sent\n patchPageloadSpanEnd(activeRootSpan, location, routes, basename, allRoutes);\n }\n }\n}\n\n/**\n * Patches the span.end() method to update the transaction name one last time before the span is sent.\n * This handles cases where the span is cancelled early (e.g., document.hidden) before lazy routes have finished loading.\n */\nfunction patchSpanEnd(\n span: Span,\n location: Location,\n routes: RouteObject[],\n basename: string | undefined,\n _allRoutes: RouteObject[] | undefined,\n spanType: 'pageload' | 'navigation',\n): void {\n const patchedPropertyName = `__sentry_${spanType}_end_patched__` as const;\n const hasEndBeenPatched = (span as unknown as Record<string, boolean | undefined>)?.[patchedPropertyName];\n\n if (hasEndBeenPatched || !span.end) {\n return;\n }\n\n const originalEnd = span.end.bind(span);\n\n span.end = function patchedEnd(...args) {\n try {\n // Only update if the span source is not already 'route' (i.e., it hasn't been parameterized yet)\n const spanJson = spanToJSON(span);\n const currentSource = spanJson.data?.[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE];\n if (currentSource !== 'route') {\n // Last chance to update the transaction name with the latest route info\n // Use the live global allRoutes Set to include any lazy routes loaded after patching\n const currentAllRoutes = Array.from(allRoutes);\n const branches = _matchRoutes(\n currentAllRoutes.length > 0 ? currentAllRoutes : routes,\n location,\n basename,\n ) as unknown as RouteMatch[];\n\n if (branches) {\n const [name, source] = resolveRouteNameAndSource(\n location,\n routes,\n currentAllRoutes.length > 0 ? currentAllRoutes : routes,\n branches,\n basename,\n );\n\n // Only update if we have a valid name\n if (name && (spanType === 'pageload' || !spanJson.timestamp)) {\n span.updateName(name);\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source);\n }\n }\n }\n } catch (error) {\n // Silently catch errors to ensure span.end() is always called\n DEBUG_BUILD && debug.warn(`Error updating span details before ending: ${error}`);\n }\n\n return originalEnd(...args);\n };\n\n // Mark this span as having its end() method patched to prevent duplicate patching\n addNonEnumerableProperty(span as unknown as Record<string, boolean>, patchedPropertyName, true);\n}\n\nfunction patchPageloadSpanEnd(\n span: Span,\n location: Location,\n routes: RouteObject[],\n basename: string | undefined,\n _allRoutes: RouteObject[] | undefined,\n): void {\n patchSpanEnd(span, location, routes, basename, _allRoutes, 'pageload');\n}\n\nfunction patchNavigationSpanEnd(\n span: Span,\n location: Location,\n routes: RouteObject[],\n basename: string | undefined,\n _allRoutes: RouteObject[] | undefined,\n): void {\n patchSpanEnd(span, location, routes, basename, _allRoutes, 'navigation');\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function createV6CompatibleWithSentryReactRouterRouting<P extends Record<string, any>, R extends React.FC<P>>(\n Routes: R,\n version: V6CompatibleVersion,\n): R {\n if (!_useEffect || !_useLocation || !_useNavigationType || !_createRoutesFromChildren || !_matchRoutes) {\n DEBUG_BUILD &&\n debug.warn(`reactRouterV6Instrumentation was unable to wrap Routes because of one or more missing parameters.\n useEffect: ${_useEffect}. useLocation: ${_useLocation}. useNavigationType: ${_useNavigationType}.\n createRoutesFromChildren: ${_createRoutesFromChildren}. matchRoutes: ${_matchRoutes}.`);\n\n return Routes;\n }\n\n const SentryRoutes: React.FC<P> = (props: P) => {\n const isMountRenderPass = React.useRef(true);\n\n const location = _useLocation();\n const navigationType = _useNavigationType();\n\n _useEffect(\n () => {\n const routes = _createRoutesFromChildren(props.children) as RouteObject[];\n\n if (isMountRenderPass.current) {\n addRoutesToAllRoutes(routes);\n\n updatePageloadTransaction({\n activeRootSpan: getActiveRootSpan(),\n location,\n routes,\n allRoutes: Array.from(allRoutes),\n });\n isMountRenderPass.current = false;\n } else {\n handleNavigation({ location, routes, navigationType, version, allRoutes: Array.from(allRoutes) });\n }\n },\n // `props.children` is purposely not included in the dependency array, because we do not want to re-run this effect\n // when the children change. We only want to start transactions when the location or navigation type change.\n [location, navigationType],\n );\n\n // @ts-expect-error Setting more specific React Component typing for `R` generic above\n // will break advanced type inference done by react router params\n return <Routes {...props} />;\n };\n\n hoistNonReactStatics(SentryRoutes, Routes);\n\n // @ts-expect-error Setting more specific React Component typing for `R` generic above\n // will break advanced type inference done by react router params\n return SentryRoutes;\n}\n\nfunction 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":["checkRouteForAsyncHandler","spanToJSON","WINDOW","resolveRouteNameAndSource","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","addNonEnumerableProperty","DEBUG_BUILD","debug","browserTracingIntegration","initializeRouterUtils","startBrowserTracingPageLoadSpan","SEMANTIC_ATTRIBUTE_SENTRY_OP","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","getClient","getActiveSpan","startBrowserTracingNavigationSpan","getCurrentScope","hoistNonReactStatics","getRootSpan"],"mappings":";;;;;;;;;;AAAA;AACA;AACA;;;AA2CA,IAAI,UAAU;AACd,IAAI,YAAY;AAChB,IAAI,kBAAkB;AACtB,IAAI,yBAAyB;AAC7B,I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,iBAAA,EAAA;AACA,YAAA,QAAA;AACA,YAAA,MAAA;AACA,YAAA,SAAA,EAAA,KAAA,CAAA,IAAA,CAAA,SAAA,CAAA;AACA,WAAA,CAAA;AACA,UAAA,iBAAA,CAAA,OAAA,GAAA,KAAA;AACA,SAAA,MAAA;AACA,UAAA,gBAAA,CAAA,EAAA,QAAA,EAAA,MAAA,EAAA,cAAA,EAAA,OAAA,EAAA,SAAA,EAAA,KAAA,CAAA,IAAA,CAAA,SAAA,CAAA,EAAA,CAAA;AACA;AACA,OAAA;AACA;AACA;AACA,MAAA,CAAA,QAAA,EAAA,cAAA,CAAA;AACA,KAAA;;AAEA;AACA;AACA,IAAA,OAAA,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAA,GAAA,KAAA,EAAA,EAAA;AACA,GAAA;;AAEA,EAAAU,yCAAA,CAAA,YAAA,EAAA,MAAA,CAAA;;AAEA;AACA;AACA,EAAA,OAAA,YAAA;AACA;;AAEA,SAAA,iBAAA,GAAA;AACA,EAAA,MAAA,IAAA,GAAAH,kBAAA,EAAA;AACA,EAAA,MAAA,QAAA,GAAA,IAAA,GAAAI,gBAAA,CAAA,IAAA,CAAA,GAAA,SAAA;;AAEA,EAAA,IAAA,CAAA,QAAA,EAAA;AACA,IAAA,OAAA,SAAA;AACA;;AAEA,EAAA,MAAA,EAAA,GAAAjB,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":"instrumentation.js","sources":["../../../src/reactrouter-compat-utils/instrumentation.tsx"],"sourcesContent":["/* eslint-disable max-lines */\n// Inspired from Donnie McNeal's solution:\n// https://gist.github.com/wontondon/e8c4bdf2888875e4c755712e99279536\n\nimport {\n browserTracingIntegration,\n startBrowserTracingNavigationSpan,\n startBrowserTracingPageLoadSpan,\n WINDOW,\n} from '@sentry/browser';\nimport type { Client, Integration, Span } from '@sentry/core';\nimport {\n addNonEnumerableProperty,\n debug,\n getActiveSpan,\n getClient,\n getCurrentScope,\n getRootSpan,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n spanToJSON,\n} from '@sentry/core';\nimport * as React from 'react';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { hoistNonReactStatics } from '../hoist-non-react-statics';\nimport type {\n Action,\n AgnosticDataRouteMatch,\n CreateRouterFunction,\n CreateRoutesFromChildren,\n Location,\n MatchRoutes,\n RouteMatch,\n RouteObject,\n Router,\n RouterState,\n UseEffect,\n UseLocation,\n UseNavigationType,\n UseRoutes,\n} from '../types';\nimport { checkRouteForAsyncHandler } from './lazy-routes';\nimport { initializeRouterUtils, resolveRouteNameAndSource } from './utils';\n\nlet _useEffect: UseEffect;\nlet _useLocation: UseLocation;\nlet _useNavigationType: UseNavigationType;\nlet _createRoutesFromChildren: CreateRoutesFromChildren;\nlet _matchRoutes: MatchRoutes;\nlet _enableAsyncRouteHandlers: boolean = false;\n\nconst CLIENTS_WITH_INSTRUMENT_NAVIGATION = new WeakSet<Client>();\n\n/**\n * Adds resolved routes as children to the parent route.\n * Prevents duplicate routes by checking if they already exist.\n */\nexport function addResolvedRoutesToParent(resolvedRoutes: RouteObject[], parentRoute: RouteObject): void {\n const existingChildren = parentRoute.children || [];\n\n const newRoutes = resolvedRoutes.filter(\n newRoute =>\n !existingChildren.some(\n existing =>\n existing === newRoute ||\n (newRoute.path && existing.path === newRoute.path) ||\n (newRoute.id && existing.id === newRoute.id),\n ),\n );\n\n if (newRoutes.length > 0) {\n parentRoute.children = [...existingChildren, ...newRoutes];\n }\n}\n\nexport interface ReactRouterOptions {\n useEffect: UseEffect;\n useLocation: UseLocation;\n useNavigationType: UseNavigationType;\n createRoutesFromChildren: CreateRoutesFromChildren;\n matchRoutes: MatchRoutes;\n /**\n * Whether to strip the basename from the pathname when creating transactions.\n *\n * This is useful for applications that use a basename in their routing setup.\n * @default false\n */\n stripBasename?: boolean;\n /**\n * Enables support for async route handlers.\n *\n * This allows Sentry to track and instrument routes dynamically resolved from async handlers.\n * @default false\n */\n enableAsyncRouteHandlers?: boolean;\n}\n\ntype V6CompatibleVersion = '6' | '7';\n\n// Keeping as a global variable for cross-usage in multiple functions\n// only exported for testing purposes\nexport const allRoutes = new Set<RouteObject>();\n\n/**\n * Processes resolved routes by adding them to allRoutes and checking for nested async handlers.\n */\nexport function processResolvedRoutes(\n resolvedRoutes: RouteObject[],\n parentRoute?: RouteObject,\n currentLocation: Location | null = null,\n): void {\n resolvedRoutes.forEach(child => {\n allRoutes.add(child);\n // Only check for async handlers if the feature is enabled\n if (_enableAsyncRouteHandlers) {\n checkRouteForAsyncHandler(child, processResolvedRoutes);\n }\n });\n\n if (parentRoute) {\n // If a parent route is provided, add the resolved routes as children to the parent route\n addResolvedRoutesToParent(resolvedRoutes, parentRoute);\n }\n\n // After processing lazy routes, check if we need to update an active transaction\n const activeRootSpan = getActiveRootSpan();\n if (activeRootSpan) {\n const spanOp = spanToJSON(activeRootSpan).op;\n\n // Try to use the provided location first, then fall back to global window location if needed\n let location = currentLocation;\n if (!location) {\n if (typeof WINDOW !== 'undefined') {\n const globalLocation = WINDOW.location;\n if (globalLocation) {\n location = { pathname: globalLocation.pathname };\n }\n }\n }\n\n if (location) {\n if (spanOp === 'pageload') {\n // Re-run the pageload transaction update with the newly loaded routes\n updatePageloadTransaction({\n activeRootSpan,\n location: { pathname: location.pathname },\n routes: Array.from(allRoutes),\n allRoutes: Array.from(allRoutes),\n });\n } else if (spanOp === 'navigation') {\n // For navigation spans, update the name with the newly loaded routes\n updateNavigationSpan(activeRootSpan, location, Array.from(allRoutes), false, _matchRoutes);\n }\n }\n }\n}\n\n/**\n * Updates a navigation span with the correct route name after lazy routes have been loaded.\n */\nexport function updateNavigationSpan(\n activeRootSpan: Span,\n location: Location,\n allRoutes: RouteObject[],\n forceUpdate = false,\n matchRoutes: MatchRoutes,\n): void {\n // Check if this span has already been named to avoid multiple updates\n // But allow updates if this is a forced update (e.g., when lazy routes are loaded)\n const hasBeenNamed =\n !forceUpdate && (activeRootSpan as { __sentry_navigation_name_set__?: boolean })?.__sentry_navigation_name_set__;\n\n if (!hasBeenNamed) {\n // Get fresh branches for the current location with all loaded routes\n const currentBranches = matchRoutes(allRoutes, location);\n const [name, source] = resolveRouteNameAndSource(\n location,\n allRoutes,\n allRoutes,\n (currentBranches as RouteMatch[]) || [],\n '',\n );\n\n // Only update if we have a valid name and the span hasn't finished\n const spanJson = spanToJSON(activeRootSpan);\n if (name && !spanJson.timestamp) {\n activeRootSpan.updateName(name);\n activeRootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source);\n\n // Mark this span as having its name set to prevent future updates\n addNonEnumerableProperty(\n activeRootSpan as { __sentry_navigation_name_set__?: boolean },\n '__sentry_navigation_name_set__',\n true,\n );\n }\n }\n}\n\n/**\n * Creates a wrapCreateBrowserRouter function that can be used with all React Router v6 compatible versions.\n */\nexport function createV6CompatibleWrapCreateBrowserRouter<\n TState extends RouterState = RouterState,\n TRouter extends Router<TState> = Router<TState>,\n>(\n createRouterFunction: CreateRouterFunction<TState, TRouter>,\n version: V6CompatibleVersion,\n): CreateRouterFunction<TState, TRouter> {\n if (!_useEffect || !_useLocation || !_useNavigationType || !_matchRoutes) {\n DEBUG_BUILD &&\n debug.warn(\n `reactRouterV${version}Instrumentation was unable to wrap the \\`createRouter\\` function because of one or more missing parameters.`,\n );\n\n return createRouterFunction;\n }\n\n return function (routes: RouteObject[], opts?: Record<string, unknown> & { basename?: string }): TRouter {\n addRoutesToAllRoutes(routes);\n\n // Check for async handlers that might contain sub-route declarations (only if enabled)\n if (_enableAsyncRouteHandlers) {\n for (const route of routes) {\n checkRouteForAsyncHandler(route, processResolvedRoutes);\n }\n }\n\n // Wrap patchRoutesOnNavigation to detect when lazy routes are loaded\n const wrappedOpts = wrapPatchRoutesOnNavigation(opts);\n\n const router = createRouterFunction(routes, wrappedOpts);\n const basename = opts?.basename;\n\n const activeRootSpan = getActiveRootSpan();\n\n // Track whether we've completed the initial pageload to properly distinguish\n // between POPs that occur during pageload vs. legitimate back/forward navigation.\n let isInitialPageloadComplete = false;\n let hasSeenPageloadSpan = !!activeRootSpan && spanToJSON(activeRootSpan).op === 'pageload';\n let hasSeenPopAfterPageload = false;\n\n // The initial load ends when `createBrowserRouter` is called.\n // This is the earliest convenient time to update the transaction name.\n // Callbacks to `router.subscribe` are not called for the initial load.\n if (router.state.historyAction === 'POP' && activeRootSpan) {\n updatePageloadTransaction({\n activeRootSpan,\n location: router.state.location,\n routes,\n basename,\n allRoutes: Array.from(allRoutes),\n });\n }\n\n router.subscribe((state: RouterState) => {\n // Track pageload completion to distinguish POPs during pageload from legitimate back/forward navigation\n if (!isInitialPageloadComplete) {\n const currentRootSpan = getActiveRootSpan();\n const isCurrentlyInPageload = currentRootSpan && spanToJSON(currentRootSpan).op === 'pageload';\n\n if (isCurrentlyInPageload) {\n hasSeenPageloadSpan = true;\n } else if (hasSeenPageloadSpan) {\n // Pageload span was active but is now gone - pageload has completed\n if (state.historyAction === 'POP' && !hasSeenPopAfterPageload) {\n // Pageload ended: ignore the first POP after pageload\n hasSeenPopAfterPageload = true;\n } else {\n // Pageload ended: either non-POP action or subsequent POP\n isInitialPageloadComplete = true;\n }\n }\n // If we haven't seen a pageload span yet, keep waiting (don't mark as complete)\n }\n\n const shouldHandleNavigation =\n state.historyAction === 'PUSH' || (state.historyAction === 'POP' && isInitialPageloadComplete);\n\n if (shouldHandleNavigation) {\n const navigationHandler = (): void => {\n handleNavigation({\n location: state.location,\n routes,\n navigationType: state.historyAction,\n version,\n basename,\n allRoutes: Array.from(allRoutes),\n });\n };\n\n // Wait for the next render if loading an unsettled route\n if (state.navigation.state !== 'idle') {\n requestAnimationFrame(navigationHandler);\n } else {\n navigationHandler();\n }\n }\n });\n\n return router;\n };\n}\n\n/**\n * Creates a wrapCreateMemoryRouter function that can be used with all React Router v6 compatible versions.\n */\nexport function createV6CompatibleWrapCreateMemoryRouter<\n TState extends RouterState = RouterState,\n TRouter extends Router<TState> = Router<TState>,\n>(\n createRouterFunction: CreateRouterFunction<TState, TRouter>,\n version: V6CompatibleVersion,\n): CreateRouterFunction<TState, TRouter> {\n if (!_useEffect || !_useLocation || !_useNavigationType || !_matchRoutes) {\n DEBUG_BUILD &&\n debug.warn(\n `reactRouterV${version}Instrumentation was unable to wrap the \\`createMemoryRouter\\` function because of one or more missing parameters.`,\n );\n\n return createRouterFunction;\n }\n\n return function (\n routes: RouteObject[],\n opts?: Record<string, unknown> & {\n basename?: string;\n initialEntries?: (string | { pathname: string })[];\n initialIndex?: number;\n },\n ): TRouter {\n addRoutesToAllRoutes(routes);\n\n // Check for async handlers that might contain sub-route declarations (only if enabled)\n if (_enableAsyncRouteHandlers) {\n for (const route of routes) {\n checkRouteForAsyncHandler(route, processResolvedRoutes);\n }\n }\n\n // Wrap patchRoutesOnNavigation to detect when lazy routes are loaded\n const wrappedOpts = wrapPatchRoutesOnNavigation(opts, true);\n\n const router = createRouterFunction(routes, wrappedOpts);\n const basename = opts?.basename;\n\n let initialEntry = undefined;\n\n const initialEntries = opts?.initialEntries;\n const initialIndex = opts?.initialIndex;\n\n const hasOnlyOneInitialEntry = initialEntries && initialEntries.length === 1;\n const hasIndexedEntry = initialIndex !== undefined && initialEntries && initialEntries[initialIndex];\n\n initialEntry = hasOnlyOneInitialEntry\n ? initialEntries[0]\n : hasIndexedEntry\n ? initialEntries[initialIndex]\n : undefined;\n\n const location = initialEntry\n ? typeof initialEntry === 'string'\n ? { pathname: initialEntry }\n : initialEntry\n : router.state.location;\n\n const memoryActiveRootSpan = getActiveRootSpan();\n\n if (router.state.historyAction === 'POP' && memoryActiveRootSpan) {\n updatePageloadTransaction({\n activeRootSpan: memoryActiveRootSpan,\n location,\n routes,\n basename,\n allRoutes: Array.from(allRoutes),\n });\n }\n\n // Track whether we've completed the initial pageload to properly distinguish\n // between POPs that occur during pageload vs. legitimate back/forward navigation.\n let isInitialPageloadComplete = false;\n let hasSeenPageloadSpan = !!memoryActiveRootSpan && spanToJSON(memoryActiveRootSpan).op === 'pageload';\n let hasSeenPopAfterPageload = false;\n\n router.subscribe((state: RouterState) => {\n // Track pageload completion to distinguish POPs during pageload from legitimate back/forward navigation\n if (!isInitialPageloadComplete) {\n const currentRootSpan = getActiveRootSpan();\n const isCurrentlyInPageload = currentRootSpan && spanToJSON(currentRootSpan).op === 'pageload';\n\n if (isCurrentlyInPageload) {\n hasSeenPageloadSpan = true;\n } else if (hasSeenPageloadSpan) {\n // Pageload span was active but is now gone - pageload has completed\n if (state.historyAction === 'POP' && !hasSeenPopAfterPageload) {\n // Pageload ended: ignore the first POP after pageload\n hasSeenPopAfterPageload = true;\n } else {\n // Pageload ended: either non-POP action or subsequent POP\n isInitialPageloadComplete = true;\n }\n }\n // If we haven't seen a pageload span yet, keep waiting (don't mark as complete)\n }\n\n const location = state.location;\n\n const shouldHandleNavigation =\n state.historyAction === 'PUSH' || (state.historyAction === 'POP' && isInitialPageloadComplete);\n\n if (shouldHandleNavigation) {\n const navigationHandler = (): void => {\n handleNavigation({\n location,\n routes,\n navigationType: state.historyAction,\n version,\n basename,\n allRoutes: Array.from(allRoutes),\n });\n };\n\n // Wait for the next render if loading an unsettled route\n if (state.navigation.state !== 'idle') {\n requestAnimationFrame(navigationHandler);\n } else {\n navigationHandler();\n }\n }\n });\n\n return router;\n };\n}\n\n/**\n * Creates a browser tracing integration that can be used with all React Router v6 compatible versions.\n */\nexport function createReactRouterV6CompatibleTracingIntegration(\n options: Parameters<typeof browserTracingIntegration>[0] & ReactRouterOptions,\n version: V6CompatibleVersion,\n): Integration {\n const integration = browserTracingIntegration({ ...options, instrumentPageLoad: false, instrumentNavigation: false });\n\n const {\n useEffect,\n useLocation,\n useNavigationType,\n createRoutesFromChildren,\n matchRoutes,\n stripBasename,\n enableAsyncRouteHandlers = false,\n instrumentPageLoad = true,\n instrumentNavigation = true,\n } = options;\n\n return {\n ...integration,\n setup(client) {\n integration.setup(client);\n\n _useEffect = useEffect;\n _useLocation = useLocation;\n _useNavigationType = useNavigationType;\n _matchRoutes = matchRoutes;\n _createRoutesFromChildren = createRoutesFromChildren;\n _enableAsyncRouteHandlers = enableAsyncRouteHandlers;\n\n // Initialize the router utils with the required dependencies\n initializeRouterUtils(matchRoutes, stripBasename || false);\n },\n afterAllSetup(client) {\n integration.afterAllSetup(client);\n\n const initPathName = WINDOW.location?.pathname;\n if (instrumentPageLoad && initPathName) {\n startBrowserTracingPageLoadSpan(client, {\n name: initPathName,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url',\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.pageload.react.reactrouter_v${version}`,\n },\n });\n }\n\n if (instrumentNavigation) {\n CLIENTS_WITH_INSTRUMENT_NAVIGATION.add(client);\n }\n },\n };\n}\n\nexport function createV6CompatibleWrapUseRoutes(origUseRoutes: UseRoutes, version: V6CompatibleVersion): UseRoutes {\n if (!_useEffect || !_useLocation || !_useNavigationType || !_matchRoutes) {\n DEBUG_BUILD &&\n debug.warn(\n 'reactRouterV6Instrumentation was unable to wrap `useRoutes` because of one or more missing parameters.',\n );\n\n return origUseRoutes;\n }\n\n const SentryRoutes: React.FC<{\n children?: React.ReactNode;\n routes: RouteObject[];\n locationArg?: Partial<Location> | string;\n }> = (props: { children?: React.ReactNode; routes: RouteObject[]; locationArg?: Partial<Location> | string }) => {\n const isMountRenderPass = React.useRef(true);\n const { routes, locationArg } = props;\n\n const Routes = origUseRoutes(routes, locationArg);\n\n const location = _useLocation();\n const navigationType = _useNavigationType();\n\n // A value with stable identity to either pick `locationArg` if available or `location` if not\n const stableLocationParam =\n typeof locationArg === 'string' || locationArg?.pathname ? (locationArg as { pathname: string }) : location;\n\n _useEffect(() => {\n const normalizedLocation =\n typeof stableLocationParam === 'string' ? { pathname: stableLocationParam } : stableLocationParam;\n\n if (isMountRenderPass.current) {\n addRoutesToAllRoutes(routes);\n\n updatePageloadTransaction({\n activeRootSpan: getActiveRootSpan(),\n location: normalizedLocation,\n routes,\n allRoutes: Array.from(allRoutes),\n });\n isMountRenderPass.current = false;\n } else {\n handleNavigation({\n location: normalizedLocation,\n routes,\n navigationType,\n version,\n allRoutes: Array.from(allRoutes),\n });\n }\n }, [navigationType, stableLocationParam]);\n\n return Routes;\n };\n\n // eslint-disable-next-line react/display-name\n return (routes: RouteObject[], locationArg?: Partial<Location> | string): React.ReactElement | null => {\n return <SentryRoutes routes={routes} locationArg={locationArg} />;\n };\n}\n\nfunction wrapPatchRoutesOnNavigation(\n opts: Record<string, unknown> | undefined,\n isMemoryRouter = false,\n): Record<string, unknown> {\n if (!opts || !('patchRoutesOnNavigation' in opts) || typeof opts.patchRoutesOnNavigation !== 'function') {\n return opts || {};\n }\n\n const originalPatchRoutes = opts.patchRoutesOnNavigation;\n return {\n ...opts,\n patchRoutesOnNavigation: async (args: unknown) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n const targetPath = (args as any)?.path;\n\n // For browser router, wrap the patch function to update span during patching\n if (!isMemoryRouter) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n const originalPatch = (args as any)?.patch;\n if (originalPatch) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n (args as any).patch = (routeId: string, children: RouteObject[]) => {\n addRoutesToAllRoutes(children);\n const activeRootSpan = getActiveRootSpan();\n if (activeRootSpan && (spanToJSON(activeRootSpan) as { op?: string }).op === 'navigation') {\n updateNavigationSpan(\n activeRootSpan,\n { pathname: targetPath, search: '', hash: '', state: null, key: 'default' },\n Array.from(allRoutes),\n true, // forceUpdate = true since we're loading lazy routes\n _matchRoutes,\n );\n }\n return originalPatch(routeId, children);\n };\n }\n }\n\n const result = await originalPatchRoutes(args);\n\n // Update navigation span after routes are patched\n const activeRootSpan = getActiveRootSpan();\n if (activeRootSpan && (spanToJSON(activeRootSpan) as { op?: string }).op === 'navigation') {\n // Determine pathname based on router type\n let pathname: string | undefined;\n if (isMemoryRouter) {\n // For memory routers, only use targetPath\n pathname = targetPath;\n } else {\n // For browser routers, use targetPath or fall back to window.location\n pathname = targetPath || WINDOW.location?.pathname;\n }\n\n if (pathname) {\n updateNavigationSpan(\n activeRootSpan,\n { pathname, search: '', hash: '', state: null, key: 'default' },\n Array.from(allRoutes),\n false, // forceUpdate = false since this is after lazy routes are loaded\n _matchRoutes,\n );\n }\n }\n\n return result;\n },\n };\n}\n\nexport function handleNavigation(opts: {\n location: Location;\n routes: RouteObject[];\n navigationType: Action;\n version: V6CompatibleVersion;\n matches?: AgnosticDataRouteMatch;\n basename?: string;\n allRoutes?: RouteObject[];\n}): void {\n const { location, routes, navigationType, version, matches, basename, allRoutes } = opts;\n const branches = Array.isArray(matches) ? matches : _matchRoutes(routes, location, basename);\n\n const client = getClient();\n if (!client || !CLIENTS_WITH_INSTRUMENT_NAVIGATION.has(client)) {\n return;\n }\n\n // Avoid starting a navigation span on initial load when a pageload root span is active.\n // This commonly happens when lazy routes resolve during the first render and React Router emits a POP.\n const activeRootSpan = getActiveRootSpan();\n if (activeRootSpan && spanToJSON(activeRootSpan).op === 'pageload' && navigationType === 'POP') {\n return;\n }\n\n if ((navigationType === 'PUSH' || navigationType === 'POP') && branches) {\n const [name, source] = resolveRouteNameAndSource(\n location,\n routes,\n allRoutes || routes,\n branches as RouteMatch[],\n basename,\n );\n\n const activeSpan = getActiveSpan();\n const spanJson = activeSpan && spanToJSON(activeSpan);\n const isAlreadyInNavigationSpan = spanJson?.op === 'navigation';\n\n // Cross usage can result in multiple navigation spans being created without this check\n if (!isAlreadyInNavigationSpan) {\n const navigationSpan = startBrowserTracingNavigationSpan(client, {\n name,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.navigation.react.reactrouter_v${version}`,\n },\n });\n\n // Patch navigation span to handle early cancellation (e.g., document.hidden)\n if (navigationSpan) {\n patchNavigationSpanEnd(navigationSpan, location, routes, basename, allRoutes);\n }\n }\n }\n}\n\n/* Only exported for testing purposes */\nexport function addRoutesToAllRoutes(routes: RouteObject[]): void {\n routes.forEach(route => {\n const extractedChildRoutes = getChildRoutesRecursively(route);\n\n extractedChildRoutes.forEach(r => {\n allRoutes.add(r);\n });\n });\n}\n\nfunction getChildRoutesRecursively(route: RouteObject, allRoutes: Set<RouteObject> = new Set()): Set<RouteObject> {\n if (!allRoutes.has(route)) {\n allRoutes.add(route);\n\n if (route.children && !route.index) {\n route.children.forEach(child => {\n const childRoutes = getChildRoutesRecursively(child, allRoutes);\n\n childRoutes.forEach(r => {\n allRoutes.add(r);\n });\n });\n }\n }\n\n return allRoutes;\n}\n\nfunction updatePageloadTransaction({\n activeRootSpan,\n location,\n routes,\n matches,\n basename,\n allRoutes,\n}: {\n activeRootSpan: Span | undefined;\n location: Location;\n routes: RouteObject[];\n matches?: AgnosticDataRouteMatch;\n basename?: string;\n allRoutes?: RouteObject[];\n}): void {\n const branches = Array.isArray(matches)\n ? matches\n : (_matchRoutes(allRoutes || routes, location, basename) as unknown as RouteMatch[]);\n\n if (branches) {\n const [name, source] = resolveRouteNameAndSource(location, routes, allRoutes || routes, branches, basename);\n\n getCurrentScope().setTransactionName(name || '/');\n\n if (activeRootSpan) {\n activeRootSpan.updateName(name);\n activeRootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source);\n\n // Patch span.end() to ensure we update the name one last time before the span is sent\n patchPageloadSpanEnd(activeRootSpan, location, routes, basename, allRoutes);\n }\n }\n}\n\n/**\n * Patches the span.end() method to update the transaction name one last time before the span is sent.\n * This handles cases where the span is cancelled early (e.g., document.hidden) before lazy routes have finished loading.\n */\nfunction patchSpanEnd(\n span: Span,\n location: Location,\n routes: RouteObject[],\n basename: string | undefined,\n _allRoutes: RouteObject[] | undefined,\n spanType: 'pageload' | 'navigation',\n): void {\n const patchedPropertyName = `__sentry_${spanType}_end_patched__` as const;\n const hasEndBeenPatched = (span as unknown as Record<string, boolean | undefined>)?.[patchedPropertyName];\n\n if (hasEndBeenPatched || !span.end) {\n return;\n }\n\n const originalEnd = span.end.bind(span);\n\n span.end = function patchedEnd(...args) {\n try {\n // Only update if the span source is not already 'route' (i.e., it hasn't been parameterized yet)\n const spanJson = spanToJSON(span);\n const currentSource = spanJson.data?.[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE];\n if (currentSource !== 'route') {\n // Last chance to update the transaction name with the latest route info\n // Use the live global allRoutes Set to include any lazy routes loaded after patching\n const currentAllRoutes = Array.from(allRoutes);\n const branches = _matchRoutes(\n currentAllRoutes.length > 0 ? currentAllRoutes : routes,\n location,\n basename,\n ) as unknown as RouteMatch[];\n\n if (branches) {\n const [name, source] = resolveRouteNameAndSource(\n location,\n routes,\n currentAllRoutes.length > 0 ? currentAllRoutes : routes,\n branches,\n basename,\n );\n\n // Only update if we have a valid name\n if (name && (spanType === 'pageload' || !spanJson.timestamp)) {\n span.updateName(name);\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source);\n }\n }\n }\n } catch (error) {\n // Silently catch errors to ensure span.end() is always called\n DEBUG_BUILD && debug.warn(`Error updating span details before ending: ${error}`);\n }\n\n return originalEnd(...args);\n };\n\n // Mark this span as having its end() method patched to prevent duplicate patching\n addNonEnumerableProperty(span as unknown as Record<string, boolean>, patchedPropertyName, true);\n}\n\nfunction patchPageloadSpanEnd(\n span: Span,\n location: Location,\n routes: RouteObject[],\n basename: string | undefined,\n _allRoutes: RouteObject[] | undefined,\n): void {\n patchSpanEnd(span, location, routes, basename, _allRoutes, 'pageload');\n}\n\nfunction patchNavigationSpanEnd(\n span: Span,\n location: Location,\n routes: RouteObject[],\n basename: string | undefined,\n _allRoutes: RouteObject[] | undefined,\n): void {\n patchSpanEnd(span, location, routes, basename, _allRoutes, 'navigation');\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function createV6CompatibleWithSentryReactRouterRouting<P extends Record<string, any>, R extends React.FC<P>>(\n Routes: R,\n version: V6CompatibleVersion,\n): R {\n if (!_useEffect || !_useLocation || !_useNavigationType || !_createRoutesFromChildren || !_matchRoutes) {\n DEBUG_BUILD &&\n debug.warn(`reactRouterV6Instrumentation was unable to wrap Routes because of one or more missing parameters.\n useEffect: ${_useEffect}. useLocation: ${_useLocation}. useNavigationType: ${_useNavigationType}.\n createRoutesFromChildren: ${_createRoutesFromChildren}. matchRoutes: ${_matchRoutes}.`);\n\n return Routes;\n }\n\n const SentryRoutes: React.FC<P> = (props: P) => {\n const isMountRenderPass = React.useRef(true);\n\n const location = _useLocation();\n const navigationType = _useNavigationType();\n\n _useEffect(\n () => {\n const routes = _createRoutesFromChildren(props.children) as RouteObject[];\n\n if (isMountRenderPass.current) {\n addRoutesToAllRoutes(routes);\n\n updatePageloadTransaction({\n activeRootSpan: getActiveRootSpan(),\n location,\n routes,\n allRoutes: Array.from(allRoutes),\n });\n isMountRenderPass.current = false;\n } else {\n handleNavigation({ location, routes, navigationType, version, allRoutes: Array.from(allRoutes) });\n }\n },\n // `props.children` is purposely not included in the dependency array, because we do not want to re-run this effect\n // when the children change. We only want to start transactions when the location or navigation type change.\n [location, navigationType],\n );\n\n // @ts-expect-error Setting more specific React Component typing for `R` generic above\n // will break advanced type inference done by react router params\n return <Routes {...props} />;\n };\n\n hoistNonReactStatics(SentryRoutes, Routes);\n\n // @ts-expect-error Setting more specific React Component typing for `R` generic above\n // will break advanced type inference done by react router params\n return SentryRoutes;\n}\n\nfunction 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":["checkRouteForAsyncHandler","spanToJSON","WINDOW","resolveRouteNameAndSource","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","addNonEnumerableProperty","DEBUG_BUILD","debug","browserTracingIntegration","initializeRouterUtils","startBrowserTracingPageLoadSpan","SEMANTIC_ATTRIBUTE_SENTRY_OP","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","getClient","getActiveSpan","startBrowserTracingNavigationSpan","getCurrentScope","hoistNonReactStatics","getRootSpan"],"mappings":";;;;;;;;;;AAAA;AACA;AACA;;;AA2CA,IAAI,UAAU;AACd,IAAI,YAAY;AAChB,IAAI,kBAAkB;AACtB,IAAI,yBAAyB;AAC7B,IAAI,YAAY;AAChB,IAAI,yBAAyB,GAAY,KAAK;;AAE9C,MAAM,kCAAA,GAAqC,IAAI,OAAO,EAAU;;AAEhE;AACA;AACA;AACA;AACO,SAAS,yBAAyB,CAAC,cAAc,EAAiB,WAAW,EAAqB;AACzG,EAAE,MAAM,mBAAmB,WAAW,CAAC,QAAA,IAAY,EAAE;;AAErD,EAAE,MAAM,SAAA,GAAY,cAAc,CAAC,MAAM;AACzC,IAAI,QAAA;AACJ,MAAM,CAAC,gBAAgB,CAAC,IAAI;AAC5B,QAAQ,QAAA;AACR,UAAU,QAAA,KAAa,QAAA;AACvB,WAAW,QAAQ,CAAC,IAAA,IAAQ,QAAQ,CAAC,IAAA,KAAS,QAAQ,CAAC,IAAI,CAAA;AAC3D,WAAW,QAAQ,CAAC,EAAA,IAAM,QAAQ,CAAC,EAAA,KAAO,QAAQ,CAAC,EAAE,CAAC;AACtD,OAAO;AACP,GAAG;;AAEH,EAAE,IAAI,SAAS,CAAC,MAAA,GAAS,CAAC,EAAE;AAC5B,IA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A;AACA,UAAA,iBAAA,CAAA,OAAA,GAAA,KAAA;AACA,QAAA,CAAA,MAAA;AACA,UAAA,gBAAA,CAAA,EAAA,QAAA,EAAA,MAAA,EAAA,cAAA,EAAA,OAAA,EAAA,SAAA,EAAA,KAAA,CAAA,IAAA,CAAA,SAAA,CAAA,EAAA,CAAA;AACA,QAAA;AACA,MAAA,CAAA;AACA;AACA;AACA,MAAA,CAAA,QAAA,EAAA,cAAA,CAAA;AACA,KAAA;;AAEA;AACA;AACA,IAAA,OAAA,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAA,GAAA,KAAA,EAAA,EAAA;AACA,EAAA,CAAA;;AAEA,EAAAU,yCAAA,CAAA,YAAA,EAAA,MAAA,CAAA;;AAEA;AACA;AACA,EAAA,OAAA,YAAA;AACA;;AAEA,SAAA,iBAAA,GAAA;AACA,EAAA,MAAA,IAAA,GAAAH,kBAAA,EAAA;AACA,EAAA,MAAA,QAAA,GAAA,IAAA,GAAAI,gBAAA,CAAA,IAAA,CAAA,GAAA,SAAA;;AAEA,EAAA,IAAA,CAAA,QAAA,EAAA;AACA,IAAA,OAAA,SAAA;AACA,EAAA;;AAEA,EAAA,MAAA,EAAA,GAAAjB,eAAA,CAAA,QAAA,CAAA,CAAA,EAAA;;AAEA;AACA,EAAA,OAAA,EAAA,KAAA,YAAA,IAAA,EAAA,KAAA,UAAA,GAAA,QAAA,GAAA,SAAA;AACA;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazy-routes.js","sources":["../../../src/reactrouter-compat-utils/lazy-routes.tsx"],"sourcesContent":["import { addNonEnumerableProperty, debug, isThenable } from '@sentry/core';\nimport { DEBUG_BUILD } from '../debug-build';\nimport type { Location, RouteObject } from '../types';\n\n/**\n * Creates a proxy wrapper for an async handler function.\n */\nexport function createAsyncHandlerProxy(\n originalFunction: (...args: unknown[]) => unknown,\n route: RouteObject,\n handlerKey: string,\n processResolvedRoutes: (resolvedRoutes: RouteObject[], parentRoute?: RouteObject, currentLocation?: Location) => void,\n): (...args: unknown[]) => unknown {\n const proxy = new Proxy(originalFunction, {\n apply(target: (...args: unknown[]) => unknown, thisArg, argArray) {\n const result = target.apply(thisArg, argArray);\n handleAsyncHandlerResult(result, route, handlerKey, processResolvedRoutes);\n return result;\n },\n });\n\n addNonEnumerableProperty(proxy, '__sentry_proxied__', true);\n\n return proxy;\n}\n\n/**\n * Handles the result of an async handler function call.\n */\nexport function handleAsyncHandlerResult(\n result: unknown,\n route: RouteObject,\n handlerKey: string,\n processResolvedRoutes: (resolvedRoutes: RouteObject[], parentRoute?: RouteObject, currentLocation?: Location) => void,\n): void {\n if (isThenable(result)) {\n (result as Promise<unknown>)\n .then((resolvedRoutes: unknown) => {\n if (Array.isArray(resolvedRoutes)) {\n processResolvedRoutes(resolvedRoutes, route);\n }\n })\n .catch((e: unknown) => {\n DEBUG_BUILD && debug.warn(`Error resolving async handler '${handlerKey}' for route`, route, e);\n });\n } else if (Array.isArray(result)) {\n processResolvedRoutes(result, route);\n }\n}\n\n/**\n * Recursively checks a route for async handlers and sets up Proxies to add discovered child routes to allRoutes when called.\n */\nexport function checkRouteForAsyncHandler(\n route: RouteObject,\n processResolvedRoutes: (resolvedRoutes: RouteObject[], parentRoute?: RouteObject, currentLocation?: Location) => void,\n): void {\n // Set up proxies for any functions in the route's handle\n if (route.handle && typeof route.handle === 'object') {\n for (const key of Object.keys(route.handle)) {\n const maybeFn = route.handle[key];\n if (typeof maybeFn === 'function' && !(maybeFn as { __sentry_proxied__?: boolean }).__sentry_proxied__) {\n route.handle[key] = createAsyncHandlerProxy(maybeFn, route, key, processResolvedRoutes);\n }\n }\n }\n\n // Recursively check child routes\n if (Array.isArray(route.children)) {\n for (const child of route.children) {\n checkRouteForAsyncHandler(child, processResolvedRoutes);\n }\n }\n}\n"],"names":["addNonEnumerableProperty","isThenable","DEBUG_BUILD","debug"],"mappings":";;;;;AAIA;AACA;AACA;AACO,SAAS,uBAAuB;AACvC,EAAE,gBAAgB;AAClB,EAAE,KAAK;AACP,EAAE,UAAU;AACZ,EAAE,qBAAqB;AACvB,EAAmC;AACnC,EAAE,MAAM,KAAA,GAAQ,IAAI,KAAK,CAAC,gBAAgB,EAAE;AAC5C,IAAI,KAAK,CAAC,MAAM,EAAmC,OAAO,EAAE,QAAQ,EAAE;AACtE,MAAM,MAAM,MAAA,GAAS,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC;AACpD,MAAM,wBAAwB,CAAC,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,qBAAqB,CAAC;AAChF,MAAM,OAAO,MAAM;AACnB,
|
|
1
|
+
{"version":3,"file":"lazy-routes.js","sources":["../../../src/reactrouter-compat-utils/lazy-routes.tsx"],"sourcesContent":["import { addNonEnumerableProperty, debug, isThenable } from '@sentry/core';\nimport { DEBUG_BUILD } from '../debug-build';\nimport type { Location, RouteObject } from '../types';\n\n/**\n * Creates a proxy wrapper for an async handler function.\n */\nexport function createAsyncHandlerProxy(\n originalFunction: (...args: unknown[]) => unknown,\n route: RouteObject,\n handlerKey: string,\n processResolvedRoutes: (resolvedRoutes: RouteObject[], parentRoute?: RouteObject, currentLocation?: Location) => void,\n): (...args: unknown[]) => unknown {\n const proxy = new Proxy(originalFunction, {\n apply(target: (...args: unknown[]) => unknown, thisArg, argArray) {\n const result = target.apply(thisArg, argArray);\n handleAsyncHandlerResult(result, route, handlerKey, processResolvedRoutes);\n return result;\n },\n });\n\n addNonEnumerableProperty(proxy, '__sentry_proxied__', true);\n\n return proxy;\n}\n\n/**\n * Handles the result of an async handler function call.\n */\nexport function handleAsyncHandlerResult(\n result: unknown,\n route: RouteObject,\n handlerKey: string,\n processResolvedRoutes: (resolvedRoutes: RouteObject[], parentRoute?: RouteObject, currentLocation?: Location) => void,\n): void {\n if (isThenable(result)) {\n (result as Promise<unknown>)\n .then((resolvedRoutes: unknown) => {\n if (Array.isArray(resolvedRoutes)) {\n processResolvedRoutes(resolvedRoutes, route);\n }\n })\n .catch((e: unknown) => {\n DEBUG_BUILD && debug.warn(`Error resolving async handler '${handlerKey}' for route`, route, e);\n });\n } else if (Array.isArray(result)) {\n processResolvedRoutes(result, route);\n }\n}\n\n/**\n * Recursively checks a route for async handlers and sets up Proxies to add discovered child routes to allRoutes when called.\n */\nexport function checkRouteForAsyncHandler(\n route: RouteObject,\n processResolvedRoutes: (resolvedRoutes: RouteObject[], parentRoute?: RouteObject, currentLocation?: Location) => void,\n): void {\n // Set up proxies for any functions in the route's handle\n if (route.handle && typeof route.handle === 'object') {\n for (const key of Object.keys(route.handle)) {\n const maybeFn = route.handle[key];\n if (typeof maybeFn === 'function' && !(maybeFn as { __sentry_proxied__?: boolean }).__sentry_proxied__) {\n route.handle[key] = createAsyncHandlerProxy(maybeFn, route, key, processResolvedRoutes);\n }\n }\n }\n\n // Recursively check child routes\n if (Array.isArray(route.children)) {\n for (const child of route.children) {\n checkRouteForAsyncHandler(child, processResolvedRoutes);\n }\n }\n}\n"],"names":["addNonEnumerableProperty","isThenable","DEBUG_BUILD","debug"],"mappings":";;;;;AAIA;AACA;AACA;AACO,SAAS,uBAAuB;AACvC,EAAE,gBAAgB;AAClB,EAAE,KAAK;AACP,EAAE,UAAU;AACZ,EAAE,qBAAqB;AACvB,EAAmC;AACnC,EAAE,MAAM,KAAA,GAAQ,IAAI,KAAK,CAAC,gBAAgB,EAAE;AAC5C,IAAI,KAAK,CAAC,MAAM,EAAmC,OAAO,EAAE,QAAQ,EAAE;AACtE,MAAM,MAAM,MAAA,GAAS,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC;AACpD,MAAM,wBAAwB,CAAC,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,qBAAqB,CAAC;AAChF,MAAM,OAAO,MAAM;AACnB,IAAI,CAAC;AACL,GAAG,CAAC;;AAEJ,EAAEA,6BAAwB,CAAC,KAAK,EAAE,oBAAoB,EAAE,IAAI,CAAC;;AAE7D,EAAE,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AE,qBAAqB,CAAC;AAC/F,MAAM;AACN,IAAI;AACJ,EAAE;;AAEF;AACA,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE;AACrC,IAAI,KAAK,MAAM,KAAA,IAAS,KAAK,CAAC,QAAQ,EAAE;AACxC,MAAM,yBAAyB,CAAC,KAAK,EAAE,qBAAqB,CAAC;AAC7D,IAAI;AACJ,EAAE;AACF;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../src/reactrouter-compat-utils/utils.ts"],"sourcesContent":["import type { TransactionSource } from '@sentry/core';\nimport type { Location, MatchRoutes, RouteMatch, RouteObject } from '../types';\n\n// Global variables that these utilities depend on\nlet _matchRoutes: MatchRoutes;\nlet _stripBasename: boolean = false;\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/**\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/**\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 */\nfunction 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// 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 * 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 let pathBuilder = '';\n\n if (branches) {\n for (const branch of branches) {\n const route = branch.route;\n if (route) {\n // Early return if index route\n if (route.index) {\n return sendIndexPath(pathBuilder, branch.pathname, basename);\n }\n const path = route.path;\n\n // If path is not a wildcard and has no child routes, append the path\n if (path && !pathIsWildcardAndHasChildren(path, branch)) {\n const newPath = path[0] === '/' || pathBuilder[pathBuilder.length - 1] === '/' ? path : `/${path}`;\n pathBuilder = trimSlash(pathBuilder) + prefixWithSlash(newPath);\n\n // If the path matches the current location, return the path\n if (trimSlash(location.pathname) === trimSlash(basename + branch.pathname)) {\n if (\n // If the route defined on the element is something like\n // <Route path=\"/stores/:storeId/products/:productId\" element={<div>Product</div>} />\n // We should check against the branch.pathname for the number of / separators\n getNumberOfUrlSegments(pathBuilder) !== getNumberOfUrlSegments(branch.pathname) &&\n // We should not count wildcard operators in the url segments calculation\n !pathEndsWithWildcard(pathBuilder)\n ) {\n return [(_stripBasename ? '' : basename) + newPath, 'route'];\n }\n\n // if the last character of the pathbuilder is a wildcard and there are children, remove the wildcard\n if (pathIsWildcardAndHasChildren(pathBuilder, branch)) {\n pathBuilder = pathBuilder.slice(0, -1);\n }\n\n return [(_stripBasename ? '' : basename) + pathBuilder, 'route'];\n }\n }\n }\n }\n }\n\n const fallbackTransactionName = _stripBasename\n ? stripBasenameFromPathname(location.pathname, basename)\n : location.pathname || '';\n\n return [fallbackTransactionName, '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): [string, TransactionSource] {\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"],"names":[],"mappings":";;AAGA;AACA,IAAI,YAAY;AAChB,IAAI,cAAc,GAAY,KAAK;;AAEnC;AACA;AACA;AACA;AACO,SAAS,qBAAqB,CAAC,WAAW,EAAe,aAAa,GAAY,KAAK,EAAQ;AACtG,EAAE,YAAA,GAAe,WAAW;AAC5B,EAAE,cAAA,GAAiB,aAAa;AAChC;;AAEA;AACA,SAAS,QAAQ,CAAC,KAAK,EAAsB;AAC7C,EAAE,OAAO,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,IAAA,IAAQ,EAAE,CAAC;AAC7C;;AAEA,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AAEA,EAAA,IAAA,mBAAA,EAAA;AACA,IAAA,IAAA,GAAA,eAAA,CAAA,6BAAA,CAAA,SAAA,EAAA,QAAA,CAAA,CAAA;AACA,IAAA,MAAA,GAAA,OAAA;AACA;;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;;AAEA,EAAA,OAAA,CAAA,IAAA,IAAA,QAAA,CAAA,QAAA,EAAA,MAAA,CAAA;AACA;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../src/reactrouter-compat-utils/utils.ts"],"sourcesContent":["import type { TransactionSource } from '@sentry/core';\nimport type { Location, MatchRoutes, RouteMatch, RouteObject } from '../types';\n\n// Global variables that these utilities depend on\nlet _matchRoutes: MatchRoutes;\nlet _stripBasename: boolean = false;\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/**\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/**\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 */\nfunction 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// 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 * 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 let pathBuilder = '';\n\n if (branches) {\n for (const branch of branches) {\n const route = branch.route;\n if (route) {\n // Early return if index route\n if (route.index) {\n return sendIndexPath(pathBuilder, branch.pathname, basename);\n }\n const path = route.path;\n\n // If path is not a wildcard and has no child routes, append the path\n if (path && !pathIsWildcardAndHasChildren(path, branch)) {\n const newPath = path[0] === '/' || pathBuilder[pathBuilder.length - 1] === '/' ? path : `/${path}`;\n pathBuilder = trimSlash(pathBuilder) + prefixWithSlash(newPath);\n\n // If the path matches the current location, return the path\n if (trimSlash(location.pathname) === trimSlash(basename + branch.pathname)) {\n if (\n // If the route defined on the element is something like\n // <Route path=\"/stores/:storeId/products/:productId\" element={<div>Product</div>} />\n // We should check against the branch.pathname for the number of / separators\n getNumberOfUrlSegments(pathBuilder) !== getNumberOfUrlSegments(branch.pathname) &&\n // We should not count wildcard operators in the url segments calculation\n !pathEndsWithWildcard(pathBuilder)\n ) {\n return [(_stripBasename ? '' : basename) + newPath, 'route'];\n }\n\n // if the last character of the pathbuilder is a wildcard and there are children, remove the wildcard\n if (pathIsWildcardAndHasChildren(pathBuilder, branch)) {\n pathBuilder = pathBuilder.slice(0, -1);\n }\n\n return [(_stripBasename ? '' : basename) + pathBuilder, 'route'];\n }\n }\n }\n }\n }\n\n const fallbackTransactionName = _stripBasename\n ? stripBasenameFromPathname(location.pathname, basename)\n : location.pathname || '';\n\n return [fallbackTransactionName, '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): [string, TransactionSource] {\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"],"names":[],"mappings":";;AAGA;AACA,IAAI,YAAY;AAChB,IAAI,cAAc,GAAY,KAAK;;AAEnC;AACA;AACA;AACA;AACO,SAAS,qBAAqB,CAAC,WAAW,EAAe,aAAa,GAAY,KAAK,EAAQ;AACtG,EAAE,YAAA,GAAe,WAAW;AAC5B,EAAE,cAAA,GAAiB,aAAa;AAChC;;AAEA;AACA,SAAS,QAAQ,CAAC,KAAK,EA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;AACA,EAAA,MAAA;AACA,EAAA,SAAA;AACA,EAAA,QAAA;AACA,EAAA,QAAA,GAAA,EAAA;AACA,EAAA;AACA,EAAA,IAAA,IAAA;AACA,EAAA,IAAA,MAAA,GAAA,KAAA;;AAEA,EAAA,MAAA,mBAAA,GAAA,+BAAA,CAAA,QAAA,EAAA,SAAA,CAAA;;AAEA,EAAA,IAAA,mBAAA,EAAA;AACA,IAAA,IAAA,GAAA,eAAA,CAAA,6BAAA,CAAA,SAAA,EAAA,QAAA,CAAA,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;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactrouter.js","sources":["../../src/reactrouter.tsx"],"sourcesContent":["import {\n browserTracingIntegration,\n startBrowserTracingNavigationSpan,\n startBrowserTracingPageLoadSpan,\n WINDOW,\n} from '@sentry/browser';\nimport type { Client, Integration, Span, TransactionSource } from '@sentry/core';\nimport {\n getActiveSpan,\n getCurrentScope,\n getRootSpan,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n spanToJSON,\n} from '@sentry/core';\nimport type { ReactElement } from 'react';\nimport * as React from 'react';\nimport { hoistNonReactStatics } from './hoist-non-react-statics';\nimport type { Action, Location } from './types';\n\n// We need to disable eslint no-explicit-any because any is required for the\n// react-router typings.\ntype Match = { path: string; url: string; params: Record<string, any>; isExact: boolean }; // eslint-disable-line @typescript-eslint/no-explicit-any\n\nexport type RouterHistory = {\n location?: Location;\n listen?(cb: (location: Location, action: Action) => void): void;\n} & Record<string, any>; // eslint-disable-line @typescript-eslint/no-explicit-any\n\nexport type RouteConfig = {\n [propName: string]: unknown;\n path?: string | string[];\n exact?: boolean;\n component?: ReactElement;\n routes?: RouteConfig[];\n};\n\nexport type MatchPath = (pathname: string, props: string | string[] | any, parent?: Match | null) => Match | null; // eslint-disable-line @typescript-eslint/no-explicit-any\n\ninterface ReactRouterOptions {\n history: RouterHistory;\n routes?: RouteConfig[];\n matchPath?: MatchPath;\n}\n\n/**\n * A browser tracing integration that uses React Router v4 to instrument navigations.\n * Expects `history` (and optionally `routes` and `matchPath`) to be passed as options.\n */\nexport function reactRouterV4BrowserTracingIntegration(\n options: Parameters<typeof browserTracingIntegration>[0] & ReactRouterOptions,\n): Integration {\n const integration = browserTracingIntegration({\n ...options,\n instrumentPageLoad: false,\n instrumentNavigation: false,\n });\n\n const { history, routes, matchPath, instrumentPageLoad = true, instrumentNavigation = true } = options;\n\n return {\n ...integration,\n afterAllSetup(client) {\n integration.afterAllSetup(client);\n\n instrumentReactRouter(\n client,\n instrumentPageLoad,\n instrumentNavigation,\n history,\n 'reactrouter_v4',\n routes,\n matchPath,\n );\n },\n };\n}\n\n/**\n * A browser tracing integration that uses React Router v5 to instrument navigations.\n * Expects `history` (and optionally `routes` and `matchPath`) to be passed as options.\n */\nexport function reactRouterV5BrowserTracingIntegration(\n options: Parameters<typeof browserTracingIntegration>[0] & ReactRouterOptions,\n): Integration {\n const integration = browserTracingIntegration({\n ...options,\n instrumentPageLoad: false,\n instrumentNavigation: false,\n });\n\n const { history, routes, matchPath, instrumentPageLoad = true, instrumentNavigation = true } = options;\n\n return {\n ...integration,\n afterAllSetup(client) {\n integration.afterAllSetup(client);\n\n instrumentReactRouter(\n client,\n instrumentPageLoad,\n instrumentNavigation,\n history,\n 'reactrouter_v5',\n routes,\n matchPath,\n );\n },\n };\n}\n\nfunction instrumentReactRouter(\n client: Client,\n instrumentPageLoad: boolean,\n instrumentNavigation: boolean,\n history: RouterHistory,\n instrumentationName: string,\n allRoutes: RouteConfig[] = [],\n matchPath?: MatchPath,\n): void {\n function getInitPathName(): string | undefined {\n if (history.location) {\n return history.location.pathname;\n }\n\n if (WINDOW.location) {\n return WINDOW.location.pathname;\n }\n\n return undefined;\n }\n\n /**\n * Normalizes a transaction name. Returns the new name as well as the\n * source of the transaction.\n *\n * @param pathname The initial pathname we normalize\n */\n function normalizeTransactionName(pathname: string): [string, TransactionSource] {\n if (allRoutes.length === 0 || !matchPath) {\n return [pathname, 'url'];\n }\n\n const branches = matchRoutes(allRoutes, pathname, matchPath);\n for (const branch of branches) {\n if (branch.match.isExact) {\n return [branch.match.path, 'route'];\n }\n }\n\n return [pathname, 'url'];\n }\n\n if (instrumentPageLoad) {\n const initPathName = getInitPathName();\n if (initPathName) {\n const [name, source] = normalizeTransactionName(initPathName);\n startBrowserTracingPageLoadSpan(client, {\n name,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.pageload.react.${instrumentationName}`,\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,\n },\n });\n }\n }\n\n if (instrumentNavigation && history.listen) {\n history.listen((location, action) => {\n if (action && (action === 'PUSH' || action === 'POP')) {\n const [name, source] = normalizeTransactionName(location.pathname);\n startBrowserTracingNavigationSpan(client, {\n name,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.navigation.react.${instrumentationName}`,\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,\n },\n });\n }\n });\n }\n}\n\n/**\n * Matches a set of routes to a pathname\n * Based on implementation from\n */\nfunction matchRoutes(\n routes: RouteConfig[],\n pathname: string,\n matchPath: MatchPath,\n branch: Array<{ route: RouteConfig; match: Match }> = [],\n): Array<{ route: RouteConfig; match: Match }> {\n routes.some(route => {\n const match = route.path\n ? matchPath(pathname, route)\n : branch.length\n ? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n branch[branch.length - 1]!.match // use parent match\n : computeRootMatch(pathname); // use default \"root\" match\n\n if (match) {\n branch.push({ route, match });\n\n if (route.routes) {\n matchRoutes(route.routes, pathname, matchPath, branch);\n }\n }\n\n return !!match;\n });\n\n return branch;\n}\n\nfunction computeRootMatch(pathname: string): Match {\n return { path: '/', url: '/', params: {}, isExact: pathname === '/' };\n}\n\n/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */\nexport function withSentryRouting<P extends Record<string, any>, R extends React.ComponentType<P>>(Route: R): R {\n const componentDisplayName = Route.displayName || Route.name;\n\n const WrappedRoute: React.FC<P> = (props: P) => {\n if (props?.computedMatch?.isExact) {\n const route = props.computedMatch.path;\n const activeRootSpan = getActiveRootSpan();\n\n getCurrentScope().setTransactionName(route);\n\n if (activeRootSpan) {\n activeRootSpan.updateName(route);\n activeRootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route');\n }\n }\n\n // @ts-expect-error Setting more specific React Component typing for `R` generic above\n // will break advanced type inference done by react router params:\n // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/13dc4235c069e25fe7ee16e11f529d909f9f3ff8/types/react-router/index.d.ts#L154-L164\n return <Route {...props} />;\n };\n\n WrappedRoute.displayName = `sentryRoute(${componentDisplayName})`;\n hoistNonReactStatics(WrappedRoute, Route);\n // @ts-expect-error Setting more specific React Component typing for `R` generic above\n // will break advanced type inference done by react router params:\n // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/13dc4235c069e25fe7ee16e11f529d909f9f3ff8/types/react-router/index.d.ts#L154-L164\n return WrappedRoute;\n}\n/* eslint-enable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */\n\nfunction getActiveRootSpan(): Span | undefined {\n const span = getActiveSpan();\n const rootSpan = span && getRootSpan(span);\n\n if (!rootSpan) {\n return undefined;\n }\n\n const op = spanToJSON(rootSpan).op;\n\n // Only use this root span if it is a pageload or navigation span\n return op === 'navigation' || op === 'pageload' ? rootSpan : undefined;\n}\n"],"names":["browserTracingIntegration","WINDOW","startBrowserTracingPageLoadSpan","SEMANTIC_ATTRIBUTE_SENTRY_OP","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","startBrowserTracingNavigationSpan","getCurrentScope","hoistNonReactStatics","getActiveSpan","getRootSpan","spanToJSON"],"mappings":";;;;;;;AAqBA;AACA;;AAwBA;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,SAAS,EAAE,kBAAA,GAAqB,IAAI,EAAE,oBAAA,GAAuB,IAAA,EAAK,GAAI,OAAO;;AAExG,EAAE,OAAO;AACT,IAAI,GAAG,WAAW;AAClB,IAAI,aAAa,CAAC,MAAM,EAAE;AAC1B,MAAM,WAAW,CAAC,aAAa,CAAC,MAAM,CAAC;;AAEvC,MAAM,qBAAqB;AAC3B,QAAQ,MAAM;AACd,QAAQ,kBAAkB;AAC1B,QAAQ,oBAAoB;AAC5B,QAAQ,OAAO;AACf,QAAQ,gBAAgB;AACxB,QAAQ,MAAM;AACd,QAAQ,SAAS;AACjB,OAAO;AACP,KAAK;AACL,GAAG;AACH;;AAEA;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,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AA,IAAA;AACA,MAAA,MAAA,cAAA,GAAA,iBAAA,EAAA;;AAEA,MAAAE,oBAAA,EAAA,CAAA,kBAAA,CAAA,KAAA,CAAA;;AAEA,MAAA,IAAA,cAAA,EAAA;AACA,QAAA,cAAA,CAAA,UAAA,CAAA,KAAA,CAAA;AACA,QAAA,cAAA,CAAA,YAAA,CAAAF,qCAAA,EAAA,OAAA,CAAA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAA,OAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,GAAA,KAAA,EAAA,EAAA;AACA,GAAA;;AAEA,EAAA,YAAA,CAAA,WAAA,GAAA,CAAA,YAAA,EAAA,oBAAA,CAAA,CAAA,CAAA;AACA,EAAAG,yCAAA,CAAA,YAAA,EAAA,KAAA,CAAA;AACA;AACA;AACA;AACA,EAAA,OAAA,YAAA;AACA;AACA;;AAEA,SAAA,iBAAA,GAAA;AACA,EAAA,MAAA,IAAA,GAAAC,kBAAA,EAAA;AACA,EAAA,MAAA,QAAA,GAAA,IAAA,IAAAC,gBAAA,CAAA,IAAA,CAAA;;AAEA,EAAA,IAAA,CAAA,QAAA,EAAA;AACA,IAAA,OAAA,SAAA;AACA;;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":"reactrouter.js","sources":["../../src/reactrouter.tsx"],"sourcesContent":["import {\n browserTracingIntegration,\n startBrowserTracingNavigationSpan,\n startBrowserTracingPageLoadSpan,\n WINDOW,\n} from '@sentry/browser';\nimport type { Client, Integration, Span, TransactionSource } from '@sentry/core';\nimport {\n getActiveSpan,\n getCurrentScope,\n getRootSpan,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n spanToJSON,\n} from '@sentry/core';\nimport type { ReactElement } from 'react';\nimport * as React from 'react';\nimport { hoistNonReactStatics } from './hoist-non-react-statics';\nimport type { Action, Location } from './types';\n\n// We need to disable eslint no-explicit-any because any is required for the\n// react-router typings.\ntype Match = { path: string; url: string; params: Record<string, any>; isExact: boolean }; // eslint-disable-line @typescript-eslint/no-explicit-any\n\nexport type RouterHistory = {\n location?: Location;\n listen?(cb: (location: Location, action: Action) => void): void;\n} & Record<string, any>; // eslint-disable-line @typescript-eslint/no-explicit-any\n\nexport type RouteConfig = {\n [propName: string]: unknown;\n path?: string | string[];\n exact?: boolean;\n component?: ReactElement;\n routes?: RouteConfig[];\n};\n\nexport type MatchPath = (pathname: string, props: string | string[] | any, parent?: Match | null) => Match | null; // eslint-disable-line @typescript-eslint/no-explicit-any\n\ninterface ReactRouterOptions {\n history: RouterHistory;\n routes?: RouteConfig[];\n matchPath?: MatchPath;\n}\n\n/**\n * A browser tracing integration that uses React Router v4 to instrument navigations.\n * Expects `history` (and optionally `routes` and `matchPath`) to be passed as options.\n */\nexport function reactRouterV4BrowserTracingIntegration(\n options: Parameters<typeof browserTracingIntegration>[0] & ReactRouterOptions,\n): Integration {\n const integration = browserTracingIntegration({\n ...options,\n instrumentPageLoad: false,\n instrumentNavigation: false,\n });\n\n const { history, routes, matchPath, instrumentPageLoad = true, instrumentNavigation = true } = options;\n\n return {\n ...integration,\n afterAllSetup(client) {\n integration.afterAllSetup(client);\n\n instrumentReactRouter(\n client,\n instrumentPageLoad,\n instrumentNavigation,\n history,\n 'reactrouter_v4',\n routes,\n matchPath,\n );\n },\n };\n}\n\n/**\n * A browser tracing integration that uses React Router v5 to instrument navigations.\n * Expects `history` (and optionally `routes` and `matchPath`) to be passed as options.\n */\nexport function reactRouterV5BrowserTracingIntegration(\n options: Parameters<typeof browserTracingIntegration>[0] & ReactRouterOptions,\n): Integration {\n const integration = browserTracingIntegration({\n ...options,\n instrumentPageLoad: false,\n instrumentNavigation: false,\n });\n\n const { history, routes, matchPath, instrumentPageLoad = true, instrumentNavigation = true } = options;\n\n return {\n ...integration,\n afterAllSetup(client) {\n integration.afterAllSetup(client);\n\n instrumentReactRouter(\n client,\n instrumentPageLoad,\n instrumentNavigation,\n history,\n 'reactrouter_v5',\n routes,\n matchPath,\n );\n },\n };\n}\n\nfunction instrumentReactRouter(\n client: Client,\n instrumentPageLoad: boolean,\n instrumentNavigation: boolean,\n history: RouterHistory,\n instrumentationName: string,\n allRoutes: RouteConfig[] = [],\n matchPath?: MatchPath,\n): void {\n function getInitPathName(): string | undefined {\n if (history.location) {\n return history.location.pathname;\n }\n\n if (WINDOW.location) {\n return WINDOW.location.pathname;\n }\n\n return undefined;\n }\n\n /**\n * Normalizes a transaction name. Returns the new name as well as the\n * source of the transaction.\n *\n * @param pathname The initial pathname we normalize\n */\n function normalizeTransactionName(pathname: string): [string, TransactionSource] {\n if (allRoutes.length === 0 || !matchPath) {\n return [pathname, 'url'];\n }\n\n const branches = matchRoutes(allRoutes, pathname, matchPath);\n for (const branch of branches) {\n if (branch.match.isExact) {\n return [branch.match.path, 'route'];\n }\n }\n\n return [pathname, 'url'];\n }\n\n if (instrumentPageLoad) {\n const initPathName = getInitPathName();\n if (initPathName) {\n const [name, source] = normalizeTransactionName(initPathName);\n startBrowserTracingPageLoadSpan(client, {\n name,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.pageload.react.${instrumentationName}`,\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,\n },\n });\n }\n }\n\n if (instrumentNavigation && history.listen) {\n history.listen((location, action) => {\n if (action && (action === 'PUSH' || action === 'POP')) {\n const [name, source] = normalizeTransactionName(location.pathname);\n startBrowserTracingNavigationSpan(client, {\n name,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.navigation.react.${instrumentationName}`,\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,\n },\n });\n }\n });\n }\n}\n\n/**\n * Matches a set of routes to a pathname\n * Based on implementation from\n */\nfunction matchRoutes(\n routes: RouteConfig[],\n pathname: string,\n matchPath: MatchPath,\n branch: Array<{ route: RouteConfig; match: Match }> = [],\n): Array<{ route: RouteConfig; match: Match }> {\n routes.some(route => {\n const match = route.path\n ? matchPath(pathname, route)\n : branch.length\n ? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n branch[branch.length - 1]!.match // use parent match\n : computeRootMatch(pathname); // use default \"root\" match\n\n if (match) {\n branch.push({ route, match });\n\n if (route.routes) {\n matchRoutes(route.routes, pathname, matchPath, branch);\n }\n }\n\n return !!match;\n });\n\n return branch;\n}\n\nfunction computeRootMatch(pathname: string): Match {\n return { path: '/', url: '/', params: {}, isExact: pathname === '/' };\n}\n\n/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */\nexport function withSentryRouting<P extends Record<string, any>, R extends React.ComponentType<P>>(Route: R): R {\n const componentDisplayName = Route.displayName || Route.name;\n\n const WrappedRoute: React.FC<P> = (props: P) => {\n if (props?.computedMatch?.isExact) {\n const route = props.computedMatch.path;\n const activeRootSpan = getActiveRootSpan();\n\n getCurrentScope().setTransactionName(route);\n\n if (activeRootSpan) {\n activeRootSpan.updateName(route);\n activeRootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route');\n }\n }\n\n // @ts-expect-error Setting more specific React Component typing for `R` generic above\n // will break advanced type inference done by react router params:\n // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/13dc4235c069e25fe7ee16e11f529d909f9f3ff8/types/react-router/index.d.ts#L154-L164\n return <Route {...props} />;\n };\n\n WrappedRoute.displayName = `sentryRoute(${componentDisplayName})`;\n hoistNonReactStatics(WrappedRoute, Route);\n // @ts-expect-error Setting more specific React Component typing for `R` generic above\n // will break advanced type inference done by react router params:\n // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/13dc4235c069e25fe7ee16e11f529d909f9f3ff8/types/react-router/index.d.ts#L154-L164\n return WrappedRoute;\n}\n/* eslint-enable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */\n\nfunction getActiveRootSpan(): Span | undefined {\n const span = getActiveSpan();\n const rootSpan = span && getRootSpan(span);\n\n if (!rootSpan) {\n return undefined;\n }\n\n const op = spanToJSON(rootSpan).op;\n\n // Only use this root span if it is a pageload or navigation span\n return op === 'navigation' || op === 'pageload' ? rootSpan : undefined;\n}\n"],"names":["browserTracingIntegration","WINDOW","startBrowserTracingPageLoadSpan","SEMANTIC_ATTRIBUTE_SENTRY_OP","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","startBrowserTracingNavigationSpan","getCurrentScope","hoistNonReactStatics","getActiveSpan","getRootSpan","spanToJSON"],"mappings":";;;;;;;AAqBA;AACA;;AAwBA;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,SAAS,EAAE,kBAAA,GAAqB,IAAI,EAAE,oBAAA,GAAuB,IAAA,EAAK,GAAI,OAAO;;AAExG,EAAE,OAAO;AACT,IAAI,GAAG,WAAW;AAClB,IAAI,aAAa,CAAC,MAAM,EAAE;AAC1B,MAAM,WAAW,CAAC,aAAa,CAAC,MAAM,CAAC;;AAEvC,MAAM,qBAAqB;AAC3B,QAAQ,MAAM;AACd,QAAQ,kBAAkB;AAC1B,QAAQ,oBAAoB;AAC5B,QAAQ,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