diff --git a/.oxfmtrc.json b/.oxfmtrc.json new file mode 100644 index 0000000000..1a7ad551a7 --- /dev/null +++ b/.oxfmtrc.json @@ -0,0 +1,30 @@ +{ + "$schema": "./packages/core/node_modules/oxfmt/configuration_schema.json", + "arrowParens": "avoid", + "printWidth": 120, + "proseWrap": "always", + "singleQuote": true, + "trailingComma": "all", + "sortImports": { + "groups": [ + "type-import", + ["value-builtin", "value-external"], + ["type-internal", "value-internal"], + ["type-parent", "type-sibling", "type-index"], + ["value-parent", "value-sibling", "value-index"], + "unknown" + ] + }, + "ignorePatterns": [ + "test/react-native/versions/**", + ".github/workflows/*.yml" + ], + "overrides": [ + { + "files": ["*.md"], + "options": { + "proseWrap": "preserve" + } + } + ] +} diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 1134fe43d7..0000000000 --- a/.prettierignore +++ /dev/null @@ -1,3 +0,0 @@ -/test/react-native/versions -.github/workflows/*.yml -*.md diff --git a/.prettierrc.json b/.prettierrc.json deleted file mode 100644 index ba9a3dc2c2..0000000000 --- a/.prettierrc.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "arrowParens": "avoid", - "printWidth": 120, - "proseWrap": "always", - "singleQuote": true, - "trailingComma": "all" -} diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 7472dc6e34..21307826e6 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,5 +1,5 @@ { // See http://go.microsoft.com/fwlink/?LinkId=827846 // for the documentation about the extensions.json format - "recommendations": ["esbenp.prettier-vscode", "nickelpack.oxlint"] + "recommendations": ["nickelpack.oxlint"] } diff --git a/package.json b/package.json index 2d52890e98..9b7ee00d0c 100644 --- a/package.json +++ b/package.json @@ -34,9 +34,9 @@ "google-java-format": "^1.4.0", "lerna": "^8.1.8", "npm-run-all2": "^6.2.2", + "oxfmt": "^0.42.0", "oxlint": "^1.56.0", "pmd-bin": "^2.5.0", - "prettier": "^2.0.5", "react-native-version": "^4.0.0", "replace-in-file": "^7.0.1" }, diff --git a/packages/core/package.json b/packages/core/package.json index 4bf646ef65..964ddd4a38 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -37,12 +37,12 @@ "test:tools": "npx jest --config jest.config.tools.js", "test:watch": "npx jest --watch", "yalc:add:sentry-javascript": "yalc add @sentry/browser @sentry/core @sentry/react @sentry/types", - "fix": "npx run-s fix:oxlint fix:prettier", + "fix": "npx run-s fix:oxlint fix:fmt", "fix:oxlint": "oxlint --type-aware --tsconfig tsconfig.lint.json --fix", - "fix:prettier": "prettier --config ../../.prettierrc.json --ignore-path ../../.prettierignore --write \"{src,test,scripts,plugin/src}/**/**.ts\"", - "lint": "npx run-s lint:oxlint lint:prettier", + "fix:fmt": "oxfmt \"{src,test,scripts,plugin/src}/**/**.ts\" \"{src,test}/**/**.tsx\"", + "lint": "npx run-s lint:oxlint lint:fmt", "lint:oxlint": "sh -c 'OUT=$(oxlint --type-aware --tsconfig tsconfig.lint.json --deny-warnings 2>&1); echo \"$OUT\"; echo \"$OUT\" | grep -qE \"Found 0 warnings and [01] error\"'", - "lint:prettier": "prettier --config ../../.prettierrc.json --ignore-path ../../.prettierignore --check \"{src,test,scripts,plugin/src}/**/**.ts\"" + "lint:fmt": "oxfmt --check \"{src,test,scripts,plugin/src}/**/**.ts\" \"{src,test}/**/**.tsx\"" }, "bin": { "sentry-eas-build-on-complete": "scripts/eas-build-hook.js", @@ -105,9 +105,9 @@ "jest-extended": "^4.0.2", "madge": "^6.1.0", "metro": "0.83.1", + "oxfmt": "^0.42.0", "oxlint": "^1.56.0", "oxlint-tsgolint": "^0.17.4", - "prettier": "^2.0.5", "react": "19.1.0", "react-native": "0.80.1", "react-test-renderer": "19.1.0", diff --git a/packages/core/plugin/src/utils.ts b/packages/core/plugin/src/utils.ts index 6f89f2112d..3a5673a839 100644 --- a/packages/core/plugin/src/utils.ts +++ b/packages/core/plugin/src/utils.ts @@ -1,6 +1,7 @@ /* oxlint-disable typescript-eslint(no-unsafe-member-access) */ import * as fs from 'fs'; import * as path from 'path'; + import { warnOnce } from './logger'; export function writeSentryPropertiesTo(filepath: string, sentryProperties: string): void { diff --git a/packages/core/plugin/src/withSentry.ts b/packages/core/plugin/src/withSentry.ts index 16a0427c5e..f9531ca97f 100644 --- a/packages/core/plugin/src/withSentry.ts +++ b/packages/core/plugin/src/withSentry.ts @@ -1,11 +1,14 @@ import type { ExpoConfig } from '@expo/config-types'; import type { ConfigPlugin } from 'expo/config-plugins'; + import { createRunOncePlugin, withDangerousMod } from 'expo/config-plugins'; + +import type { SentryAndroidGradlePluginOptions } from './withSentryAndroidGradlePlugin'; + import { bold, warnOnce } from './logger'; import { writeSentryOptions } from './utils'; import { PLUGIN_NAME, PLUGIN_VERSION } from './version'; import { withSentryAndroid } from './withSentryAndroid'; -import type { SentryAndroidGradlePluginOptions } from './withSentryAndroidGradlePlugin'; import { withSentryAndroidGradlePlugin } from './withSentryAndroidGradlePlugin'; import { withSentryIOS } from './withSentryIOS'; diff --git a/packages/core/plugin/src/withSentryAndroid.ts b/packages/core/plugin/src/withSentryAndroid.ts index 398020ff7e..a9276d4c3c 100644 --- a/packages/core/plugin/src/withSentryAndroid.ts +++ b/packages/core/plugin/src/withSentryAndroid.ts @@ -1,7 +1,9 @@ import type { ExpoConfig } from '@expo/config-types'; import type { ConfigPlugin } from 'expo/config-plugins'; + import { withAppBuildGradle, withDangerousMod, withMainApplication } from 'expo/config-plugins'; import * as path from 'path'; + import { warnOnce } from './logger'; import { writeSentryPropertiesTo } from './utils'; diff --git a/packages/core/plugin/src/withSentryAndroidGradlePlugin.ts b/packages/core/plugin/src/withSentryAndroidGradlePlugin.ts index eca4625bb6..7dfa65f399 100644 --- a/packages/core/plugin/src/withSentryAndroidGradlePlugin.ts +++ b/packages/core/plugin/src/withSentryAndroidGradlePlugin.ts @@ -1,5 +1,7 @@ -import { withAppBuildGradle, withProjectBuildGradle } from '@expo/config-plugins'; import type { ExpoConfig } from '@expo/config-types'; + +import { withAppBuildGradle, withProjectBuildGradle } from '@expo/config-plugins'; + import { warnOnce } from './logger'; export interface SentryAndroidGradlePluginOptions { diff --git a/packages/core/plugin/src/withSentryIOS.ts b/packages/core/plugin/src/withSentryIOS.ts index 2a75fbd055..3cd6a2aa60 100644 --- a/packages/core/plugin/src/withSentryIOS.ts +++ b/packages/core/plugin/src/withSentryIOS.ts @@ -1,8 +1,10 @@ /* oxlint-disable typescript-eslint(no-unsafe-member-access) */ import type { ExpoConfig } from '@expo/config-types'; import type { ConfigPlugin, XcodeProject } from 'expo/config-plugins'; + import { withAppDelegate, withDangerousMod, withXcodeProject } from 'expo/config-plugins'; import * as path from 'path'; + import { warnOnce } from './logger'; import { writeSentryPropertiesTo } from './utils'; diff --git a/packages/core/src/js/NativeLogListener.ts b/packages/core/src/js/NativeLogListener.ts index efdac0dab4..fe5dee2506 100644 --- a/packages/core/src/js/NativeLogListener.ts +++ b/packages/core/src/js/NativeLogListener.ts @@ -1,6 +1,8 @@ import { debug } from '@sentry/core'; import { NativeEventEmitter, NativeModules, Platform } from 'react-native'; + import type { NativeLogEntry } from './options'; + import { isExpoGo } from './utils/environment'; const NATIVE_LOG_EVENT_NAME = 'SentryNativeLog'; diff --git a/packages/core/src/js/NativeRNSentry.ts b/packages/core/src/js/NativeRNSentry.ts index ee753e71f0..8084f3f22e 100644 --- a/packages/core/src/js/NativeRNSentry.ts +++ b/packages/core/src/js/NativeRNSentry.ts @@ -1,6 +1,8 @@ import type { Package } from '@sentry/core'; import type { TurboModule } from 'react-native'; + import { TurboModuleRegistry } from 'react-native'; + import type { UnsafeObject } from './utils/rnlibrariesinterface'; // There has to be only one interface and it has to be named `Spec` diff --git a/packages/core/src/js/RNSentryReplayMaskNativeComponent.ts b/packages/core/src/js/RNSentryReplayMaskNativeComponent.ts index 853b90748a..801d967110 100644 --- a/packages/core/src/js/RNSentryReplayMaskNativeComponent.ts +++ b/packages/core/src/js/RNSentryReplayMaskNativeComponent.ts @@ -1,4 +1,5 @@ import type { HostComponent, ViewProps } from 'react-native'; + // The default export exists in the file but the linter doesn't see it import { codegenNativeComponent } from 'react-native'; diff --git a/packages/core/src/js/RNSentryReplayUnmaskNativeComponent.ts b/packages/core/src/js/RNSentryReplayUnmaskNativeComponent.ts index e4d6d05b4b..0b84c97cf6 100644 --- a/packages/core/src/js/RNSentryReplayUnmaskNativeComponent.ts +++ b/packages/core/src/js/RNSentryReplayUnmaskNativeComponent.ts @@ -1,4 +1,5 @@ import type { HostComponent, ViewProps } from 'react-native'; + // The default export exists in the file but the linter doesn't see it import { codegenNativeComponent } from 'react-native'; diff --git a/packages/core/src/js/breadcrumb.ts b/packages/core/src/js/breadcrumb.ts index 65a87c6050..f8afd74ae3 100644 --- a/packages/core/src/js/breadcrumb.ts +++ b/packages/core/src/js/breadcrumb.ts @@ -1,4 +1,5 @@ import type { Breadcrumb, SeverityLevel } from '@sentry/core'; + import { severityLevelFromString } from '@sentry/core'; export const DEFAULT_BREADCRUMB_LEVEL: SeverityLevel = 'info'; diff --git a/packages/core/src/js/client.ts b/packages/core/src/js/client.ts index a946de8dc0..066f441fee 100644 --- a/packages/core/src/js/client.ts +++ b/packages/core/src/js/client.ts @@ -1,4 +1,3 @@ -import { eventFromException, eventFromMessage } from '@sentry/browser'; import type { ClientReportEnvelope, ClientReportItem, @@ -10,6 +9,8 @@ import type { TransportMakeRequestResponse, UserFeedback, } from '@sentry/core'; + +import { eventFromException, eventFromMessage } from '@sentry/browser'; import { _INTERNAL_flushLogsBuffer, addAutoIpAddressToSession, @@ -19,12 +20,14 @@ import { SentryError, } from '@sentry/core'; import { Alert } from 'react-native'; + +import type { ReactNativeClientOptions } from './options'; +import type { mobileReplayIntegration } from './replay/mobilereplay'; + import { getDevServer } from './integrations/debugsymbolicatorutils'; import { defaultSdkInfo } from './integrations/sdkinfo'; import { getDefaultSidecarUrl } from './integrations/spotlight'; import { defaultNativeLogHandler, setupNativeLogListener } from './NativeLogListener'; -import type { ReactNativeClientOptions } from './options'; -import type { mobileReplayIntegration } from './replay/mobilereplay'; import { MOBILE_REPLAY_INTEGRATION_NAME } from './replay/mobilereplay'; import { createUserFeedbackEnvelope, items } from './utils/envelope'; import { ignoreRequireCycleLogs } from './utils/ignorerequirecyclelogs'; diff --git a/packages/core/src/js/feedback/FeedbackButton.tsx b/packages/core/src/js/feedback/FeedbackButton.tsx index 66ab86b07f..e62edc7bdf 100644 --- a/packages/core/src/js/feedback/FeedbackButton.tsx +++ b/packages/core/src/js/feedback/FeedbackButton.tsx @@ -1,10 +1,17 @@ +import type { NativeEventSubscription } from 'react-native'; + import * as React from 'react'; -import type { NativeEventSubscription} from 'react-native'; import { Appearance, Image, Text, TouchableOpacity } from 'react-native'; + +import type { + FeedbackButtonProps, + FeedbackButtonStyles, + FeedbackButtonTextConfiguration, +} from './FeedbackWidget.types'; + import { defaultButtonConfiguration } from './defaults'; import { defaultButtonStyles } from './FeedbackWidget.styles'; import { getTheme } from './FeedbackWidget.theme'; -import type { FeedbackButtonProps, FeedbackButtonStyles, FeedbackButtonTextConfiguration } from './FeedbackWidget.types'; import { showFeedbackWidget } from './FeedbackWidgetManager'; import { feedbackIcon } from './icons'; import { lazyLoadFeedbackIntegration } from './lazy'; diff --git a/packages/core/src/js/feedback/FeedbackWidget.styles.ts b/packages/core/src/js/feedback/FeedbackWidget.styles.ts index 8620d8c9b3..94df799d21 100644 --- a/packages/core/src/js/feedback/FeedbackWidget.styles.ts +++ b/packages/core/src/js/feedback/FeedbackWidget.styles.ts @@ -1,4 +1,5 @@ import type { ViewStyle } from 'react-native'; + import type { FeedbackWidgetTheme } from './FeedbackWidget.theme'; import type { FeedbackButtonStyles, FeedbackWidgetStyles } from './FeedbackWidget.types'; diff --git a/packages/core/src/js/feedback/FeedbackWidget.theme.ts b/packages/core/src/js/feedback/FeedbackWidget.theme.ts index 602b6bdea3..aa8711a934 100644 --- a/packages/core/src/js/feedback/FeedbackWidget.theme.ts +++ b/packages/core/src/js/feedback/FeedbackWidget.theme.ts @@ -1,4 +1,5 @@ import { Appearance } from 'react-native'; + import { getColorScheme, getFeedbackDarkTheme, getFeedbackLightTheme } from './integration'; /** diff --git a/packages/core/src/js/feedback/FeedbackWidget.tsx b/packages/core/src/js/feedback/FeedbackWidget.tsx index b9909ed4b7..02853653c4 100644 --- a/packages/core/src/js/feedback/FeedbackWidget.tsx +++ b/packages/core/src/js/feedback/FeedbackWidget.tsx @@ -1,9 +1,9 @@ /* oxlint-disable eslint(max-lines) */ import type { SendFeedbackParams, User } from '@sentry/core'; +import type { KeyboardTypeOptions, NativeEventSubscription } from 'react-native'; + import { captureFeedback, debug, getCurrentScope, getGlobalScope, getIsolationScope, lastEventId } from '@sentry/core'; import * as React from 'react'; -import type { KeyboardTypeOptions , - NativeEventSubscription} from 'react-native'; import { Appearance, Image, @@ -12,20 +12,29 @@ import { TextInput, TouchableOpacity, TouchableWithoutFeedback, - View + View, } from 'react-native'; -import { isExpoGo, isWeb, notWeb } from '../utils/environment'; + import type { Screenshot } from '../wrapper'; +import type { + FeedbackGeneralConfiguration, + FeedbackTextConfiguration, + FeedbackWidgetProps, + FeedbackWidgetState, + FeedbackWidgetStyles, + ImagePickerConfiguration, +} from './FeedbackWidget.types'; + +import { isExpoGo, isWeb, notWeb } from '../utils/environment'; import { getDataFromUri, NATIVE } from '../wrapper'; import { sentryLogo } from './branding'; import { defaultConfiguration } from './defaults'; import defaultStyles from './FeedbackWidget.styles'; import { getTheme } from './FeedbackWidget.theme'; -import type { FeedbackGeneralConfiguration, FeedbackTextConfiguration, FeedbackWidgetProps, FeedbackWidgetState, FeedbackWidgetStyles, ImagePickerConfiguration } from './FeedbackWidget.types'; import { hideFeedbackButton, showScreenshotButton } from './FeedbackWidgetManager'; import { lazyLoadFeedbackIntegration } from './lazy'; import { getCapturedScreenshot } from './ScreenshotButton'; -import { base64ToUint8Array, feedbackAlertDialog, isValidEmail } from './utils'; +import { base64ToUint8Array, feedbackAlertDialog, isValidEmail } from './utils'; /** * @beta @@ -54,8 +63,8 @@ export class FeedbackWidget extends React.Component imagePicker.launchImageLibraryAsync?.({ mediaTypes: ['images'], base64: isWeb() }) : // react-native-image-picker library is available - imagePicker.launchImageLibrary - ? () => imagePicker.launchImageLibrary?.({ mediaType: 'photo', includeBase64: isWeb() }) - : null; + imagePicker.launchImageLibrary + ? () => imagePicker.launchImageLibrary?.({ mediaType: 'photo', includeBase64: isWeb() }) + : null; if (!launchImageLibrary) { debug.warn('No compatible image picker library found. Please provide a valid image picker library.'); if (__DEV__) { @@ -190,7 +199,7 @@ export class FeedbackWidget extends React.Component { + .then(data => { if (data != null) { this.setState({ filename, attachment: data, attachmentUri: imageUri }); } else { @@ -198,7 +207,7 @@ export class FeedbackWidget extends React.Component { + .catch(error => { this._showImageRetrievalDevelopmentNote(); debug.error('Failed to read image data from uri:', imageUri, 'error: ', error); }); @@ -208,17 +217,19 @@ export class FeedbackWidget extends React.Component { - getDataFromUri(uri).then((data) => { - if (data != null) { - this.setState({ filename: 'feedback_screenshot', attachment: data, attachmentUri: uri }); - } else { + getDataFromUri(uri) + .then(data => { + if (data != null) { + this.setState({ filename: 'feedback_screenshot', attachment: data, attachmentUri: uri }); + } else { + this._showImageRetrievalDevelopmentNote(); + debug.error('Failed to read image data from uri:', uri); + } + }) + .catch(error => { this._showImageRetrievalDevelopmentNote(); - debug.error('Failed to read image data from uri:', uri); - } - }).catch((error) => { - this._showImageRetrievalDevelopmentNote(); - debug.error('Failed to read image data from uri:', uri, 'error: ', error); - }); + debug.error('Failed to read image data from uri:', uri, 'error: ', error); + }); }); } } else { @@ -266,7 +277,10 @@ export class FeedbackWidget extends React.Component).reduce( (merged, key) => { - (merged as Record)[key] = { ...(_defaultStyles[key] as object), ...(_propStyles[key] as object) }; + (merged as Record)[key] = { + ...(_defaultStyles[key] as object), + ...(_propStyles[key] as object), + }; return merged; }, {}, @@ -373,12 +387,17 @@ export class FeedbackWidget extends React.Component )} {notWeb() && config.enableTakeScreenshot && !this.state.attachmentUri && ( - { - hideFeedbackButton(); - onCancel(); - showScreenshotButton(); - }}> - {text.captureScreenshotButtonLabel} + { + hideFeedbackButton(); + onCancel(); + showScreenshotButton(); + }} + > + + {text.captureScreenshotButtonLabel} + )} @@ -431,8 +450,10 @@ export class FeedbackWidget extends React.Component { - return this.state.filename !== undefined && this.state.attachment !== undefined && this.state.attachmentUri !== undefined; - } + return ( + this.state.filename !== undefined && this.state.attachment !== undefined && this.state.attachmentUri !== undefined + ); + }; private _getUser = (): User | undefined => { const currentUser = getCurrentScope().getUser(); @@ -444,7 +465,7 @@ export class FeedbackWidget extends React.Component { if (isExpoGo()) { @@ -453,5 +474,5 @@ export class FeedbackWidget extends React.Component { } }; -export { showFeedbackButton, hideFeedbackButton, showFeedbackWidget, enableFeedbackOnShake, disableFeedbackOnShake, showScreenshotButton, hideScreenshotButton, resetFeedbackButtonManager, resetFeedbackWidgetManager, resetScreenshotButtonManager }; +export { + showFeedbackButton, + hideFeedbackButton, + showFeedbackWidget, + enableFeedbackOnShake, + disableFeedbackOnShake, + showScreenshotButton, + hideScreenshotButton, + resetFeedbackButtonManager, + resetFeedbackWidgetManager, + resetScreenshotButtonManager, +}; diff --git a/packages/core/src/js/feedback/FeedbackWidgetProvider.tsx b/packages/core/src/js/feedback/FeedbackWidgetProvider.tsx index ad183c8ef2..0b83d7ef9a 100644 --- a/packages/core/src/js/feedback/FeedbackWidgetProvider.tsx +++ b/packages/core/src/js/feedback/FeedbackWidgetProvider.tsx @@ -1,12 +1,27 @@ import { debug } from '@sentry/core'; import * as React from 'react'; -import { Animated, Appearance, Dimensions, Easing, Modal, type NativeEventSubscription, type NativeScrollEvent,type NativeSyntheticEvent, PanResponder, Platform, ScrollView, View } from 'react-native'; +import { + Animated, + Appearance, + Dimensions, + Easing, + Modal, + type NativeEventSubscription, + type NativeScrollEvent, + type NativeSyntheticEvent, + PanResponder, + Platform, + ScrollView, + View, +} from 'react-native'; + +import type { FeedbackWidgetStyles } from './FeedbackWidget.types'; + import { notWeb } from '../utils/environment'; import { FeedbackButton } from './FeedbackButton'; import { FeedbackWidget } from './FeedbackWidget'; -import { modalSheetContainer,modalWrapper, topSpacer } from './FeedbackWidget.styles'; +import { modalSheetContainer, modalWrapper, topSpacer } from './FeedbackWidget.styles'; import { getTheme } from './FeedbackWidget.theme'; -import type { FeedbackWidgetStyles } from './FeedbackWidget.types'; import { BACKGROUND_ANIMATION_DURATION, FeedbackButtonManager, @@ -16,7 +31,12 @@ import { showFeedbackWidget, SLIDE_ANIMATION_DURATION, } from './FeedbackWidgetManager'; -import { getFeedbackButtonOptions, getFeedbackOptions, getScreenshotButtonOptions, isShakeToReportEnabled } from './integration'; +import { + getFeedbackButtonOptions, + getFeedbackOptions, + getScreenshotButtonOptions, + isShakeToReportEnabled, +} from './integration'; import { ScreenshotButton } from './ScreenshotButton'; import { startShakeListener, stopShakeListener } from './ShakeToReportBug'; import { isModalSupported, isNativeDriverSupportedForColorAnimations } from './utils'; diff --git a/packages/core/src/js/feedback/ScreenshotButton.tsx b/packages/core/src/js/feedback/ScreenshotButton.tsx index 7f5bffd334..c0b9e936bc 100644 --- a/packages/core/src/js/feedback/ScreenshotButton.tsx +++ b/packages/core/src/js/feedback/ScreenshotButton.tsx @@ -1,12 +1,19 @@ +import type { NativeEventSubscription } from 'react-native'; + import * as React from 'react'; -import type { NativeEventSubscription} from 'react-native'; import { Appearance, Image, Text, TouchableOpacity } from 'react-native'; + import type { Screenshot } from '../wrapper'; +import type { + ScreenshotButtonProps, + ScreenshotButtonStyles, + ScreenshotButtonTextConfiguration, +} from './FeedbackWidget.types'; + import { NATIVE } from '../wrapper'; import { defaultScreenshotButtonConfiguration } from './defaults'; import { defaultScreenshotButtonStyles } from './FeedbackWidget.styles'; import { getTheme } from './FeedbackWidget.theme'; -import type { ScreenshotButtonProps, ScreenshotButtonStyles, ScreenshotButtonTextConfiguration } from './FeedbackWidget.types'; import { hideScreenshotButton, showFeedbackWidget } from './FeedbackWidgetManager'; import { screenshotIcon } from './icons'; import { lazyLoadFeedbackIntegration } from './lazy'; @@ -15,7 +22,8 @@ let capturedScreenshot: Screenshot | 'ErrorCapturingScreenshot' | undefined; const takeScreenshot = async (): Promise => { hideScreenshotButton(); - setTimeout(async () => { // Delay capture to allow the button to hide + setTimeout(async () => { + // Delay capture to allow the button to hide const screenshots: Screenshot[] | null = await NATIVE.captureScreenshot(); if (screenshots && screenshots.length > 0) { capturedScreenshot = screenshots[0]; @@ -30,7 +38,7 @@ export const getCapturedScreenshot = (): Screenshot | 'ErrorCapturingScreenshot' const screenshot = capturedScreenshot; capturedScreenshot = undefined; return screenshot; -} +}; /** * @beta @@ -80,8 +88,10 @@ export class ScreenshotButton extends React.Component { onPress={takeScreenshot} accessibilityLabel={text.triggerAriaLabel} > - - {text.triggerLabel} + + + {text.triggerLabel} + ); } diff --git a/packages/core/src/js/feedback/ShakeToReportBug.ts b/packages/core/src/js/feedback/ShakeToReportBug.ts index d58fba9da0..d57a31ca5b 100644 --- a/packages/core/src/js/feedback/ShakeToReportBug.ts +++ b/packages/core/src/js/feedback/ShakeToReportBug.ts @@ -1,6 +1,8 @@ -import { debug } from '@sentry/core'; import type { EmitterSubscription, NativeModule } from 'react-native'; + +import { debug } from '@sentry/core'; import { NativeEventEmitter } from 'react-native'; + import { isWeb } from '../utils/environment'; import { getRNSentryModule } from '../wrapper'; diff --git a/packages/core/src/js/feedback/defaults.ts b/packages/core/src/js/feedback/defaults.ts index 59f2092f9f..b1b9ea6140 100644 --- a/packages/core/src/js/feedback/defaults.ts +++ b/packages/core/src/js/feedback/defaults.ts @@ -1,4 +1,5 @@ import type { FeedbackButtonProps, FeedbackWidgetProps, ScreenshotButtonProps } from './FeedbackWidget.types'; + import { feedbackAlertDialog } from './utils'; const FORM_TITLE = 'Report a Bug'; diff --git a/packages/core/src/js/feedback/integration.ts b/packages/core/src/js/feedback/integration.ts index ace02554e2..f8ee931962 100644 --- a/packages/core/src/js/feedback/integration.ts +++ b/packages/core/src/js/feedback/integration.ts @@ -1,4 +1,5 @@ import { getClient, type Integration } from '@sentry/core'; + import type { FeedbackWidgetTheme } from './FeedbackWidget.theme'; import type { FeedbackButtonProps, FeedbackWidgetProps, ScreenshotButtonProps } from './FeedbackWidget.types'; diff --git a/packages/core/src/js/feedback/lazy.ts b/packages/core/src/js/feedback/lazy.ts index 6bfad02f56..c3d2b2727d 100644 --- a/packages/core/src/js/feedback/lazy.ts +++ b/packages/core/src/js/feedback/lazy.ts @@ -1,4 +1,5 @@ import { getClient } from '@sentry/core'; + import { feedbackIntegration, MOBILE_FEEDBACK_INTEGRATION_NAME } from './integration'; /** diff --git a/packages/core/src/js/feedback/utils.ts b/packages/core/src/js/feedback/utils.ts index 9073b220bc..ecda66b489 100644 --- a/packages/core/src/js/feedback/utils.ts +++ b/packages/core/src/js/feedback/utils.ts @@ -1,4 +1,5 @@ import { Alert } from 'react-native'; + import { isFabricEnabled, isWeb } from '../utils/environment'; import { RN_GLOBAL_OBJ } from '../utils/worldwide'; import { ReactNativeLibraries } from './../utils/rnlibraries'; diff --git a/packages/core/src/js/integrations/appRegistry.ts b/packages/core/src/js/integrations/appRegistry.ts index 73041354c0..9083ed81a3 100644 --- a/packages/core/src/js/integrations/appRegistry.ts +++ b/packages/core/src/js/integrations/appRegistry.ts @@ -1,5 +1,7 @@ import type { Client, Integration } from '@sentry/core'; + import { debug, getClient } from '@sentry/core'; + import { isWeb } from '../utils/environment'; import { fillTyped } from '../utils/fill'; import { ReactNativeLibraries } from '../utils/rnlibraries'; diff --git a/packages/core/src/js/integrations/breadcrumbs.ts b/packages/core/src/js/integrations/breadcrumbs.ts index da3b57eceb..5f6d742755 100644 --- a/packages/core/src/js/integrations/breadcrumbs.ts +++ b/packages/core/src/js/integrations/breadcrumbs.ts @@ -1,5 +1,7 @@ -import { breadcrumbsIntegration as browserBreadcrumbsIntegration } from '@sentry/browser'; import type { Integration } from '@sentry/core'; + +import { breadcrumbsIntegration as browserBreadcrumbsIntegration } from '@sentry/browser'; + import { isWeb } from '../utils/environment'; interface BreadcrumbsOptions { @@ -63,8 +65,8 @@ export const breadcrumbsIntegration = (options: Partial = {} sentry: true, ...options, fetch: options.fetch ?? (isWeb() ? true : false), - dom: isWeb() ? options.dom ?? true : false, - history: isWeb() ? options.history ?? true : false, + dom: isWeb() ? (options.dom ?? true) : false, + history: isWeb() ? (options.history ?? true) : false, }; // Historically we had very little issue using the browser breadcrumbs integration diff --git a/packages/core/src/js/integrations/debugsymbolicator.ts b/packages/core/src/js/integrations/debugsymbolicator.ts index d4ff5efb40..bb0a8492ab 100644 --- a/packages/core/src/js/integrations/debugsymbolicator.ts +++ b/packages/core/src/js/integrations/debugsymbolicator.ts @@ -1,8 +1,11 @@ import type { Event, EventHint, Exception, Integration, StackFrame as SentryStackFrame } from '@sentry/core'; + import { debug } from '@sentry/core'; + import type { ExtendedError } from '../utils/error'; -import { getFramesToPop, isErrorLike } from '../utils/error'; import type * as ReactNative from '../vendor/react-native'; + +import { getFramesToPop, isErrorLike } from '../utils/error'; import { fetchSourceContext, parseErrorStack, symbolicateStackTrace } from './debugsymbolicatorutils'; const INTEGRATION_NAME = 'DebugSymbolicator'; diff --git a/packages/core/src/js/integrations/debugsymbolicatorutils.ts b/packages/core/src/js/integrations/debugsymbolicatorutils.ts index 18c595efca..1cec29136b 100644 --- a/packages/core/src/js/integrations/debugsymbolicatorutils.ts +++ b/packages/core/src/js/integrations/debugsymbolicatorutils.ts @@ -1,8 +1,11 @@ import type { StackFrame as SentryStackFrame } from '@sentry/core'; + import { debug } from '@sentry/core'; + +import type * as ReactNative from '../vendor/react-native'; + import { ReactNativeLibraries } from '../utils/rnlibraries'; import { createStealthXhr, XHR_READYSTATE_DONE } from '../utils/xhr'; -import type * as ReactNative from '../vendor/react-native'; /** * Fetches source context for the Sentry Middleware (/__sentry/context) diff --git a/packages/core/src/js/integrations/default.ts b/packages/core/src/js/integrations/default.ts index 9074bbe203..1f93da6496 100644 --- a/packages/core/src/js/integrations/default.ts +++ b/packages/core/src/js/integrations/default.ts @@ -1,7 +1,10 @@ +import type { Integration } from '@sentry/core'; + /* oxlint-disable eslint(complexity) */ import { browserSessionIntegration, consoleLoggingIntegration } from '@sentry/browser'; -import type { Integration } from '@sentry/core'; + import type { ReactNativeClientOptions } from '../options'; + import { reactNativeTracingIntegration } from '../tracing'; import { notWeb } from '../utils/environment'; import { diff --git a/packages/core/src/js/integrations/devicecontext.ts b/packages/core/src/js/integrations/devicecontext.ts index 7ee1caaf0f..65ce33eae6 100644 --- a/packages/core/src/js/integrations/devicecontext.ts +++ b/packages/core/src/js/integrations/devicecontext.ts @@ -1,9 +1,12 @@ /* oxlint-disable eslint(complexity) */ import type { Client, Event, EventHint, Integration } from '@sentry/core'; + import { debug, severityLevelFromString } from '@sentry/core'; import { AppState } from 'react-native'; -import { breadcrumbFromObject } from '../breadcrumb'; + import type { NativeDeviceContextsResponse } from '../NativeRNSentry'; + +import { breadcrumbFromObject } from '../breadcrumb'; import { NATIVE } from '../wrapper'; const INTEGRATION_NAME = 'DeviceContext'; diff --git a/packages/core/src/js/integrations/expoconstants.ts b/packages/core/src/js/integrations/expoconstants.ts index ee8518e643..3670c6a58a 100644 --- a/packages/core/src/js/integrations/expoconstants.ts +++ b/packages/core/src/js/integrations/expoconstants.ts @@ -1,6 +1,8 @@ import type { Event, Integration } from '@sentry/core'; -import { isExpo } from '../utils/environment'; + import type { ExpoConstants } from '../utils/expoglobalobject'; + +import { isExpo } from '../utils/environment'; import { getExpoConstants } from '../utils/expomodules'; const INTEGRATION_NAME = 'ExpoConstants'; diff --git a/packages/core/src/js/integrations/expocontext.ts b/packages/core/src/js/integrations/expocontext.ts index ae234d909d..340cc2d1d5 100644 --- a/packages/core/src/js/integrations/expocontext.ts +++ b/packages/core/src/js/integrations/expocontext.ts @@ -1,5 +1,7 @@ import { debug, type DeviceContext, type Event, type Integration, type OsContext } from '@sentry/core'; + import type { ReactNativeClient } from '../client'; + import { isExpo, isExpoGo } from '../utils/environment'; import { getExpoDevice, getExpoUpdates } from '../utils/expomodules'; import { NATIVE } from '../wrapper'; diff --git a/packages/core/src/js/integrations/expoupdateslistener.ts b/packages/core/src/js/integrations/expoupdateslistener.ts index 3b8d3a2d76..aaf6488199 100644 --- a/packages/core/src/js/integrations/expoupdateslistener.ts +++ b/packages/core/src/js/integrations/expoupdateslistener.ts @@ -1,5 +1,7 @@ import { addBreadcrumb, debug, type Integration, type SeverityLevel } from '@sentry/core'; + import type { ReactNativeClient } from '../client'; + import { isExpo, isExpoGo } from '../utils/environment'; const INTEGRATION_NAME = 'ExpoUpdatesListener'; diff --git a/packages/core/src/js/integrations/graphql.ts b/packages/core/src/js/integrations/graphql.ts index 78d178c2e3..f8523096aa 100644 --- a/packages/core/src/js/integrations/graphql.ts +++ b/packages/core/src/js/integrations/graphql.ts @@ -1,6 +1,7 @@ -import { graphqlClientIntegration as browserGraphqlClientIntegration } from '@sentry/browser'; import type { Integration } from '@sentry/core'; +import { graphqlClientIntegration as browserGraphqlClientIntegration } from '@sentry/browser'; + interface GraphQLReactNativeIntegrationOptions { endpoints: Array; } diff --git a/packages/core/src/js/integrations/logEnricherIntegration.ts b/packages/core/src/js/integrations/logEnricherIntegration.ts index 038d094c95..5381dc6e21 100644 --- a/packages/core/src/js/integrations/logEnricherIntegration.ts +++ b/packages/core/src/js/integrations/logEnricherIntegration.ts @@ -1,6 +1,9 @@ import type { Integration, Log } from '@sentry/core'; + import { debug, getCurrentScope, getGlobalScope, getIsolationScope } from '@sentry/core'; + import type { ReactNativeClient } from '../client'; + import { NATIVE } from '../wrapper'; const INTEGRATION_NAME = 'LogEnricher'; diff --git a/packages/core/src/js/integrations/modulesloader.ts b/packages/core/src/js/integrations/modulesloader.ts index d08ec6ebc9..244211b08f 100644 --- a/packages/core/src/js/integrations/modulesloader.ts +++ b/packages/core/src/js/integrations/modulesloader.ts @@ -1,5 +1,7 @@ import type { Event, Integration } from '@sentry/core'; + import { debug } from '@sentry/core'; + import { NATIVE } from '../wrapper'; const INTEGRATION_NAME = 'ModulesLoader'; diff --git a/packages/core/src/js/integrations/nativelinkederrors.ts b/packages/core/src/js/integrations/nativelinkederrors.ts index 48db860ab0..54a5d38848 100644 --- a/packages/core/src/js/integrations/nativelinkederrors.ts +++ b/packages/core/src/js/integrations/nativelinkederrors.ts @@ -1,4 +1,3 @@ -import { exceptionFromError } from '@sentry/browser'; import type { Client, DebugImage, @@ -10,8 +9,12 @@ import type { StackFrame, StackParser, } from '@sentry/core'; + +import { exceptionFromError } from '@sentry/browser'; import { isInstanceOf, isPlainObject, isString } from '@sentry/core'; + import type { NativeStackFrames } from '../NativeRNSentry'; + import { NATIVE } from '../wrapper'; const INTEGRATION_NAME = 'NativeLinkedErrors'; diff --git a/packages/core/src/js/integrations/primitiveTagIntegration.ts b/packages/core/src/js/integrations/primitiveTagIntegration.ts index 7a26d461de..f1da15dbd4 100644 --- a/packages/core/src/js/integrations/primitiveTagIntegration.ts +++ b/packages/core/src/js/integrations/primitiveTagIntegration.ts @@ -1,4 +1,5 @@ import type { Integration, Primitive } from '@sentry/core'; + import { PrimitiveToString } from '../utils/primitiveConverter'; import { NATIVE } from '../wrapper'; diff --git a/packages/core/src/js/integrations/reactnativeerrorhandlers.ts b/packages/core/src/js/integrations/reactnativeerrorhandlers.ts index cae9ab1a1b..ea12cd205a 100644 --- a/packages/core/src/js/integrations/reactnativeerrorhandlers.ts +++ b/packages/core/src/js/integrations/reactnativeerrorhandlers.ts @@ -1,4 +1,5 @@ import type { EventHint, Integration, SeverityLevel } from '@sentry/core'; + import { addExceptionMechanism, addGlobalUnhandledRejectionInstrumentationHandler, @@ -7,7 +8,9 @@ import { getClient, getCurrentScope, } from '@sentry/core'; + import type { ReactNativeClientOptions } from '../options'; + import { isHermesEnabled, isWeb } from '../utils/environment'; import { createSyntheticError, isErrorLike } from '../utils/error'; import { RN_GLOBAL_OBJ } from '../utils/worldwide'; diff --git a/packages/core/src/js/integrations/reactnativeerrorhandlersutils.ts b/packages/core/src/js/integrations/reactnativeerrorhandlersutils.ts index c57ca06fb3..e286f1fa1e 100644 --- a/packages/core/src/js/integrations/reactnativeerrorhandlersutils.ts +++ b/packages/core/src/js/integrations/reactnativeerrorhandlersutils.ts @@ -1,4 +1,5 @@ import { debug } from '@sentry/core'; + import { ReactNativeLibraries } from '../utils/rnlibraries'; import { RN_GLOBAL_OBJ } from '../utils/worldwide'; diff --git a/packages/core/src/js/integrations/reactnativeinfo.ts b/packages/core/src/js/integrations/reactnativeinfo.ts index f45139f232..edbc0f4d7e 100644 --- a/packages/core/src/js/integrations/reactnativeinfo.ts +++ b/packages/core/src/js/integrations/reactnativeinfo.ts @@ -1,4 +1,7 @@ import type { Context, Event, EventHint, Integration } from '@sentry/core'; + +import type { ReactNativeError } from './debugsymbolicator'; + import { getExpoGoVersion, getExpoSdkVersion, @@ -9,7 +12,6 @@ import { isHermesEnabled, isTurboModuleEnabled, } from '../utils/environment'; -import type { ReactNativeError } from './debugsymbolicator'; const INTEGRATION_NAME = 'ReactNativeInfo'; diff --git a/packages/core/src/js/integrations/release.ts b/packages/core/src/js/integrations/release.ts index 3682bb42b3..f414f8a9ac 100644 --- a/packages/core/src/js/integrations/release.ts +++ b/packages/core/src/js/integrations/release.ts @@ -1,4 +1,5 @@ import type { BaseTransportOptions, Client, ClientOptions, Event, EventHint, Integration } from '@sentry/core'; + import { NATIVE } from '../wrapper'; const INTEGRATION_NAME = 'Release'; diff --git a/packages/core/src/js/integrations/rewriteframes.ts b/packages/core/src/js/integrations/rewriteframes.ts index 81c28a3bf9..22bdb475ce 100644 --- a/packages/core/src/js/integrations/rewriteframes.ts +++ b/packages/core/src/js/integrations/rewriteframes.ts @@ -1,6 +1,8 @@ import type { Integration, StackFrame } from '@sentry/core'; + import { rewriteFramesIntegration } from '@sentry/core'; import { Platform } from 'react-native'; + import { isExpo, isHermesEnabled } from '../utils/environment'; export const ANDROID_DEFAULT_BUNDLE_NAME = 'app:///index.android.bundle'; diff --git a/packages/core/src/js/integrations/screenshot.ts b/packages/core/src/js/integrations/screenshot.ts index 3c45ada451..d4777260dd 100644 --- a/packages/core/src/js/integrations/screenshot.ts +++ b/packages/core/src/js/integrations/screenshot.ts @@ -1,6 +1,8 @@ import type { Event, EventHint, Integration } from '@sentry/core'; + import type { ReactNativeClient } from '../client'; import type { Screenshot as ScreenshotAttachment } from '../wrapper'; + import { NATIVE } from '../wrapper'; const INTEGRATION_NAME = 'Screenshot'; diff --git a/packages/core/src/js/integrations/sdkinfo.ts b/packages/core/src/js/integrations/sdkinfo.ts index f8d54a136c..76d6edf1ca 100644 --- a/packages/core/src/js/integrations/sdkinfo.ts +++ b/packages/core/src/js/integrations/sdkinfo.ts @@ -1,5 +1,7 @@ import type { Event, Integration, Package, SdkInfo as SdkInfoType } from '@sentry/core'; + import { debug } from '@sentry/core'; + import { isExpoGo, notWeb } from '../utils/environment'; import { SDK_NAME, SDK_PACKAGE_NAME, SDK_VERSION } from '../version'; import { NATIVE } from '../wrapper'; diff --git a/packages/core/src/js/integrations/spotlight.ts b/packages/core/src/js/integrations/spotlight.ts index 01f35bb819..789fc65882 100644 --- a/packages/core/src/js/integrations/spotlight.ts +++ b/packages/core/src/js/integrations/spotlight.ts @@ -1,5 +1,7 @@ import type { BaseTransportOptions, Client, ClientOptions, Envelope, Integration } from '@sentry/core'; + import { debug, serializeEnvelope } from '@sentry/core'; + import { ReactNativeLibraries } from '../utils/rnlibraries'; import { createStealthXhr, XHR_READYSTATE_DONE } from '../utils/xhr'; diff --git a/packages/core/src/js/integrations/supabase.ts b/packages/core/src/js/integrations/supabase.ts index d4263f44f9..a9b3a5efc2 100644 --- a/packages/core/src/js/integrations/supabase.ts +++ b/packages/core/src/js/integrations/supabase.ts @@ -1,6 +1,7 @@ -import { supabaseIntegration as browserSupabaseIntegration } from '@sentry/browser'; import type { Integration } from '@sentry/core'; +import { supabaseIntegration as browserSupabaseIntegration } from '@sentry/browser'; + type SupabaseReactNativeIntegrationOptions = { supabaseClient: unknown; }; diff --git a/packages/core/src/js/integrations/viewhierarchy.ts b/packages/core/src/js/integrations/viewhierarchy.ts index f05e76705f..05c06ccdfe 100644 --- a/packages/core/src/js/integrations/viewhierarchy.ts +++ b/packages/core/src/js/integrations/viewhierarchy.ts @@ -1,5 +1,7 @@ import type { Attachment, Event, EventHint, Integration } from '@sentry/core'; + import { debug } from '@sentry/core'; + import { NATIVE } from '../wrapper'; const filename: string = 'view-hierarchy.json'; diff --git a/packages/core/src/js/options.ts b/packages/core/src/js/options.ts index c4b10f1c48..61df5a3242 100644 --- a/packages/core/src/js/options.ts +++ b/packages/core/src/js/options.ts @@ -2,8 +2,11 @@ import type { makeFetchTransport } from '@sentry/browser'; import type { CaptureContext, ClientOptions, Event, EventHint, Options } from '@sentry/core'; import type { BrowserOptions, Profiler } from '@sentry/react'; import type * as React from 'react'; + import { Platform } from 'react-native'; + import type { TouchEventBoundaryProps } from './touchevents'; + import { isExpoGo } from './utils/environment'; type ProfilerProps = React.ComponentProps; @@ -459,12 +462,10 @@ export interface ReactNativeTransportOptions extends BrowserTransportOptions { */ export interface ReactNativeOptions - extends Omit, '_experiments'>, - BaseReactNativeOptions {} + extends Omit, '_experiments'>, BaseReactNativeOptions {} export interface ReactNativeClientOptions - extends Omit, 'tunnel' | '_experiments'>, - BaseReactNativeOptions {} + extends Omit, 'tunnel' | '_experiments'>, BaseReactNativeOptions {} export interface ReactNativeWrapperOptions { /** Props for the root React profiler */ diff --git a/packages/core/src/js/playground/examples.ts b/packages/core/src/js/playground/examples.ts index f82ddca83c..b06c4078c0 100644 --- a/packages/core/src/js/playground/examples.ts +++ b/packages/core/src/js/playground/examples.ts @@ -1,4 +1,5 @@ import { captureException } from '@sentry/core'; + import { NATIVE } from '../wrapper'; // This is a placeholder to match the example code with what Sentry SDK users would see. diff --git a/packages/core/src/js/playground/modal.tsx b/packages/core/src/js/playground/modal.tsx index 1cadf2141c..03d14c76f8 100644 --- a/packages/core/src/js/playground/modal.tsx +++ b/packages/core/src/js/playground/modal.tsx @@ -1,17 +1,8 @@ /* oxlint-disable eslint(max-lines) */ import { debug } from '@sentry/core'; import * as React from 'react'; -import { - Animated, - Image, - Modal, - Platform, - Pressable, - StyleSheet, - Text, - useColorScheme, - View, -} from 'react-native'; +import { Animated, Image, Modal, Platform, Pressable, StyleSheet, Text, useColorScheme, View } from 'react-native'; + import { getDevServer } from '../integrations/debugsymbolicatorutils'; import { isExpo, isExpoGo, isWeb } from '../utils/environment'; import { bug as bugAnimation, hi as hiAnimation, thumbsup as thumbsupAnimation } from './animations'; diff --git a/packages/core/src/js/profiling/convertHermesProfile.ts b/packages/core/src/js/profiling/convertHermesProfile.ts index 475a68e05e..704c4466ef 100644 --- a/packages/core/src/js/profiling/convertHermesProfile.ts +++ b/packages/core/src/js/profiling/convertHermesProfile.ts @@ -1,10 +1,13 @@ import type { FrameId, StackId, ThreadCpuFrame, ThreadCpuSample, ThreadCpuStack, ThreadId } from '@sentry/core'; + import { debug } from '@sentry/core'; -import { MAX_PROFILE_DURATION_MS } from './constants'; + import type * as Hermes from './hermes'; -import { DEFAULT_BUNDLE_NAME } from './hermes'; import type { RawThreadCpuProfile } from './types'; +import { MAX_PROFILE_DURATION_MS } from './constants'; +import { DEFAULT_BUNDLE_NAME } from './hermes'; + const PLACEHOLDER_THREAD_ID_STRING = '0'; const MS_TO_NS = 1e6; const MAX_PROFILE_DURATION_NS = MAX_PROFILE_DURATION_MS * MS_TO_NS; diff --git a/packages/core/src/js/profiling/debugid.ts b/packages/core/src/js/profiling/debugid.ts index b73459eaf2..023ecc5cc2 100644 --- a/packages/core/src/js/profiling/debugid.ts +++ b/packages/core/src/js/profiling/debugid.ts @@ -1,5 +1,7 @@ import type { DebugImage } from '@sentry/core'; + import { debug, GLOBAL_OBJ } from '@sentry/core'; + import { DEFAULT_BUNDLE_NAME } from './hermes'; /** diff --git a/packages/core/src/js/profiling/hermes.ts b/packages/core/src/js/profiling/hermes.ts index 5e7dc9d6c6..d2ed0fec90 100644 --- a/packages/core/src/js/profiling/hermes.ts +++ b/packages/core/src/js/profiling/hermes.ts @@ -1,4 +1,5 @@ import { Platform } from 'react-native'; + import { ANDROID_DEFAULT_BUNDLE_NAME, IOS_DEFAULT_BUNDLE_NAME } from '../integrations/rewriteframes'; export type StackFrameId = number; diff --git a/packages/core/src/js/profiling/integration.ts b/packages/core/src/js/profiling/integration.ts index 5b63d6f13c..b5b13b2acb 100644 --- a/packages/core/src/js/profiling/integration.ts +++ b/packages/core/src/js/profiling/integration.ts @@ -1,15 +1,18 @@ import type { Envelope, Event, Integration, Span, ThreadCpuProfile } from '@sentry/core'; + import { debug, getActiveSpan, getClient, spanIsSampled, uuid4 } from '@sentry/core'; import { Platform } from 'react-native'; + import type { ReactNativeClient } from '../client'; +import type { NativeAndroidProfileEvent, NativeProfileEvent } from './nativeTypes'; +import type { AndroidCombinedProfileEvent, CombinedProfileEvent, HermesProfileEvent, ProfileEvent } from './types'; + import { isHermesEnabled } from '../utils/environment'; import { isRootSpan } from '../utils/span'; import { NATIVE } from '../wrapper'; import { PROFILE_QUEUE } from './cache'; import { MAX_PROFILE_DURATION_MS } from './constants'; import { convertToSentryProfile } from './convertHermesProfile'; -import type { NativeAndroidProfileEvent, NativeProfileEvent } from './nativeTypes'; -import type { AndroidCombinedProfileEvent, CombinedProfileEvent, HermesProfileEvent, ProfileEvent } from './types'; import { addProfilesToEnvelope, createHermesProfilingEvent, diff --git a/packages/core/src/js/profiling/types.ts b/packages/core/src/js/profiling/types.ts index e483d4ccfc..871c975403 100644 --- a/packages/core/src/js/profiling/types.ts +++ b/packages/core/src/js/profiling/types.ts @@ -1,4 +1,5 @@ import type { DebugImage, MeasurementUnit, Profile, ThreadCpuFrame, ThreadCpuProfile } from '@sentry/core'; + import type { NativeProfileEvent } from './nativeTypes'; export interface RawThreadCpuProfile extends ThreadCpuProfile { diff --git a/packages/core/src/js/profiling/utils.ts b/packages/core/src/js/profiling/utils.ts index 6185dba8f5..37556fb80f 100644 --- a/packages/core/src/js/profiling/utils.ts +++ b/packages/core/src/js/profiling/utils.ts @@ -1,8 +1,8 @@ /* oxlint-disable eslint(complexity) */ import type { Envelope, Event, ThreadCpuProfile } from '@sentry/core'; + import { debug, forEachEnvelopeItem } from '@sentry/core'; -import { getDefaultEnvironment } from '../utils/environment'; -import { getDebugMetadata } from './debugid'; + import type { AndroidCombinedProfileEvent, AndroidProfileEvent, @@ -12,6 +12,9 @@ import type { RawThreadCpuProfile, } from './types'; +import { getDefaultEnvironment } from '../utils/environment'; +import { getDebugMetadata } from './debugid'; + /** * */ diff --git a/packages/core/src/js/replay/CustomMask.tsx b/packages/core/src/js/replay/CustomMask.tsx index 4c4cc6c790..1d86e6e11a 100644 --- a/packages/core/src/js/replay/CustomMask.tsx +++ b/packages/core/src/js/replay/CustomMask.tsx @@ -1,7 +1,9 @@ +import type { HostComponent, ViewProps } from 'react-native'; + import { debug } from '@sentry/core'; import * as React from 'react'; -import type { HostComponent, ViewProps } from 'react-native'; import { UIManager, View } from 'react-native'; + import { isExpoGo } from '../utils/environment'; const NativeComponentRegistry: { @@ -11,7 +13,8 @@ const NativeComponentRegistry: { const MaskNativeComponentName = 'RNSentryReplayMask'; const UnmaskNativeComponentName = 'RNSentryReplayUnmask'; -const warnMessage = (component: string): string => `[SentrySessionReplay] ${component} component is not supported on the current platform. If ${component} should be supported, please ensure that the application build is up to date.`; +const warnMessage = (component: string): string => + `[SentrySessionReplay] ${component} component is not supported on the current platform. If ${component} should be supported, please ensure that the application build is up to date.`; const warn = (component: string): void => { setTimeout(() => { @@ -32,7 +35,8 @@ const UnmaskFallback = (viewProps: ViewProps): React.ReactElement => { return ; }; -const hasViewManagerConfig = (nativeComponentName: string): boolean => UIManager.hasViewManagerConfig?.(nativeComponentName); +const hasViewManagerConfig = (nativeComponentName: string): boolean => + UIManager.hasViewManagerConfig?.(nativeComponentName); const Mask = ((): HostComponent | React.ComponentType => { if (isExpoGo() || !hasViewManagerConfig(MaskNativeComponentName)) { @@ -45,7 +49,7 @@ const Mask = ((): HostComponent | React.ComponentType => { return NativeComponentRegistry.get(MaskNativeComponentName, () => ({ uiViewClassName: MaskNativeComponentName, })); -})() +})(); const Unmask = ((): HostComponent | React.ComponentType => { if (isExpoGo() || !hasViewManagerConfig(UnmaskNativeComponentName)) { diff --git a/packages/core/src/js/replay/CustomMask.web.tsx b/packages/core/src/js/replay/CustomMask.web.tsx index 1d89dacc59..94fa52fac1 100644 --- a/packages/core/src/js/replay/CustomMask.web.tsx +++ b/packages/core/src/js/replay/CustomMask.web.tsx @@ -1,5 +1,6 @@ -import * as React from 'react'; import type { ViewProps } from 'react-native'; + +import * as React from 'react'; import { View } from 'react-native'; // Wrapping children in a View and div can cause styling issues @@ -16,9 +17,7 @@ import { View } from 'react-native'; const Mask = (props: ViewProps): React.ReactElement => { return ( -
- {props.children} -
+
{props.children}
); }; @@ -26,9 +25,7 @@ const Mask = (props: ViewProps): React.ReactElement => { const Unmask = (props: ViewProps): React.ReactElement => { return ( -
- {props.children} -
+
{props.children}
); }; diff --git a/packages/core/src/js/replay/browserReplay.ts b/packages/core/src/js/replay/browserReplay.ts index ea8a097e93..187b43ca27 100644 --- a/packages/core/src/js/replay/browserReplay.ts +++ b/packages/core/src/js/replay/browserReplay.ts @@ -1,7 +1,9 @@ import { replayIntegration } from '@sentry/react'; -import { notWeb } from '../utils/environment'; + import type { Replay } from './replayInterface'; +import { notWeb } from '../utils/environment'; + /** * ReplayConfiguration for browser replay integration. * diff --git a/packages/core/src/js/replay/mobilereplay.ts b/packages/core/src/js/replay/mobilereplay.ts index d487fe8a4f..f1804fbfb0 100644 --- a/packages/core/src/js/replay/mobilereplay.ts +++ b/packages/core/src/js/replay/mobilereplay.ts @@ -1,5 +1,7 @@ import type { Client, DynamicSamplingContext, ErrorEvent, Event, EventHint, Integration, Metric } from '@sentry/core'; + import { debug } from '@sentry/core'; + import { isHardCrash } from '../misc'; import { hasHooks } from '../utils/clientutils'; import { isExpoGo, notMobileOs } from '../utils/environment'; diff --git a/packages/core/src/js/replay/xhrUtils.ts b/packages/core/src/js/replay/xhrUtils.ts index deb0f3c88c..40daca2372 100644 --- a/packages/core/src/js/replay/xhrUtils.ts +++ b/packages/core/src/js/replay/xhrUtils.ts @@ -1,6 +1,9 @@ import type { Breadcrumb, BreadcrumbHint, SentryWrappedXMLHttpRequest, XhrBreadcrumbHint } from '@sentry/core'; + import { dropUndefinedKeys } from '@sentry/core'; + import type { RequestBody } from './networkUtils'; + import { getBodySize, parseContentLengthHeader } from './networkUtils'; /** diff --git a/packages/core/src/js/scopeSync.ts b/packages/core/src/js/scopeSync.ts index 2ff0177299..abfd1dc069 100644 --- a/packages/core/src/js/scopeSync.ts +++ b/packages/core/src/js/scopeSync.ts @@ -1,6 +1,8 @@ import type { Breadcrumb, Scope } from '@sentry/core'; + import { debug } from '@sentry/core'; import { logger } from '@sentry/react'; + import { DEFAULT_BREADCRUMB_LEVEL } from './breadcrumb'; import { fillTyped } from './utils/fill'; import { convertToNormalizedObject } from './utils/normalize'; diff --git a/packages/core/src/js/sdk.tsx b/packages/core/src/js/sdk.tsx index 9a18733117..1853294ca1 100644 --- a/packages/core/src/js/sdk.tsx +++ b/packages/core/src/js/sdk.tsx @@ -1,5 +1,6 @@ /* oxlint-disable eslint(complexity) */ import type { Breadcrumb, BreadcrumbHint, Integration, Scope } from '@sentry/core'; + import { debug, getClient, @@ -13,11 +14,13 @@ import { } from '@sentry/core'; import { defaultStackParser, makeFetchTransport, Profiler } from '@sentry/react'; import * as React from 'react'; + +import type { ReactNativeClientOptions, ReactNativeOptions, ReactNativeWrapperOptions } from './options'; + import { ReactNativeClient } from './client'; import { FeedbackWidgetProvider } from './feedback/FeedbackWidgetProvider'; import { getDevServer } from './integrations/debugsymbolicatorutils'; import { getDefaultIntegrations } from './integrations/default'; -import type { ReactNativeClientOptions, ReactNativeOptions, ReactNativeWrapperOptions } from './options'; import { shouldEnableNativeNagger } from './options'; import { enableSyncToNative } from './scopeSync'; import { TouchEventBoundary } from './touchevents'; @@ -62,13 +65,11 @@ export function init(passedOptions: ReactNativeOptions): void { ...passedOptions, }; - const maxQueueSize = userOptions.maxQueueSize - ?? userOptions.transportOptions?.bufferSize - ?? DEFAULT_OPTIONS.maxQueueSize; + const maxQueueSize = + userOptions.maxQueueSize ?? userOptions.transportOptions?.bufferSize ?? DEFAULT_OPTIONS.maxQueueSize; - const enableNative = userOptions.enableNative === undefined || userOptions.enableNative - ? NATIVE.isNativeAvailable() - : false; + const enableNative = + userOptions.enableNative === undefined || userOptions.enableNative ? NATIVE.isNativeAvailable() : false; useEncodePolyfill(); if (enableNative) { @@ -89,7 +90,9 @@ export function init(passedOptions: ReactNativeOptions): void { return `${dsnComponents.protocol}://${dsnComponents.host}${port}`; }; - const userBeforeBreadcrumb = safeFactory(userOptions.beforeBreadcrumb, { loggerMessage: 'The beforeBreadcrumb threw an error' }); + const userBeforeBreadcrumb = safeFactory(userOptions.beforeBreadcrumb, { + loggerMessage: 'The beforeBreadcrumb threw an error', + }); // Exclude Dev Server and Sentry Dsn request from Breadcrumbs const devServerUrl = getDevServer()?.url; @@ -122,11 +125,12 @@ export function init(passedOptions: ReactNativeOptions): void { enableNative, enableNativeNagger: shouldEnableNativeNagger(userOptions.enableNativeNagger), // If custom transport factory fails the SDK won't initialize - transport: userOptions.transport - || makeNativeTransportFactory({ + transport: + userOptions.transport || + makeNativeTransportFactory({ enableNative, - }) - || makeFetchTransport, + }) || + makeFetchTransport, transportOptions: { ...DEFAULT_OPTIONS.transportOptions, ...(userOptions.transportOptions ?? {}), @@ -145,7 +149,9 @@ export function init(passedOptions: ReactNativeOptions): void { // In dev builds, we always re-initialize from JS to set up the native log bridge // and provide runtime values (devServerUrl, defaultSidecarUrl, etc.). // oxlint-disable-next-line eslint(no-console) - console.info('[Sentry] Using options file. Native SDK is expected to be initialized before JS, skipping automatic native initialization from JS.'); + console.info( + '[Sentry] Using options file. Native SDK is expected to be initialized before JS, skipping automatic native initialization from JS.', + ); options.autoInitializeNativeSdk = false; } @@ -157,9 +163,8 @@ export function init(passedOptions: ReactNativeOptions): void { options.environment = getDefaultEnvironment(); } - const defaultIntegrations: false | Integration[] = userOptions.defaultIntegrations === undefined - ? getDefaultIntegrations(options) - : userOptions.defaultIntegrations; + const defaultIntegrations: false | Integration[] = + userOptions.defaultIntegrations === undefined ? getDefaultIntegrations(options) : userOptions.defaultIntegrations; options.integrations = getIntegrationsToSetup({ integrations: safeFactory(userOptions.integrations, { loggerMessage: 'The integrations threw an error' }), @@ -182,12 +187,12 @@ export function init(passedOptions: ReactNativeOptions): void { */ export function wrap

>( RootComponent: React.ComponentType

, - options?: ReactNativeWrapperOptions + options?: ReactNativeWrapperOptions, ): React.ComponentType

{ const profilerProps = { - ...(options?.profilerProps), + ...options?.profilerProps, name: RootComponent.displayName ?? 'Root', - updateProps: {} + updateProps: {}, }; const ProfilerComponent = isWeb() ? Profiler : ReactNativeProfiler; @@ -228,7 +233,7 @@ export async function flush(): Promise { return result; } - } catch (_) { } + } catch (_) {} debug.error('Failed to flush the event queue.'); diff --git a/packages/core/src/js/tools/collectModules.ts b/packages/core/src/js/tools/collectModules.ts index 07e05f5189..fbf6d1fd93 100755 --- a/packages/core/src/js/tools/collectModules.ts +++ b/packages/core/src/js/tools/collectModules.ts @@ -1,4 +1,5 @@ import { argv } from 'process'; + import ModulesCollector from './ModulesCollector'; const sourceMapPath: string | undefined = argv[2]; diff --git a/packages/core/src/js/tools/easBuildHooks.ts b/packages/core/src/js/tools/easBuildHooks.ts index 5de5681069..93d7fbb6d0 100644 --- a/packages/core/src/js/tools/easBuildHooks.ts +++ b/packages/core/src/js/tools/easBuildHooks.ts @@ -13,7 +13,9 @@ /* oxlint-disable eslint(no-console) */ import type { DsnComponents } from '@sentry/core'; + import { dsnToString, makeDsn, uuid4 } from '@sentry/core'; + import { SDK_VERSION } from '../version'; const SENTRY_DSN_ENV = 'SENTRY_DSN'; diff --git a/packages/core/src/js/tools/metroMiddleware.ts b/packages/core/src/js/tools/metroMiddleware.ts index 9e6de7cf08..d34c408541 100644 --- a/packages/core/src/js/tools/metroMiddleware.ts +++ b/packages/core/src/js/tools/metroMiddleware.ts @@ -1,8 +1,9 @@ import type { StackFrame } from '@sentry/core'; -import { addContextToFrame, debug } from '@sentry/core'; -import { readFile } from 'fs'; import type { IncomingMessage, ServerResponse } from 'http'; import type { InputConfigT, Middleware } from 'metro-config'; + +import { addContextToFrame, debug } from '@sentry/core'; +import { readFile } from 'fs'; import { promisify } from 'util'; const readFileAsync = promisify(readFile); diff --git a/packages/core/src/js/tools/metroconfig.ts b/packages/core/src/js/tools/metroconfig.ts index 2146a074c4..af84a8f3a9 100644 --- a/packages/core/src/js/tools/metroconfig.ts +++ b/packages/core/src/js/tools/metroconfig.ts @@ -1,8 +1,13 @@ -import { debug } from '@sentry/core'; import type { MetroConfig, MixedOutput, Module, ReadOnlyGraph } from 'metro'; import type { CustomResolutionContext, CustomResolver, Resolution } from 'metro-resolver'; + +import { debug } from '@sentry/core'; import * as process from 'process'; import { env } from 'process'; + +import type { MetroCustomSerializer } from './utils'; +import type { DefaultConfigOptions } from './vendor/expo/expoconfig'; + import { enableLogger } from './enableLogger'; import { withSentryMiddleware } from './metroMiddleware'; import { @@ -12,8 +17,6 @@ import { import { createSentryMetroSerializer, unstableBeforeAssetSerializationDebugIdPlugin } from './sentryMetroSerializer'; import { withSentryOptionsFromFile } from './sentryOptionsSerializer'; import { unstableReleaseConstantsPlugin } from './sentryReleaseInjector'; -import type { MetroCustomSerializer } from './utils'; -import type { DefaultConfigOptions } from './vendor/expo/expoconfig'; export * from './sentryMetroSerializer'; @@ -116,7 +119,7 @@ export function getSentryExpoConfig( ...options, unstable_beforeAssetSerializationPlugins: [ ...(options.unstable_beforeAssetSerializationPlugins || []), - ...(options.injectReleaseForWeb ?? true ? [unstableReleaseConstantsPlugin(projectRoot)] : []), + ...((options.injectReleaseForWeb ?? true) ? [unstableReleaseConstantsPlugin(projectRoot)] : []), unstableBeforeAssetSerializationDebugIdPlugin, ], }); diff --git a/packages/core/src/js/tools/sentryBabelTransformerUtils.ts b/packages/core/src/js/tools/sentryBabelTransformerUtils.ts index 1778fdb57e..e848e0c91b 100644 --- a/packages/core/src/js/tools/sentryBabelTransformerUtils.ts +++ b/packages/core/src/js/tools/sentryBabelTransformerUtils.ts @@ -1,6 +1,7 @@ import componentAnnotatePlugin from '@sentry/babel-plugin-component-annotate'; import { debug } from '@sentry/core'; import * as process from 'process'; + import type { BabelTransformer, BabelTransformerArgs } from './vendor/metro/metroBabelTransformer'; export type SentryBabelTransformerOptions = { annotateReactComponents?: { ignoredComponents?: string[] } }; diff --git a/packages/core/src/js/tools/sentryMetroSerializer.ts b/packages/core/src/js/tools/sentryMetroSerializer.ts index 483b1b1feb..e8bc7bf295 100644 --- a/packages/core/src/js/tools/sentryMetroSerializer.ts +++ b/packages/core/src/js/tools/sentryMetroSerializer.ts @@ -1,6 +1,9 @@ -import * as crypto from 'crypto'; import type { MixedOutput, Module, ReadOnlyGraph } from 'metro'; + +import * as crypto from 'crypto'; + import type { Bundle, MetroSerializer, MetroSerializerOutput, SerializedBundle, VirtualJSOutput } from './utils'; + import { createDebugIdSnippet, createVirtualJSModule, diff --git a/packages/core/src/js/tools/sentryOptionsSerializer.ts b/packages/core/src/js/tools/sentryOptionsSerializer.ts index 31809f8a60..f30b144394 100644 --- a/packages/core/src/js/tools/sentryOptionsSerializer.ts +++ b/packages/core/src/js/tools/sentryOptionsSerializer.ts @@ -1,8 +1,11 @@ +import type { MetroConfig, Module, ReadOnlyGraph, SerializerOptions } from 'metro'; + import { logger } from '@sentry/core'; import * as fs from 'fs'; -import type { MetroConfig, Module, ReadOnlyGraph, SerializerOptions } from 'metro'; import * as path from 'path'; + import type { MetroCustomSerializer, VirtualJSOutput } from './utils'; + import { createSet } from './utils'; import countLines from './vendor/metro/countLines'; diff --git a/packages/core/src/js/tools/sentryReleaseInjector.ts b/packages/core/src/js/tools/sentryReleaseInjector.ts index 31b76518e8..dca2400ab9 100644 --- a/packages/core/src/js/tools/sentryReleaseInjector.ts +++ b/packages/core/src/js/tools/sentryReleaseInjector.ts @@ -1,5 +1,7 @@ import type { MixedOutput, Module, ReadOnlyGraph } from 'metro'; + import type { VirtualJSOutput } from './utils'; + import { createVirtualJSModule, getExpoConfig, prependModule } from './utils'; const RELEASE_CONSTANTS_MODULE_PATH = '__sentryReleaseConstants__'; diff --git a/packages/core/src/js/tools/utils.ts b/packages/core/src/js/tools/utils.ts index 713070e842..fe41ccd10f 100644 --- a/packages/core/src/js/tools/utils.ts +++ b/packages/core/src/js/tools/utils.ts @@ -1,6 +1,8 @@ -import * as crypto from 'crypto'; import type { MetroConfig, MixedOutput, Module, ReadOnlyGraph, SerializerOptions } from 'metro'; import type CountingSet from 'metro/src/lib/CountingSet'; // types are in src but exports are in private + +import * as crypto from 'crypto'; + import countLines from './vendor/metro/countLines'; export type MetroCustomSerializer = Required['serializer']>['customSerializer'] | undefined; diff --git a/packages/core/src/js/tools/vendor/metro/utils.ts b/packages/core/src/js/tools/vendor/metro/utils.ts index 9a60603aaa..3dc4fcffe6 100644 --- a/packages/core/src/js/tools/vendor/metro/utils.ts +++ b/packages/core/src/js/tools/vendor/metro/utils.ts @@ -29,6 +29,7 @@ import type { MixedOutput, Module, ReadOnlyGraph } from 'metro'; import type * as baseJSBundleType from 'metro/private/DeltaBundler/Serializers/baseJSBundle'; import type * as sourceMapStringType from 'metro/private/DeltaBundler/Serializers/sourceMapString'; import type * as bundleToStringType from 'metro/private/lib/bundleToString'; + import type { MetroSerializer } from '../../utils'; // oxlint-disable-next-line typescript-eslint(no-explicit-any) @@ -42,7 +43,7 @@ try { const baseJSBundle: typeof baseJSBundleType = typeof baseJSBundleModule === 'function' ? baseJSBundleModule - : baseJSBundleModule?.baseJSBundle ?? baseJSBundleModule?.default; + : (baseJSBundleModule?.baseJSBundle ?? baseJSBundleModule?.default); let sourceMapString: typeof sourceMapStringType; try { @@ -68,7 +69,7 @@ try { const bundleToString: typeof bundleToStringType = typeof bundleToStringModule === 'function' ? bundleToStringModule - : bundleToStringModule?.bundleToString ?? bundleToStringModule?.default; + : (bundleToStringModule?.bundleToString ?? bundleToStringModule?.default); type NewSourceMapStringExport = { // Since Metro v0.80.10 https://github.com/facebook/metro/compare/v0.80.9...v0.80.10#diff-1b836d1729e527a725305eef0cec22e44605af2700fa413f4c2489ea1a03aebcL28 diff --git a/packages/core/src/js/touchevents.tsx b/packages/core/src/js/touchevents.tsx index 1c25aa9d5f..0689046914 100644 --- a/packages/core/src/js/touchevents.tsx +++ b/packages/core/src/js/touchevents.tsx @@ -1,8 +1,10 @@ import type { SeverityLevel, SpanAttributeValue } from '@sentry/core'; +import type { GestureResponderEvent } from 'react-native'; + import { addBreadcrumb, debug, dropUndefinedKeys, getClient, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import * as React from 'react'; -import type { GestureResponderEvent } from 'react-native'; import { StyleSheet, View } from 'react-native'; + import { createIntegration } from './integrations/factory'; import { startUserInteractionSpan } from './tracing/integrations/userInteraction'; import { UI_ACTION_TOUCH } from './tracing/ops'; @@ -262,7 +264,10 @@ class TouchEventBoundary extends React.Component { } } -function getTouchedComponentInfo(currentInst: ElementInstance, labelKey: string | undefined): TouchedComponentInfo | undefined { +function getTouchedComponentInfo( + currentInst: ElementInstance, + labelKey: string | undefined, +): TouchedComponentInfo | undefined { const displayName = currentInst.elementType?.displayName; const props = currentInst.memoizedProps; @@ -288,35 +293,44 @@ function getTouchedComponentInfo(currentInst: ElementInstance, labelKey: string } function getComponentName(props: Record): string | undefined { - return typeof props[SENTRY_COMPONENT_PROP_KEY] === 'string' && - props[SENTRY_COMPONENT_PROP_KEY].length > 0 && - props[SENTRY_COMPONENT_PROP_KEY] !== 'unknown' && - props[SENTRY_COMPONENT_PROP_KEY] || undefined; + return ( + (typeof props[SENTRY_COMPONENT_PROP_KEY] === 'string' && + props[SENTRY_COMPONENT_PROP_KEY].length > 0 && + props[SENTRY_COMPONENT_PROP_KEY] !== 'unknown' && + props[SENTRY_COMPONENT_PROP_KEY]) || + undefined + ); } function getElementName(props: Record): string | undefined { - return typeof props[SENTRY_ELEMENT_PROP_KEY] === 'string' && - props[SENTRY_ELEMENT_PROP_KEY].length > 0 && - props[SENTRY_ELEMENT_PROP_KEY] !== 'unknown' && - props[SENTRY_ELEMENT_PROP_KEY] || undefined; + return ( + (typeof props[SENTRY_ELEMENT_PROP_KEY] === 'string' && + props[SENTRY_ELEMENT_PROP_KEY].length > 0 && + props[SENTRY_ELEMENT_PROP_KEY] !== 'unknown' && + props[SENTRY_ELEMENT_PROP_KEY]) || + undefined + ); } function getFileName(props: Record): string | undefined { - return typeof props[SENTRY_FILE_PROP_KEY] === 'string' && - props[SENTRY_FILE_PROP_KEY].length > 0 && - props[SENTRY_FILE_PROP_KEY] !== 'unknown' && - props[SENTRY_FILE_PROP_KEY] || undefined; + return ( + (typeof props[SENTRY_FILE_PROP_KEY] === 'string' && + props[SENTRY_FILE_PROP_KEY].length > 0 && + props[SENTRY_FILE_PROP_KEY] !== 'unknown' && + props[SENTRY_FILE_PROP_KEY]) || + undefined + ); } function getLabelValue(props: Record, labelKey: string | undefined): string | undefined { return typeof props[SENTRY_LABEL_PROP_KEY] === 'string' && props[SENTRY_LABEL_PROP_KEY].length > 0 ? props[SENTRY_LABEL_PROP_KEY] - // For some reason type narrowing doesn't work as expected with indexing when checking it all in one go in - // the "check-label" if sentence, so we have to assign it to a variable here first - // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion - : typeof labelKey === 'string' && typeof props[labelKey] == 'string' && (props[labelKey] as string).length > 0 + : // For some reason type narrowing doesn't work as expected with indexing when checking it all in one go in + // the "check-label" if sentence, so we have to assign it to a variable here first // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion - ? (props[labelKey] as string) + typeof labelKey === 'string' && typeof props[labelKey] == 'string' && (props[labelKey] as string).length > 0 + ? // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion + (props[labelKey] as string) : undefined; } @@ -329,11 +343,7 @@ function getSpanAttributes(currentInst: ElementInstance): Record; } diff --git a/packages/core/src/js/tracing/expoImage.ts b/packages/core/src/js/tracing/expoImage.ts index b503774194..9b220a3cfe 100644 --- a/packages/core/src/js/tracing/expoImage.ts +++ b/packages/core/src/js/tracing/expoImage.ts @@ -1,4 +1,5 @@ import { SPAN_STATUS_ERROR, SPAN_STATUS_OK, startInactiveSpan } from '@sentry/core'; + import { SPAN_ORIGIN_AUTO_RESOURCE_EXPO_IMAGE } from './origin'; import { describeUrl, sanitizeUrl, traceAsyncOperation } from './utils'; diff --git a/packages/core/src/js/tracing/expoRouter.ts b/packages/core/src/js/tracing/expoRouter.ts index 9230a40936..8401ecdedb 100644 --- a/packages/core/src/js/tracing/expoRouter.ts +++ b/packages/core/src/js/tracing/expoRouter.ts @@ -1,4 +1,5 @@ import { SPAN_STATUS_ERROR, SPAN_STATUS_OK, startInactiveSpan } from '@sentry/core'; + import { SPAN_ORIGIN_AUTO_EXPO_ROUTER_PREFETCH } from './origin'; /** diff --git a/packages/core/src/js/tracing/gesturetracing.ts b/packages/core/src/js/tracing/gesturetracing.ts index 67be06d644..b5838f1cd2 100644 --- a/packages/core/src/js/tracing/gesturetracing.ts +++ b/packages/core/src/js/tracing/gesturetracing.ts @@ -1,5 +1,7 @@ import type { Breadcrumb } from '@sentry/core'; + import { addBreadcrumb, debug, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; + import { startUserInteractionSpan } from './integrations/userInteraction'; import { UI_ACTION } from './ops'; import { SPAN_ORIGIN_AUTO_INTERACTION } from './origin'; diff --git a/packages/core/src/js/tracing/integrations/appStart.ts b/packages/core/src/js/tracing/integrations/appStart.ts index 5a68db985d..6b728a04e4 100644 --- a/packages/core/src/js/tracing/integrations/appStart.ts +++ b/packages/core/src/js/tracing/integrations/appStart.ts @@ -1,5 +1,6 @@ /* oxlint-disable eslint(complexity), eslint(max-lines) */ import type { Client, Event, Integration, Span, SpanJSON, TransactionEvent } from '@sentry/core'; + import { debug, getCapturedScopesOnSpan, @@ -11,13 +12,15 @@ import { startInactiveSpan, timestampInSeconds, } from '@sentry/core'; + +import type { NativeAppStartResponse, NativeFramesResponse } from '../../NativeRNSentry'; +import type { ReactNativeClientOptions } from '../../options'; + import { getAppRegistryIntegration } from '../../integrations/appRegistry'; import { APP_START_COLD as APP_START_COLD_MEASUREMENT, APP_START_WARM as APP_START_WARM_MEASUREMENT, } from '../../measurements'; -import type { NativeAppStartResponse, NativeFramesResponse } from '../../NativeRNSentry'; -import type { ReactNativeClientOptions } from '../../options'; import { convertSpanToTransaction, isRootSpan, setEndTimeValue } from '../../utils/span'; import { NATIVE } from '../../wrapper'; import { diff --git a/packages/core/src/js/tracing/integrations/nativeFrames.ts b/packages/core/src/js/tracing/integrations/nativeFrames.ts index 781f7c361a..6f32171aef 100644 --- a/packages/core/src/js/tracing/integrations/nativeFrames.ts +++ b/packages/core/src/js/tracing/integrations/nativeFrames.ts @@ -1,6 +1,9 @@ import type { Client, Event, Integration, Measurements, MeasurementUnit, Span } from '@sentry/core'; + import { debug, getRootSpan, spanIsSampled, spanToJSON, timestampInSeconds } from '@sentry/core'; + import type { NativeFramesResponse } from '../../NativeRNSentry'; + import { AsyncExpiringMap } from '../../utils/AsyncExpiringMap'; import { isRootSpan } from '../../utils/span'; import { NATIVE } from '../../wrapper'; diff --git a/packages/core/src/js/tracing/integrations/stalltracking.ts b/packages/core/src/js/tracing/integrations/stalltracking.ts index f42665bc99..2453afd011 100644 --- a/packages/core/src/js/tracing/integrations/stalltracking.ts +++ b/packages/core/src/js/tracing/integrations/stalltracking.ts @@ -1,7 +1,9 @@ import type { Client, Integration, Measurements, MeasurementUnit, Span } from '@sentry/core'; -import { debug, getRootSpan, spanIsSampled, spanToJSON, timestampInSeconds } from '@sentry/core'; import type { AppStateStatus } from 'react-native'; + +import { debug, getRootSpan, spanIsSampled, spanToJSON, timestampInSeconds } from '@sentry/core'; import { AppState } from 'react-native'; + import { STALL_COUNT, STALL_LONGEST_TIME, STALL_TOTAL_TIME } from '../../measurements'; import { isRootSpan } from '../../utils/span'; import { getLatestChildSpanEndTimestamp, isNearToNow, setSpanMeasurement } from '../utils'; diff --git a/packages/core/src/js/tracing/integrations/timeToDisplayIntegration.ts b/packages/core/src/js/tracing/integrations/timeToDisplayIntegration.ts index 06e8bb0a79..b6214c1542 100644 --- a/packages/core/src/js/tracing/integrations/timeToDisplayIntegration.ts +++ b/packages/core/src/js/tracing/integrations/timeToDisplayIntegration.ts @@ -1,5 +1,7 @@ import type { Event, Integration, SpanJSON } from '@sentry/core'; + import { debug } from '@sentry/core'; + import { NATIVE } from '../../wrapper'; import { UI_LOAD_FULL_DISPLAY, UI_LOAD_INITIAL_DISPLAY } from '../ops'; import { SPAN_ORIGIN_AUTO_UI_TIME_TO_DISPLAY, SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY } from '../origin'; diff --git a/packages/core/src/js/tracing/integrations/userInteraction.ts b/packages/core/src/js/tracing/integrations/userInteraction.ts index 3be486735c..c1fbf3a48c 100644 --- a/packages/core/src/js/tracing/integrations/userInteraction.ts +++ b/packages/core/src/js/tracing/integrations/userInteraction.ts @@ -1,4 +1,5 @@ import type { Integration, Span, StartSpanOptions } from '@sentry/core'; + import { debug, getActiveSpan, @@ -7,7 +8,9 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON, } from '@sentry/core'; + import type { ReactNativeClientOptions } from '../../options'; + import { onlySampleIfChildSpans } from '../onSpanEndUtils'; import { SPAN_ORIGIN_MANUAL_INTERACTION } from '../origin'; import { getCurrentReactNativeTracingIntegration } from '../reactnativetracing'; diff --git a/packages/core/src/js/tracing/onSpanEndUtils.ts b/packages/core/src/js/tracing/onSpanEndUtils.ts index 55dca0b75d..9841fdde3e 100644 --- a/packages/core/src/js/tracing/onSpanEndUtils.ts +++ b/packages/core/src/js/tracing/onSpanEndUtils.ts @@ -1,7 +1,9 @@ import type { Client, Span } from '@sentry/core'; -import { debug, getSpanDescendants, SPAN_STATUS_ERROR, spanToJSON } from '@sentry/core'; import type { AppStateStatus } from 'react-native'; + +import { debug, getSpanDescendants, SPAN_STATUS_ERROR, spanToJSON } from '@sentry/core'; import { AppState, Platform } from 'react-native'; + import { isRootSpan, isSentrySpan } from '../utils/span'; /** diff --git a/packages/core/src/js/tracing/reactnativenavigation.ts b/packages/core/src/js/tracing/reactnativenavigation.ts index 840ed74e56..9db9dc00a5 100644 --- a/packages/core/src/js/tracing/reactnativenavigation.ts +++ b/packages/core/src/js/tracing/reactnativenavigation.ts @@ -1,4 +1,5 @@ import type { Client, Integration, Span } from '@sentry/core'; + import { addBreadcrumb, getClient, @@ -7,11 +8,13 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToJSON, } from '@sentry/core'; + import type { EmitterSubscription } from '../utils/rnlibrariesinterface'; +import type { ReactNativeTracingIntegration } from './reactnativetracing'; + import { isSentrySpan } from '../utils/span'; import { ignoreEmptyBackNavigation, ignoreEmptyRouteChangeTransactions } from './onSpanEndUtils'; import { SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NATIVE_NAVIGATION } from './origin'; -import type { ReactNativeTracingIntegration } from './reactnativetracing'; import { getReactNativeTracingIntegration } from './reactnativetracing'; import { DEFAULT_NAVIGATION_SPAN_NAME, diff --git a/packages/core/src/js/tracing/reactnativeprofiler.tsx b/packages/core/src/js/tracing/reactnativeprofiler.tsx index 931e6134b7..c62d5f8b74 100644 --- a/packages/core/src/js/tracing/reactnativeprofiler.tsx +++ b/packages/core/src/js/tracing/reactnativeprofiler.tsx @@ -1,5 +1,6 @@ import { debug, timestampInSeconds } from '@sentry/core'; import { getClient, Profiler } from '@sentry/react'; + import { getAppRegistryIntegration } from '../integrations/appRegistry'; import { createIntegration } from '../integrations/factory'; import { _captureAppStart, _setRootComponentCreationTimestampMs } from '../tracing/integrations/appStart'; diff --git a/packages/core/src/js/tracing/reactnativetracing.ts b/packages/core/src/js/tracing/reactnativetracing.ts index 50dab2f120..bb43196e94 100644 --- a/packages/core/src/js/tracing/reactnativetracing.ts +++ b/packages/core/src/js/tracing/reactnativetracing.ts @@ -1,6 +1,8 @@ -import { instrumentOutgoingRequests } from '@sentry/browser'; import type { Client, Event, Integration, StartSpanOptions } from '@sentry/core'; + +import { instrumentOutgoingRequests } from '@sentry/browser'; import { getClient } from '@sentry/core'; + import { isWeb } from '../utils/environment'; import { getDevServer } from './../integrations/debugsymbolicatorutils'; import { addDefaultOpForSpanFrom, addThreadInfoToSpan, defaultIdleOptions } from './span'; diff --git a/packages/core/src/js/tracing/reactnavigation.ts b/packages/core/src/js/tracing/reactnavigation.ts index 05deba1ef1..e717df4900 100644 --- a/packages/core/src/js/tracing/reactnavigation.ts +++ b/packages/core/src/js/tracing/reactnavigation.ts @@ -1,5 +1,6 @@ /* oxlint-disable eslint(max-lines) */ import type { Client, Integration, Span } from '@sentry/core'; + import { addBreadcrumb, debug, @@ -12,14 +13,16 @@ import { startInactiveSpan, timestampInSeconds, } from '@sentry/core'; + +import type { UnsafeAction } from '../vendor/react-navigation/types'; +import type { ReactNativeTracingIntegration } from './reactnativetracing'; + import { getAppRegistryIntegration } from '../integrations/appRegistry'; import { isSentrySpan } from '../utils/span'; import { RN_GLOBAL_OBJ } from '../utils/worldwide'; -import type { UnsafeAction } from '../vendor/react-navigation/types'; import { NATIVE } from '../wrapper'; import { ignoreEmptyBackNavigation, ignoreEmptyRouteChangeTransactions } from './onSpanEndUtils'; import { SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NAVIGATION } from './origin'; -import type { ReactNativeTracingIntegration } from './reactnativetracing'; import { getReactNativeTracingIntegration } from './reactnativetracing'; import { SEMANTIC_ATTRIBUTE_NAVIGATION_ACTION_TYPE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from './semanticAttributes'; import { diff --git a/packages/core/src/js/tracing/span.ts b/packages/core/src/js/tracing/span.ts index 5a2a3539a3..7b9188224a 100644 --- a/packages/core/src/js/tracing/span.ts +++ b/packages/core/src/js/tracing/span.ts @@ -1,4 +1,5 @@ import type { Client, Scope, Span, SpanJSON, StartSpanOptions } from '@sentry/core'; + import { debug, generateTraceId, @@ -13,6 +14,7 @@ import { startIdleSpan as coreStartIdleSpan, } from '@sentry/core'; import { AppState, Platform } from 'react-native'; + import { isRootSpan } from '../utils/span'; import { adjustTransactionDuration, cancelInBackground } from './onSpanEndUtils'; import { diff --git a/packages/core/src/js/tracing/timetodisplay.tsx b/packages/core/src/js/tracing/timetodisplay.tsx index 3572d24a57..1dedc695bd 100644 --- a/packages/core/src/js/tracing/timetodisplay.tsx +++ b/packages/core/src/js/tracing/timetodisplay.tsx @@ -1,9 +1,22 @@ /* oxlint-disable eslint(max-lines) */ import type { Span, StartSpanOptions } from '@sentry/core'; -import { debug, fill, getActiveSpan, getSpanDescendants, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, SPAN_STATUS_OK, spanToJSON, startInactiveSpan } from '@sentry/core'; + +import { + debug, + fill, + getActiveSpan, + getSpanDescendants, + SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, + SPAN_STATUS_ERROR, + SPAN_STATUS_OK, + spanToJSON, + startInactiveSpan, +} from '@sentry/core'; import * as React from 'react'; import { useState } from 'react'; + import type { NativeFramesResponse } from '../NativeRNSentry'; + import { NATIVE } from '../wrapper'; import { SPAN_ORIGIN_AUTO_UI_TIME_TO_DISPLAY, SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY } from './origin'; import { getRNSentryOnDrawReporter } from './timetodisplaynative'; @@ -63,7 +76,11 @@ export function TimeToInitialDisplay(props: TimeToDisplayProps): React.ReactElem } const parentSpanId = activeSpan && spanToJSON(activeSpan).span_id; - return {props.children}; + return ( + + {props.children} + + ); } /** @@ -76,7 +93,11 @@ export function TimeToInitialDisplay(props: TimeToDisplayProps): React.ReactElem export function TimeToFullDisplay(props: TimeToDisplayProps): React.ReactElement { const activeSpan = getActiveSpan(); const parentSpanId = activeSpan && spanToJSON(activeSpan).span_id; - return {props.children}; + return ( + + {props.children} + + ); } function TimeToDisplay(props: { @@ -91,7 +112,8 @@ function TimeToDisplay(props: { + parentSpanId={props.parentSpanId} + /> {props.children} ); @@ -107,7 +129,7 @@ function TimeToDisplay(props: { export function startTimeToInitialDisplaySpan( options?: Omit & { name?: string; - isAutoInstrumented?: boolean + isAutoInstrumented?: boolean; }, ): Span | undefined { const activeSpan = getActiveSpan(); @@ -116,10 +138,10 @@ export function startTimeToInitialDisplaySpan( return undefined; } - const existingSpan = getSpanDescendants(activeSpan).find((span) => spanToJSON(span).op === 'ui.load.initial_display'); + const existingSpan = getSpanDescendants(activeSpan).find(span => spanToJSON(span).op === 'ui.load.initial_display'); if (existingSpan) { debug.log('[TimeToDisplay] Found existing ui.load.initial_display span.'); - return existingSpan + return existingSpan; } const initialDisplaySpan = startInactiveSpan({ @@ -133,8 +155,11 @@ export function startTimeToInitialDisplaySpan( return undefined; } - captureStartFramesForSpan(initialDisplaySpan.spanContext().spanId).catch((error) => { - debug.log(`[TimeToDisplay] Failed to capture start frames for initial display span (${initialDisplaySpan.spanContext().spanId}).`, error); + captureStartFramesForSpan(initialDisplaySpan.spanContext().spanId).catch(error => { + debug.log( + `[TimeToDisplay] Failed to capture start frames for initial display span (${initialDisplaySpan.spanContext().spanId}).`, + error, + ); }); if (options?.isAutoInstrumented) { @@ -156,9 +181,9 @@ export function startTimeToInitialDisplaySpan( */ export function startTimeToFullDisplaySpan( options: Omit & { - name?: string, - timeoutMs?: number, - isAutoInstrumented?: boolean + name?: string; + timeoutMs?: number; + isAutoInstrumented?: boolean; } = { timeoutMs: 30_000, }, @@ -171,13 +196,13 @@ export function startTimeToFullDisplaySpan( const descendantSpans = getSpanDescendants(activeSpan); - const initialDisplaySpan = descendantSpans.find((span) => spanToJSON(span).op === 'ui.load.initial_display'); + const initialDisplaySpan = descendantSpans.find(span => spanToJSON(span).op === 'ui.load.initial_display'); if (!initialDisplaySpan) { debug.warn('[TimeToDisplay] No initial display span found to attach ui.load.full_display to.'); return undefined; } - const existingSpan = descendantSpans.find((span) => spanToJSON(span).op === 'ui.load.full_display'); + const existingSpan = descendantSpans.find(span => spanToJSON(span).op === 'ui.load.full_display'); if (existingSpan) { debug.log('[TimeToDisplay] Found existing ui.load.full_display span.'); return existingSpan; @@ -193,8 +218,11 @@ export function startTimeToFullDisplaySpan( return undefined; } - captureStartFramesForSpan(fullDisplaySpan.spanContext().spanId).catch((error) => { - debug.log(`[TimeToDisplay] Failed to capture start frames for full display span (${fullDisplaySpan.spanContext().spanId}).`, error); + captureStartFramesForSpan(fullDisplaySpan.spanContext().spanId).catch(error => { + debug.log( + `[TimeToDisplay] Failed to capture start frames for full display span (${fullDisplaySpan.spanContext().spanId}).`, + error, + ); }); const timeout = setTimeout(() => { @@ -203,15 +231,19 @@ export function startTimeToFullDisplaySpan( } fullDisplaySpan.setStatus({ code: SPAN_STATUS_ERROR, message: 'deadline_exceeded' }); - captureEndFramesAndAttachToSpan(fullDisplaySpan).then(() => { - debug.log(`[TimeToDisplay] span ${fullDisplaySpan.spanContext().spanId} updated with frame data.`); - fullDisplaySpan.end(spanToJSON(initialDisplaySpan).timestamp); - setSpanDurationAsMeasurement('time_to_full_display', fullDisplaySpan); - }).catch(() => { - debug.warn(`[TimeToDisplay] Failed to capture end frames for full display span (${fullDisplaySpan.spanContext().spanId}).`); - fullDisplaySpan.end(spanToJSON(initialDisplaySpan).timestamp); - setSpanDurationAsMeasurement('time_to_full_display', fullDisplaySpan); - }); + captureEndFramesAndAttachToSpan(fullDisplaySpan) + .then(() => { + debug.log(`[TimeToDisplay] span ${fullDisplaySpan.spanContext().spanId} updated with frame data.`); + fullDisplaySpan.end(spanToJSON(initialDisplaySpan).timestamp); + setSpanDurationAsMeasurement('time_to_full_display', fullDisplaySpan); + }) + .catch(() => { + debug.warn( + `[TimeToDisplay] Failed to capture end frames for full display span (${fullDisplaySpan.spanContext().spanId}).`, + ); + fullDisplaySpan.end(spanToJSON(initialDisplaySpan).timestamp); + setSpanDurationAsMeasurement('time_to_full_display', fullDisplaySpan); + }); debug.warn('[TimeToDisplay] Full display span deadline_exceeded.'); }, options.timeoutMs); @@ -244,7 +276,8 @@ export function updateInitialDisplaySpan( * Time to initial display span to update. */ span?: Span; - } = {}): void { + } = {}, +): void { if (!span) { debug.warn('[TimeToDisplay] No span found or created, possibly performance is disabled.'); return; @@ -265,31 +298,33 @@ export function updateInitialDisplaySpan( return; } - captureEndFramesAndAttachToSpan(span).then(() => { - span.end(frameTimestampSeconds); - span.setStatus({ code: SPAN_STATUS_OK }); - debug.log(`[TimeToDisplay] ${spanToJSON(span).description} span updated with end timestamp and frame data.`); + captureEndFramesAndAttachToSpan(span) + .then(() => { + span.end(frameTimestampSeconds); + span.setStatus({ code: SPAN_STATUS_OK }); + debug.log(`[TimeToDisplay] ${spanToJSON(span).description} span updated with end timestamp and frame data.`); - if (fullDisplayBeforeInitialDisplay.has(activeSpan)) { - fullDisplayBeforeInitialDisplay.delete(activeSpan); - debug.log(`[TimeToDisplay] Updating full display with initial display (${span.spanContext().spanId}) end.`); - updateFullDisplaySpan(frameTimestampSeconds, span); - } - - setSpanDurationAsMeasurementOnSpan('time_to_initial_display', span, activeSpan); - }).catch((error) => { - debug.log('[TimeToDisplay] Failed to capture frame data for initial display span.', error); - span.end(frameTimestampSeconds); - span.setStatus({ code: SPAN_STATUS_OK }); + if (fullDisplayBeforeInitialDisplay.has(activeSpan)) { + fullDisplayBeforeInitialDisplay.delete(activeSpan); + debug.log(`[TimeToDisplay] Updating full display with initial display (${span.spanContext().spanId}) end.`); + updateFullDisplaySpan(frameTimestampSeconds, span); + } - if (fullDisplayBeforeInitialDisplay.has(activeSpan)) { - fullDisplayBeforeInitialDisplay.delete(activeSpan); - debug.log(`[TimeToDisplay] Updating full display with initial display (${span.spanContext().spanId}) end.`); - updateFullDisplaySpan(frameTimestampSeconds, span); - } + setSpanDurationAsMeasurementOnSpan('time_to_initial_display', span, activeSpan); + }) + .catch(error => { + debug.log('[TimeToDisplay] Failed to capture frame data for initial display span.', error); + span.end(frameTimestampSeconds); + span.setStatus({ code: SPAN_STATUS_OK }); + + if (fullDisplayBeforeInitialDisplay.has(activeSpan)) { + fullDisplayBeforeInitialDisplay.delete(activeSpan); + debug.log(`[TimeToDisplay] Updating full display with initial display (${span.spanContext().spanId}) end.`); + updateFullDisplaySpan(frameTimestampSeconds, span); + } - setSpanDurationAsMeasurementOnSpan('time_to_initial_display', span, activeSpan); - }); + setSpanDurationAsMeasurementOnSpan('time_to_initial_display', span, activeSpan); + }); } function updateFullDisplaySpan(frameTimestampSeconds: number, passedInitialDisplaySpan?: Span): void { @@ -299,12 +334,15 @@ function updateFullDisplaySpan(frameTimestampSeconds: number, passedInitialDispl return; } - const existingInitialDisplaySpan = passedInitialDisplaySpan - || getSpanDescendants(activeSpan).find((span) => spanToJSON(span).op === 'ui.load.initial_display'); + const existingInitialDisplaySpan = + passedInitialDisplaySpan || + getSpanDescendants(activeSpan).find(span => spanToJSON(span).op === 'ui.load.initial_display'); const initialDisplayEndTimestamp = existingInitialDisplaySpan && spanToJSON(existingInitialDisplaySpan).timestamp; if (!initialDisplayEndTimestamp) { fullDisplayBeforeInitialDisplay.set(activeSpan, true); - debug.warn(`[TimeToDisplay] Full display called before initial display for active span (${activeSpan.spanContext().spanId}).`); + debug.warn( + `[TimeToDisplay] Full display called before initial display for active span (${activeSpan.spanContext().spanId}).`, + ); return; } @@ -322,26 +360,34 @@ function updateFullDisplaySpan(frameTimestampSeconds: number, passedInitialDispl return; } - captureEndFramesAndAttachToSpan(span).then(() => { - const endTimestamp = initialDisplayEndTimestamp > frameTimestampSeconds ? initialDisplayEndTimestamp : frameTimestampSeconds; - - if (initialDisplayEndTimestamp > frameTimestampSeconds) { - debug.warn('[TimeToDisplay] Using initial display end. Full display end frame timestamp is before initial display end.'); - } - - span.end(endTimestamp); - span.setStatus({ code: SPAN_STATUS_OK }); - debug.log(`[TimeToDisplay] span ${spanJSON.description} (${spanJSON.span_id}) updated with end timestamp and frame data.`); + captureEndFramesAndAttachToSpan(span) + .then(() => { + const endTimestamp = + initialDisplayEndTimestamp > frameTimestampSeconds ? initialDisplayEndTimestamp : frameTimestampSeconds; - setSpanDurationAsMeasurement('time_to_full_display', span); - }).catch((error) => { - debug.log('[TimeToDisplay] Failed to capture frame data for full display span.', error); - const endTimestamp = initialDisplayEndTimestamp > frameTimestampSeconds ? initialDisplayEndTimestamp : frameTimestampSeconds; + if (initialDisplayEndTimestamp > frameTimestampSeconds) { + debug.warn( + '[TimeToDisplay] Using initial display end. Full display end frame timestamp is before initial display end.', + ); + } - span.end(endTimestamp); - span.setStatus({ code: SPAN_STATUS_OK }); - setSpanDurationAsMeasurement('time_to_full_display', span); - }); + span.end(endTimestamp); + span.setStatus({ code: SPAN_STATUS_OK }); + debug.log( + `[TimeToDisplay] span ${spanJSON.description} (${spanJSON.span_id}) updated with end timestamp and frame data.`, + ); + + setSpanDurationAsMeasurement('time_to_full_display', span); + }) + .catch(error => { + debug.log('[TimeToDisplay] Failed to capture frame data for full display span.', error); + const endTimestamp = + initialDisplayEndTimestamp > frameTimestampSeconds ? initialDisplayEndTimestamp : frameTimestampSeconds; + + span.end(endTimestamp); + span.setStatus({ code: SPAN_STATUS_OK }); + setSpanDurationAsMeasurement('time_to_full_display', span); + }); } /** @@ -353,7 +399,7 @@ export function createTimeToFullDisplay({ /** * `@react-navigation/native` useFocusEffect hook. */ - useFocusEffect: (callback: () => void) => void + useFocusEffect: (callback: () => void) => void; }): React.ComponentType { return createTimeToDisplay({ useFocusEffect, Component: TimeToFullDisplay }); } @@ -364,7 +410,7 @@ export function createTimeToFullDisplay({ export function createTimeToInitialDisplay({ useFocusEffect, }: { - useFocusEffect: (callback: () => void) => void + useFocusEffect: (callback: () => void) => void; }): React.ComponentType { return createTimeToDisplay({ useFocusEffect, Component: TimeToInitialDisplay }); } @@ -383,10 +429,10 @@ function createTimeToDisplay({ const [focused, setFocused] = useState(false); useFocusEffect(() => { - setFocused(true); - return () => { - setFocused(false); - }; + setFocused(true); + return () => { + setFocused(false); + }; }); return ; @@ -405,7 +451,9 @@ function attachFrameDataToSpan(span: Span, startFrames: NativeFramesResponse, en const frozenFrames = endFrames.frozenFrames - startFrames.frozenFrames; if (totalFrames <= 0 && slowFrames <= 0 && frozenFrames <= 0) { - debug.warn(`[TimeToDisplay] Detected zero slow or frozen frames. Not adding measurements to span (${span.spanContext().spanId}).`); + debug.warn( + `[TimeToDisplay] Detected zero slow or frozen frames. Not adding measurements to span (${span.spanContext().spanId}).`, + ); return; } span.setAttribute('frames.total', totalFrames); diff --git a/packages/core/src/js/tracing/timetodisplaynative.tsx b/packages/core/src/js/tracing/timetodisplaynative.tsx index 217a922db8..8d07ebec11 100644 --- a/packages/core/src/js/tracing/timetodisplaynative.tsx +++ b/packages/core/src/js/tracing/timetodisplaynative.tsx @@ -1,9 +1,12 @@ -import * as React from 'react'; import type { HostComponent } from 'react-native'; + +import * as React from 'react'; import { UIManager, View } from 'react-native'; + +import type { RNSentryOnDrawReporterProps } from './timetodisplaynative.types'; + import { isExpoGo } from '../utils/environment'; import { ReactNativeLibraries } from '../utils/rnlibraries'; -import type { RNSentryOnDrawReporterProps } from './timetodisplaynative.types'; const RNSentryOnDrawReporterClass = 'RNSentryOnDrawReporter'; @@ -16,9 +19,7 @@ export const nativeComponentExists = UIManager.hasViewManagerConfig */ class RNSentryOnDrawReporterNoop extends React.Component { public render(): React.ReactNode { - return ( - - ); + return ; } } @@ -29,9 +30,10 @@ let RNSentryOnDrawReporter: HostComponent | typeof */ export const getRNSentryOnDrawReporter = (): typeof RNSentryOnDrawReporter => { if (!RNSentryOnDrawReporter) { - RNSentryOnDrawReporter = !isExpoGo() && nativeComponentExists && ReactNativeLibraries.ReactNative?.requireNativeComponent - ? ReactNativeLibraries.ReactNative.requireNativeComponent(RNSentryOnDrawReporterClass) - : RNSentryOnDrawReporterNoop; + RNSentryOnDrawReporter = + !isExpoGo() && nativeComponentExists && ReactNativeLibraries.ReactNative?.requireNativeComponent + ? ReactNativeLibraries.ReactNative.requireNativeComponent(RNSentryOnDrawReporterClass) + : RNSentryOnDrawReporterNoop; } return RNSentryOnDrawReporter; -} +}; diff --git a/packages/core/src/js/tracing/utils.ts b/packages/core/src/js/tracing/utils.ts index fe36d19a87..47a38cb18b 100644 --- a/packages/core/src/js/tracing/utils.ts +++ b/packages/core/src/js/tracing/utils.ts @@ -1,4 +1,5 @@ import type { MeasurementUnit, Span, SpanJSON, StartSpanOptions, TransactionSource } from '@sentry/core'; + import { debug, dropUndefinedKeys, @@ -15,6 +16,7 @@ import { timestampInSeconds, uuid4, } from '@sentry/core'; + import { RN_GLOBAL_OBJ } from '../utils/worldwide'; export const defaultTransactionSource: TransactionSource = 'component'; diff --git a/packages/core/src/js/transports/native.ts b/packages/core/src/js/transports/native.ts index c8037ea986..e2c8d28b70 100644 --- a/packages/core/src/js/transports/native.ts +++ b/packages/core/src/js/transports/native.ts @@ -5,7 +5,9 @@ import type { Transport, TransportMakeRequestResponse, } from '@sentry/core'; + import { makePromiseBuffer } from '@sentry/core'; + import { NATIVE } from '../wrapper'; export const DEFAULT_BUFFER_SIZE = 30; diff --git a/packages/core/src/js/utils/envelope.ts b/packages/core/src/js/utils/envelope.ts index ca6cb9a6d0..361a39ef45 100644 --- a/packages/core/src/js/utils/envelope.ts +++ b/packages/core/src/js/utils/envelope.ts @@ -1,4 +1,5 @@ import type { DsnComponents, EventEnvelope, SdkMetadata, UserFeedback, UserFeedbackItem } from '@sentry/core'; + import { createEnvelope, dsnToString } from '@sentry/core'; export const header = 0; diff --git a/packages/core/src/js/utils/environment.ts b/packages/core/src/js/utils/environment.ts index 71c7586b6b..abc3c85ed3 100644 --- a/packages/core/src/js/utils/environment.ts +++ b/packages/core/src/js/utils/environment.ts @@ -1,4 +1,5 @@ import { Platform } from 'react-native'; + import { RN_GLOBAL_OBJ } from '../utils/worldwide'; import { getExpoConstants, getExpoGo } from './expomodules'; import { ReactNativeLibraries } from './rnlibraries'; diff --git a/packages/core/src/js/utils/expomodules.ts b/packages/core/src/js/utils/expomodules.ts index d1a973dd5e..eabf8287b5 100644 --- a/packages/core/src/js/utils/expomodules.ts +++ b/packages/core/src/js/utils/expomodules.ts @@ -1,4 +1,5 @@ import type { ExpoConstants, ExpoDevice, ExpoGo, ExpoUpdates } from './expoglobalobject'; + import { RN_GLOBAL_OBJ } from './worldwide'; /** diff --git a/packages/core/src/js/utils/rnlibraries.ts b/packages/core/src/js/utils/rnlibraries.ts index 920a19a534..afef515493 100644 --- a/packages/core/src/js/utils/rnlibraries.ts +++ b/packages/core/src/js/utils/rnlibraries.ts @@ -1,5 +1,6 @@ /* oxlint-disable typescript-eslint(no-unsafe-member-access) */ import { AppRegistry, Platform, TurboModuleRegistry } from 'react-native'; + import type * as ReactNative from '../vendor/react-native'; import type { ReactNativeLibrariesInterface } from './rnlibrariesinterface'; diff --git a/packages/core/src/js/utils/safe.ts b/packages/core/src/js/utils/safe.ts index 6a5b56d6fd..6c40101bcb 100644 --- a/packages/core/src/js/utils/safe.ts +++ b/packages/core/src/js/utils/safe.ts @@ -1,4 +1,5 @@ import { debug } from '@sentry/core'; + import type { ReactNativeOptions } from '../options'; type DangerTypesWithoutCallSignature = object | null | undefined; diff --git a/packages/core/src/js/utils/sentryeventemitter.ts b/packages/core/src/js/utils/sentryeventemitter.ts index 776c94a7b4..ac230b2ef5 100644 --- a/packages/core/src/js/utils/sentryeventemitter.ts +++ b/packages/core/src/js/utils/sentryeventemitter.ts @@ -1,6 +1,8 @@ -import { debug } from '@sentry/core'; import type { EmitterSubscription, NativeModule } from 'react-native'; + +import { debug } from '@sentry/core'; import { NativeEventEmitter } from 'react-native'; + import { getRNSentryModule } from '../wrapper'; export const NewFrameEventName = 'rn_sentry_new_frame'; diff --git a/packages/core/src/js/utils/sentryeventemitterfallback.ts b/packages/core/src/js/utils/sentryeventemitterfallback.ts index 5cb413d770..fa58b76c44 100644 --- a/packages/core/src/js/utils/sentryeventemitterfallback.ts +++ b/packages/core/src/js/utils/sentryeventemitterfallback.ts @@ -1,6 +1,8 @@ import { debug, timestampInSeconds } from '@sentry/core'; -import { NATIVE } from '../wrapper'; + import type { NewFrameEvent, SentryEventEmitter } from './sentryeventemitter'; + +import { NATIVE } from '../wrapper'; import { createSentryEventEmitter, NewFrameEventName } from './sentryeventemitter'; export const FALLBACK_TIMEOUT_MS = 10_000; diff --git a/packages/core/src/js/utils/span.ts b/packages/core/src/js/utils/span.ts index 7338e1d492..22bda6a493 100644 --- a/packages/core/src/js/utils/span.ts +++ b/packages/core/src/js/utils/span.ts @@ -1,4 +1,5 @@ import type { Span, TransactionEvent } from '@sentry/core'; + import { getRootSpan, SentrySpan } from '@sentry/core'; /** diff --git a/packages/core/src/js/utils/worldwide.ts b/packages/core/src/js/utils/worldwide.ts index e4e612704e..326f35aa99 100644 --- a/packages/core/src/js/utils/worldwide.ts +++ b/packages/core/src/js/utils/worldwide.ts @@ -1,6 +1,8 @@ import type { InternalGlobal } from '@sentry/core'; -import { GLOBAL_OBJ } from '@sentry/core'; import type { ErrorUtils } from 'react-native/types'; + +import { GLOBAL_OBJ } from '@sentry/core'; + import type { ReactNativeOptions } from '../options'; import type { ExpoGlobalObject } from './expoglobalobject'; diff --git a/packages/core/src/js/wrapper.ts b/packages/core/src/js/wrapper.ts index e633eb85a4..6db79557c2 100644 --- a/packages/core/src/js/wrapper.ts +++ b/packages/core/src/js/wrapper.ts @@ -10,9 +10,10 @@ import type { SeverityLevel, User, } from '@sentry/core'; + import { debug, normalize, SentryError } from '@sentry/core'; import { NativeModules, Platform } from 'react-native'; -import { isHardCrash } from './misc'; + import type { NativeAppStartResponse, NativeDeviceContextsResponse, @@ -27,6 +28,8 @@ import type * as Hermes from './profiling/hermes'; import type { NativeAndroidProfileEvent, NativeProfileEvent } from './profiling/nativeTypes'; import type { MobileReplayOptions } from './replay/mobilereplay'; import type { RequiredKeysUser } from './user'; + +import { isHardCrash } from './misc'; import { encodeUTF8 } from './utils/encode'; import { isTurboModuleEnabled } from './utils/environment'; import { convertToNormalizedObject } from './utils/normalize'; @@ -38,7 +41,7 @@ import { base64StringFromByteArray } from './vendor'; */ export function getRNSentryModule(): Spec | undefined { return isTurboModuleEnabled() - ? ReactNativeLibraries.TurboModuleRegistry?.get('RNSentry') ?? undefined + ? (ReactNativeLibraries.TurboModuleRegistry?.get('RNSentry') ?? undefined) : NativeModules.RNSentry; } diff --git a/packages/core/test/NativeLogListener.test.ts b/packages/core/test/NativeLogListener.test.ts index 5ee673750a..7d778ebe17 100644 --- a/packages/core/test/NativeLogListener.test.ts +++ b/packages/core/test/NativeLogListener.test.ts @@ -1,7 +1,9 @@ import { debug } from '@sentry/core'; -import { defaultNativeLogHandler, setupNativeLogListener } from '../src/js/NativeLogListener'; + import type { NativeLogEntry } from '../src/js/options'; +import { defaultNativeLogHandler, setupNativeLogListener } from '../src/js/NativeLogListener'; + jest.mock('../src/js/utils/environment', () => ({ isExpoGo: jest.fn().mockReturnValue(false), })); diff --git a/packages/core/test/breadcrumb.test.ts b/packages/core/test/breadcrumb.test.ts index 9f1609727b..e0b7db4c60 100644 --- a/packages/core/test/breadcrumb.test.ts +++ b/packages/core/test/breadcrumb.test.ts @@ -1,4 +1,5 @@ import type { Breadcrumb } from '@sentry/core'; + import { breadcrumbFromObject } from '../src/js/breadcrumb'; describe('Breadcrumb', () => { diff --git a/packages/core/test/client.test.ts b/packages/core/test/client.test.ts index 9805fba27c..c9b59c6d95 100644 --- a/packages/core/test/client.test.ts +++ b/packages/core/test/client.test.ts @@ -1,4 +1,3 @@ -import { defaultStackParser } from '@sentry/browser'; import type { Envelope, Event, @@ -7,6 +6,8 @@ import type { Transport, TransportMakeRequestResponse, } from '@sentry/core'; + +import { defaultStackParser } from '@sentry/browser'; import * as SentryCore from '@sentry/core'; import { addAutoIpAddressToSession, @@ -16,8 +17,10 @@ import { SentryError, } from '@sentry/core'; import * as RN from 'react-native'; -import { ReactNativeClient } from '../src/js/client'; + import type { ReactNativeClientOptions } from '../src/js/options'; + +import { ReactNativeClient } from '../src/js/client'; import { NativeTransport } from '../src/js/transports/native'; import { SDK_NAME, SDK_PACKAGE_NAME, SDK_VERSION } from '../src/js/version'; import { NATIVE } from '../src/js/wrapper'; diff --git a/packages/core/test/clientAfterInit.test.ts b/packages/core/test/clientAfterInit.test.ts index 227d4d09bb..08cc9b06d7 100644 --- a/packages/core/test/clientAfterInit.test.ts +++ b/packages/core/test/clientAfterInit.test.ts @@ -1,5 +1,6 @@ -import { ReactNativeClient } from '../src/js'; import type { ReactNativeClientOptions } from '../src/js/options'; + +import { ReactNativeClient } from '../src/js'; import { NATIVE } from './mockWrapper'; jest.useFakeTimers({ advanceTimers: true }); diff --git a/packages/core/test/expo-plugin/modifyAppDelegate.test.ts b/packages/core/test/expo-plugin/modifyAppDelegate.test.ts index d4e0e324da..b6bed64aa1 100644 --- a/packages/core/test/expo-plugin/modifyAppDelegate.test.ts +++ b/packages/core/test/expo-plugin/modifyAppDelegate.test.ts @@ -1,4 +1,5 @@ import type { ExpoConfig } from '@expo/config-types'; + import { warnOnce } from '../../plugin/src/logger'; import { modifyAppDelegate } from '../../plugin/src/withSentryIOS'; diff --git a/packages/core/test/expo-plugin/modifyMainApplication.test.ts b/packages/core/test/expo-plugin/modifyMainApplication.test.ts index 65340f22ab..2bfd85342a 100644 --- a/packages/core/test/expo-plugin/modifyMainApplication.test.ts +++ b/packages/core/test/expo-plugin/modifyMainApplication.test.ts @@ -1,4 +1,5 @@ import type { ExpoConfig } from '@expo/config-types'; + import { warnOnce } from '../../plugin/src/logger'; import { modifyMainApplication } from '../../plugin/src/withSentryAndroid'; diff --git a/packages/core/test/expo-plugin/withSentryAndroidGradlePlugin.test.ts b/packages/core/test/expo-plugin/withSentryAndroidGradlePlugin.test.ts index 47eefec124..1456c372b1 100644 --- a/packages/core/test/expo-plugin/withSentryAndroidGradlePlugin.test.ts +++ b/packages/core/test/expo-plugin/withSentryAndroidGradlePlugin.test.ts @@ -1,6 +1,8 @@ import { withAppBuildGradle, withProjectBuildGradle } from '@expo/config-plugins'; -import { warnOnce } from '../../plugin/src/logger'; + import type { SentryAndroidGradlePluginOptions } from '../../plugin/src/withSentryAndroidGradlePlugin'; + +import { warnOnce } from '../../plugin/src/logger'; import { sentryAndroidGradlePluginVersion, withSentryAndroidGradlePlugin, diff --git a/packages/core/test/expo-plugin/writeSentryOptions.test.ts b/packages/core/test/expo-plugin/writeSentryOptions.test.ts index 9f00fb3e0c..5a643e7b3d 100644 --- a/packages/core/test/expo-plugin/writeSentryOptions.test.ts +++ b/packages/core/test/expo-plugin/writeSentryOptions.test.ts @@ -1,6 +1,7 @@ import * as fs from 'fs'; import * as os from 'os'; import * as path from 'path'; + import { writeSentryOptions } from '../../plugin/src/utils'; jest.mock('../../plugin/src/logger'); diff --git a/packages/core/test/feedback.test.ts b/packages/core/test/feedback.test.ts index ca75063402..37a2c37f33 100644 --- a/packages/core/test/feedback.test.ts +++ b/packages/core/test/feedback.test.ts @@ -1,4 +1,5 @@ import type { Span } from '@sentry/core'; + import { addBreadcrumb, captureFeedback, @@ -9,6 +10,7 @@ import { withIsolationScope, withScope, } from '@sentry/core'; + import { getDefaultTestClientOptions, TestClient } from './mocks/client'; describe('captureFeedback', () => { diff --git a/packages/core/test/feedback/FeedbackButton.test.tsx b/packages/core/test/feedback/FeedbackButton.test.tsx index db2dd025a4..3799c19c46 100644 --- a/packages/core/test/feedback/FeedbackButton.test.tsx +++ b/packages/core/test/feedback/FeedbackButton.test.tsx @@ -1,7 +1,9 @@ import { fireEvent, render, waitFor } from '@testing-library/react-native'; import * as React from 'react'; -import { FeedbackButton } from '../../src/js/feedback/FeedbackButton'; + import type { FeedbackButtonProps, FeedbackButtonStyles } from '../../src/js/feedback/FeedbackWidget.types'; + +import { FeedbackButton } from '../../src/js/feedback/FeedbackButton'; import { showFeedbackWidget } from '../../src/js/feedback/FeedbackWidgetManager'; jest.mock('../../src/js/feedback/FeedbackWidgetManager', () => ({ @@ -28,18 +30,18 @@ describe('FeedbackButton', () => { }); it('matches the snapshot with default configuration', () => { - const { toJSON } = render(); + const { toJSON } = render(); expect(toJSON()).toMatchSnapshot(); }); it('matches the snapshot with custom texts', () => { - const { toJSON } = render(); + const { toJSON } = render(); expect(toJSON()).toMatchSnapshot(); }); it('matches the snapshot with custom styles', () => { - const customStyleProps = {styles: customStyles}; - const { toJSON } = render(); + const customStyleProps = { styles: customStyles }; + const { toJSON } = render(); expect(toJSON()).toMatchSnapshot(); }); diff --git a/packages/core/test/feedback/FeedbackWidget.test.tsx b/packages/core/test/feedback/FeedbackWidget.test.tsx index bf58f706bb..573f0b7b69 100644 --- a/packages/core/test/feedback/FeedbackWidget.test.tsx +++ b/packages/core/test/feedback/FeedbackWidget.test.tsx @@ -2,10 +2,16 @@ import { captureFeedback, getClient, setCurrentClient } from '@sentry/core'; import { fireEvent, render, waitFor } from '@testing-library/react-native'; import * as React from 'react'; import { Alert } from 'react-native'; + +import type { + FeedbackWidgetProps, + FeedbackWidgetStyles, + ImagePicker, +} from '../../src/js/feedback/FeedbackWidget.types'; + import { FeedbackWidget } from '../../src/js/feedback/FeedbackWidget'; -import type { FeedbackWidgetProps, FeedbackWidgetStyles, ImagePicker } from '../../src/js/feedback/FeedbackWidget.types'; import { MOBILE_FEEDBACK_INTEGRATION_NAME } from '../../src/js/feedback/integration'; -import { getDefaultTestClientOptions,TestClient } from '../mocks/client'; +import { getDefaultTestClientOptions, TestClient } from '../mocks/client'; const mockOnFormClose = jest.fn(); const mockOnAddScreenshot = jest.fn(); @@ -118,41 +124,39 @@ describe('FeedbackWidget', () => { }); it('matches the snapshot with default configuration', () => { - const { toJSON } = render(); + const { toJSON } = render(); expect(toJSON()).toMatchSnapshot(); }); it('matches the snapshot with custom texts', () => { - const { toJSON } = render(); + const { toJSON } = render(); expect(toJSON()).toMatchSnapshot(); }); it('matches the snapshot with custom styles', () => { - const customStyleProps = {styles: customStyles}; - const { toJSON } = render(); + const customStyleProps = { styles: customStyles }; + const { toJSON } = render(); expect(toJSON()).toMatchSnapshot(); }); it('matches the snapshot with default configuration and screenshot button', () => { - const { toJSON } = render(); + const { toJSON } = render(); expect(toJSON()).toMatchSnapshot(); }); it('matches the snapshot with custom texts and screenshot button', () => { - const { toJSON } = render(); + const { toJSON } = render(); expect(toJSON()).toMatchSnapshot(); }); it('matches the snapshot with custom styles and screenshot button', () => { - const customStyleProps = {styles: customStyles}; - const { toJSON } = render(); + const customStyleProps = { styles: customStyles }; + const { toJSON } = render(); expect(toJSON()).toMatchSnapshot(); }); it('passes autoCorrect and spellCheck props to message input', () => { - const { getByTestId } = render( - , - ); + const { getByTestId } = render(); expect(getByTestId('sentry-feedback-message-input').props.autoCorrect).toBe(false); expect(getByTestId('sentry-feedback-message-input').props.spellCheck).toBe(false); @@ -178,7 +182,7 @@ describe('FeedbackWidget', () => { const { getByTestId } = render(); expect(getByTestId('sentry-feedback-email-input').props.autoCapitalize).toBe('none'); - }); + }); it('deep merges custom styles with defaults instead of replacing them', () => { const partialStyles: FeedbackWidgetStyles = { @@ -186,9 +190,7 @@ describe('FeedbackWidget', () => { color: '#ff0000', }, }; - const { getByTestId } = render( - , - ); + const { getByTestId } = render(); const nameInput = getByTestId('sentry-feedback-name-input'); const inputStyle = nameInput.props.style; @@ -213,7 +215,7 @@ describe('FeedbackWidget', () => { expect(getByPlaceholderText(defaultProps.namePlaceholder)).toBeTruthy(); expect(getByText(defaultProps.emailLabel)).toBeTruthy(); expect(getByPlaceholderText(defaultProps.emailPlaceholder)).toBeTruthy(); - expect(getByText(`${defaultProps.messageLabel } ${ defaultProps.isRequiredLabel}`)).toBeTruthy(); + expect(getByText(`${defaultProps.messageLabel} ${defaultProps.isRequiredLabel}`)).toBeTruthy(); expect(getByPlaceholderText(defaultProps.messagePlaceholder)).toBeTruthy(); expect(queryByText(defaultProps.addScreenshotButtonLabel)).toBeNull(); // default false expect(getByText(defaultProps.submitButtonLabel)).toBeTruthy(); @@ -242,9 +244,7 @@ describe('FeedbackWidget', () => { it('prefills from useSentryUser prop when provided', () => { mockCurrentScopeGetUser.mockReturnValue(users.current); - const { getByPlaceholderText } = render( - , - ); + const { getByPlaceholderText } = render(); expect(getByPlaceholderText(defaultProps.namePlaceholder).props.value).toBe(users.prop.name); expect(getByPlaceholderText(defaultProps.emailPlaceholder).props.value).toBe(users.prop.email); }); @@ -316,7 +316,7 @@ describe('FeedbackWidget', () => { }); it('shows an error message if the email is not valid and the email is required', async () => { - const withEmailProps = {...defaultProps, ...{isEmailRequired: true}}; + const withEmailProps = { ...defaultProps, ...{ isEmailRequired: true } }; const { getByPlaceholderText, getByText } = render(); fireEvent.changeText(getByPlaceholderText(defaultProps.namePlaceholder), 'John Doe'); @@ -340,11 +340,14 @@ describe('FeedbackWidget', () => { fireEvent.press(getByText(defaultProps.submitButtonLabel)); await waitFor(() => { - expect(captureFeedback).toHaveBeenCalledWith({ - message: 'This is a feedback message.', - name: 'John Doe', - email: 'john.doe@example.com', - }, undefined); + expect(captureFeedback).toHaveBeenCalledWith( + { + message: 'This is a feedback message.', + name: 'John Doe', + email: 'john.doe@example.com', + }, + undefined, + ); }); }); @@ -444,7 +447,7 @@ describe('FeedbackWidget', () => { launchImageLibraryAsync: mockLaunchImageLibrary, }; - const { getByText } = render(); + const { getByText } = render(); fireEvent.press(getByText(defaultProps.addScreenshotButtonLabel)); @@ -461,7 +464,7 @@ describe('FeedbackWidget', () => { launchImageLibrary: mockLaunchImageLibrary, }; - const { getByText } = render(); + const { getByText } = render(); fireEvent.press(getByText(defaultProps.addScreenshotButtonLabel)); diff --git a/packages/core/test/feedback/FeedbackWidgetManager.test.tsx b/packages/core/test/feedback/FeedbackWidgetManager.test.tsx index 9c52e445ea..5c6935544e 100644 --- a/packages/core/test/feedback/FeedbackWidgetManager.test.tsx +++ b/packages/core/test/feedback/FeedbackWidgetManager.test.tsx @@ -2,11 +2,21 @@ import { debug, getClient, setCurrentClient } from '@sentry/core'; import { act, render, waitFor } from '@testing-library/react-native'; import * as React from 'react'; import { Appearance, Text } from 'react-native'; + import { defaultConfiguration } from '../../src/js/feedback/defaults'; -import { hideFeedbackButton,resetFeedbackButtonManager, resetFeedbackWidgetManager, showFeedbackButton, showFeedbackWidget } from '../../src/js/feedback/FeedbackWidgetManager'; +import { + hideFeedbackButton, + resetFeedbackButtonManager, + resetFeedbackWidgetManager, + showFeedbackButton, + showFeedbackWidget, +} from '../../src/js/feedback/FeedbackWidgetManager'; import { FeedbackWidgetProvider } from '../../src/js/feedback/FeedbackWidgetProvider'; import { feedbackIntegration } from '../../src/js/feedback/integration'; -import { AUTO_INJECT_FEEDBACK_BUTTON_INTEGRATION_NAME,AUTO_INJECT_FEEDBACK_INTEGRATION_NAME } from '../../src/js/feedback/lazy'; +import { + AUTO_INJECT_FEEDBACK_BUTTON_INTEGRATION_NAME, + AUTO_INJECT_FEEDBACK_INTEGRATION_NAME, +} from '../../src/js/feedback/lazy'; import { isModalSupported } from '../../src/js/feedback/utils'; import { getDefaultTestClientOptions, TestClient } from '../mocks/client'; @@ -24,7 +34,6 @@ beforeEach(() => { }); describe('FeedbackWidgetManager', () => { - beforeEach(() => { const client = new TestClient(getDefaultTestClientOptions()); setCurrentClient(client); @@ -42,7 +51,7 @@ describe('FeedbackWidgetManager', () => { const { getByText, getByTestId } = render( App Components - + , ); await act(async () => { @@ -58,7 +67,7 @@ describe('FeedbackWidgetManager', () => { const { getByText, queryByTestId } = render( App Components - + , ); await act(async () => { @@ -83,7 +92,7 @@ describe('FeedbackWidgetManager', () => { const { getByPlaceholderText, getByText } = render( App Components - + , ); const integration = feedbackIntegration({ @@ -107,7 +116,7 @@ describe('FeedbackWidgetManager', () => { const { getByPlaceholderText, getByText, queryByText } = render( App Components - + , ); const integration = feedbackIntegration({ @@ -133,7 +142,9 @@ describe('FeedbackWidgetManager', () => { showFeedbackWidget(); }); - expect(consoleWarnSpy).toHaveBeenLastCalledWith('[Sentry] FeedbackWidget requires \'Sentry.wrap(RootComponent)\' to be called before \'showFeedbackWidget()\'.'); + expect(consoleWarnSpy).toHaveBeenLastCalledWith( + "[Sentry] FeedbackWidget requires 'Sentry.wrap(RootComponent)' to be called before 'showFeedbackWidget()'.", + ); }); it('showFeedbackWidget does not warn about missing feedback provider when FeedbackWidgetProvider is used', () => { @@ -142,7 +153,7 @@ describe('FeedbackWidgetManager', () => { render( App Components - + , ); showFeedbackWidget(); @@ -166,7 +177,6 @@ describe('FeedbackButtonManager', () => { jest.resetAllMocks(); }); - beforeEach(() => { const client = new TestClient(getDefaultTestClientOptions()); setCurrentClient(client); @@ -174,7 +184,7 @@ describe('FeedbackButtonManager', () => { consoleWarnSpy.mockReset(); resetFeedbackButtonManager(); - jest.spyOn(Appearance, 'addChangeListener').mockImplementation((cb) => { + jest.spyOn(Appearance, 'addChangeListener').mockImplementation(cb => { listener = cb; return { remove: jest.fn() }; }); @@ -185,7 +195,7 @@ describe('FeedbackButtonManager', () => { const { getByText } = render( App Components - + , ); await act(async () => { @@ -194,14 +204,14 @@ describe('FeedbackButtonManager', () => { await waitFor(() => { expect(getByText('Report a Bug')).toBeTruthy(); - }) + }); }); it('hideFeedbackButton hides the button', () => { const { queryByText } = render( App Components - + , ); showFeedbackButton(); @@ -219,14 +229,16 @@ describe('FeedbackButtonManager', () => { it('showFeedbackButton warns about missing feedback provider', () => { showFeedbackButton(); - expect(consoleWarnSpy).toHaveBeenLastCalledWith('[Sentry] FeedbackButton requires \'Sentry.wrap(RootComponent)\' to be called before \'showFeedbackButton()\'.'); + expect(consoleWarnSpy).toHaveBeenLastCalledWith( + "[Sentry] FeedbackButton requires 'Sentry.wrap(RootComponent)' to be called before 'showFeedbackButton()'.", + ); }); it('showFeedbackButton does not warn about missing feedback provider when FeedbackWidgetProvider is used', () => { render( App Components - + , ); showFeedbackButton(); @@ -245,7 +257,7 @@ describe('FeedbackButtonManager', () => { const { toJSON } = render( App Components - + , ); jest.spyOn(Appearance, 'getColorScheme').mockReturnValue('light'); @@ -262,7 +274,7 @@ describe('FeedbackButtonManager', () => { const { toJSON } = render( App Components - + , ); jest.spyOn(Appearance, 'getColorScheme').mockReturnValue('dark'); @@ -293,7 +305,7 @@ describe('FeedbackButtonManager', () => { jest.spyOn(Appearance, 'getColorScheme').mockReturnValue('dark'); await act(async () => { listener({ colorScheme: 'dark' }); - }) + }); expect(toJSON()).toMatchSnapshot(); }); @@ -303,7 +315,7 @@ describe('FeedbackButtonManager', () => { const { toJSON } = render( App Components - + , ); const integration = feedbackIntegration({ @@ -327,7 +339,7 @@ describe('FeedbackButtonManager', () => { const { toJSON } = render( App Components - + , ); const integration = feedbackIntegration({ @@ -351,7 +363,7 @@ describe('FeedbackButtonManager', () => { const { toJSON } = render( App Components - + , ); const integration = feedbackIntegration({ @@ -377,7 +389,7 @@ describe('FeedbackButtonManager', () => { const { toJSON } = render( App Components - + , ); const integration = feedbackIntegration({ @@ -403,14 +415,14 @@ describe('FeedbackButtonManager', () => { const { toJSON } = render( App Components - + , ); jest.spyOn(Appearance, 'getColorScheme').mockReturnValue('light'); await act(async () => { showFeedbackButton(); - }) + }); expect(toJSON()).toMatchSnapshot(); }); @@ -420,7 +432,7 @@ describe('FeedbackButtonManager', () => { const { toJSON } = render( App Components - + , ); jest.spyOn(Appearance, 'getColorScheme').mockReturnValue('dark'); @@ -461,7 +473,7 @@ describe('FeedbackButtonManager', () => { const { toJSON } = render( App Components - + , ); const integration = feedbackIntegration({ @@ -485,7 +497,7 @@ describe('FeedbackButtonManager', () => { const { toJSON } = render( App Components - + , ); const integration = feedbackIntegration({ @@ -509,7 +521,7 @@ describe('FeedbackButtonManager', () => { const { toJSON } = render( App Components - + , ); const integration = feedbackIntegration({ @@ -535,7 +547,7 @@ describe('FeedbackButtonManager', () => { const { toJSON } = render( App Components - + , ); const integration = feedbackIntegration({ diff --git a/packages/core/test/feedback/ScreenshotButton.test.tsx b/packages/core/test/feedback/ScreenshotButton.test.tsx index e23fc1323c..906663c61f 100644 --- a/packages/core/test/feedback/ScreenshotButton.test.tsx +++ b/packages/core/test/feedback/ScreenshotButton.test.tsx @@ -2,14 +2,21 @@ import { getClient, setCurrentClient } from '@sentry/core'; import { fireEvent, render, waitFor } from '@testing-library/react-native'; import * as React from 'react'; import { Alert, Text } from 'react-native'; -import { FeedbackWidget } from '../../src/js/feedback/FeedbackWidget'; + import type { ScreenshotButtonProps, ScreenshotButtonStyles } from '../../src/js/feedback/FeedbackWidget.types'; -import { resetFeedbackButtonManager, resetFeedbackWidgetManager, resetScreenshotButtonManager, showFeedbackButton } from '../../src/js/feedback/FeedbackWidgetManager'; +import type { Screenshot } from '../../src/js/wrapper'; + +import { FeedbackWidget } from '../../src/js/feedback/FeedbackWidget'; +import { + resetFeedbackButtonManager, + resetFeedbackWidgetManager, + resetScreenshotButtonManager, + showFeedbackButton, +} from '../../src/js/feedback/FeedbackWidgetManager'; import { FeedbackWidgetProvider } from '../../src/js/feedback/FeedbackWidgetProvider'; import { feedbackIntegration } from '../../src/js/feedback/integration'; import { getCapturedScreenshot, ScreenshotButton } from '../../src/js/feedback/ScreenshotButton'; -import type { Screenshot } from '../../src/js/wrapper'; -import { NATIVE } from '../../src/js/wrapper'; +import { NATIVE } from '../../src/js/wrapper'; import { getDefaultTestClientOptions, TestClient } from '../mocks/client'; jest.mock('../../src/js/wrapper', () => ({ @@ -46,7 +53,7 @@ describe('ScreenshotButton', () => { }); it('matches the snapshot with default configuration', () => { - const { toJSON } = render(); + const { toJSON } = render(); expect(toJSON()).toMatchSnapshot(); }); @@ -54,7 +61,7 @@ describe('ScreenshotButton', () => { const defaultProps: ScreenshotButtonProps = { triggerLabel: 'Take Screenshot', }; - const { toJSON } = render(); + const { toJSON } = render(); expect(toJSON()).toMatchSnapshot(); }); @@ -67,8 +74,8 @@ describe('ScreenshotButton', () => { color: '#ff0000', }, }; - const customStyleProps = {styles: customStyles}; - const { toJSON } = render(); + const customStyleProps = { styles: customStyles }; + const { toJSON } = render(); expect(toJSON()).toMatchSnapshot(); }); @@ -76,7 +83,7 @@ describe('ScreenshotButton', () => { const { getByText } = render( App Components - + , ); const integration = feedbackIntegration({ @@ -91,12 +98,11 @@ describe('ScreenshotButton', () => { expect(takeScreenshotButton).toBeTruthy(); }); - it('the capture screenshot button is shown when tapping the Take a screenshot button in the feedback widget', async () => { const { getByText } = render( App Components - + , ); const integration = feedbackIntegration({ @@ -122,7 +128,7 @@ describe('ScreenshotButton', () => { const { getByText } = render( App Components - + , ); const integration = feedbackIntegration({ @@ -154,7 +160,7 @@ describe('ScreenshotButton', () => { const { getByText, queryByText } = render( App Components - + , ); const integration = feedbackIntegration({ @@ -187,7 +193,7 @@ describe('ScreenshotButton', () => { const takeScreenshotButtonAfterCapture = queryByText('Take a screenshot'); expect(takeScreenshotButtonAfterCapture).toBeNull(); }); - + await waitFor(() => { const removeScreenshotButtonAfterCapture = queryByText('Remove screenshot'); expect(removeScreenshotButtonAfterCapture).toBeTruthy(); @@ -200,7 +206,7 @@ describe('ScreenshotButton', () => { const { getByText } = render( App Components - + , ); const integration = feedbackIntegration({ diff --git a/packages/core/test/feedback/ShakeToReportBug.test.tsx b/packages/core/test/feedback/ShakeToReportBug.test.tsx index 3b85c17960..7d03b43ee9 100644 --- a/packages/core/test/feedback/ShakeToReportBug.test.tsx +++ b/packages/core/test/feedback/ShakeToReportBug.test.tsx @@ -2,9 +2,8 @@ import { debug, setCurrentClient } from '@sentry/core'; import { render } from '@testing-library/react-native'; import * as React from 'react'; import { Text } from 'react-native'; -import { - resetFeedbackWidgetManager, -} from '../../src/js/feedback/FeedbackWidgetManager'; + +import { resetFeedbackWidgetManager } from '../../src/js/feedback/FeedbackWidgetManager'; import { FeedbackWidgetProvider } from '../../src/js/feedback/FeedbackWidgetProvider'; import { feedbackIntegration } from '../../src/js/feedback/integration'; import { isShakeListenerActive, startShakeListener, stopShakeListener } from '../../src/js/feedback/ShakeToReportBug'; diff --git a/packages/core/test/integrations/appRegistry.test.ts b/packages/core/test/integrations/appRegistry.test.ts index 44e7d6a3b8..535616c378 100644 --- a/packages/core/test/integrations/appRegistry.test.ts +++ b/packages/core/test/integrations/appRegistry.test.ts @@ -1,4 +1,5 @@ import { getOriginalFunction } from '@sentry/core'; + import { appRegistryIntegration } from '../../src/js/integrations/appRegistry'; import * as Environment from '../../src/js/utils/environment'; import { ReactNativeLibraries } from '../../src/js/utils/rnlibraries'; diff --git a/packages/core/test/integrations/breadcrumbs.test.ts b/packages/core/test/integrations/breadcrumbs.test.ts index e7105667fe..3053726603 100644 --- a/packages/core/test/integrations/breadcrumbs.test.ts +++ b/packages/core/test/integrations/breadcrumbs.test.ts @@ -1,4 +1,5 @@ import { breadcrumbsIntegration as browserBreadcrumbsIntegration } from '@sentry/browser'; + import { breadcrumbsIntegration } from '../../src/js/integrations/breadcrumbs'; import * as environment from '../../src/js/utils/environment'; diff --git a/packages/core/test/integrations/debugsymbolicator.test.ts b/packages/core/test/integrations/debugsymbolicator.test.ts index 265780d01f..69bf49e8e1 100644 --- a/packages/core/test/integrations/debugsymbolicator.test.ts +++ b/packages/core/test/integrations/debugsymbolicator.test.ts @@ -1,4 +1,7 @@ import type { Client, Event, EventHint, StackFrame } from '@sentry/core'; + +import type * as ReactNative from '../../src/js/vendor/react-native'; + import { debugSymbolicatorIntegration } from '../../src/js/integrations/debugsymbolicator'; import { fetchSourceContext, @@ -6,7 +9,6 @@ import { parseErrorStack, symbolicateStackTrace, } from '../../src/js/integrations/debugsymbolicatorutils'; -import type * as ReactNative from '../../src/js/vendor/react-native'; jest.mock('../../src/js/integrations/debugsymbolicatorutils'); diff --git a/packages/core/test/integrations/defaultLogs.test.ts b/packages/core/test/integrations/defaultLogs.test.ts index ba460e266a..23c2ad552b 100644 --- a/packages/core/test/integrations/defaultLogs.test.ts +++ b/packages/core/test/integrations/defaultLogs.test.ts @@ -1,8 +1,11 @@ -import { consoleLoggingIntegration } from '@sentry/browser'; import type { Integration } from '@sentry/core'; + +import { consoleLoggingIntegration } from '@sentry/browser'; + +import type { ReactNativeClientOptions } from '../../src/js/options'; + import { getDefaultIntegrations } from '../../src/js/integrations/default'; import { logEnricherIntegration } from '../../src/js/integrations/logEnricherIntegration'; -import type { ReactNativeClientOptions } from '../../src/js/options'; import { notWeb } from '../../src/js/utils/environment'; jest.mock('../../src/js/utils/environment', () => { diff --git a/packages/core/test/integrations/defaultSpotlight.test.ts b/packages/core/test/integrations/defaultSpotlight.test.ts index 4f13a16263..f50b0ede6b 100644 --- a/packages/core/test/integrations/defaultSpotlight.test.ts +++ b/packages/core/test/integrations/defaultSpotlight.test.ts @@ -1,7 +1,9 @@ import type { Integration } from '@sentry/core'; + +import type { ReactNativeClientOptions } from '../../src/js/options'; + import { getDefaultIntegrations } from '../../src/js/integrations/default'; import { spotlightIntegration } from '../../src/js/integrations/spotlight'; -import type { ReactNativeClientOptions } from '../../src/js/options'; import { notWeb } from '../../src/js/utils/environment'; jest.mock('../../src/js/utils/environment', () => { diff --git a/packages/core/test/integrations/devicecontext.test.ts b/packages/core/test/integrations/devicecontext.test.ts index 2689582ee4..bf0072fce3 100644 --- a/packages/core/test/integrations/devicecontext.test.ts +++ b/packages/core/test/integrations/devicecontext.test.ts @@ -1,6 +1,8 @@ import type { Client, Event, EventHint, SeverityLevel } from '@sentry/core'; -import { deviceContextIntegration } from '../../src/js/integrations/devicecontext'; + import type { NativeDeviceContextsResponse } from '../../src/js/NativeRNSentry'; + +import { deviceContextIntegration } from '../../src/js/integrations/devicecontext'; import { NATIVE } from '../../src/js/wrapper'; let mockCurrentAppState: string = 'unknown'; diff --git a/packages/core/test/integrations/eventorigin.test.ts b/packages/core/test/integrations/eventorigin.test.ts index 3b5ed14c1c..dd3e0cbd91 100644 --- a/packages/core/test/integrations/eventorigin.test.ts +++ b/packages/core/test/integrations/eventorigin.test.ts @@ -1,4 +1,5 @@ import type { Client } from '@sentry/core'; + import { eventOriginIntegration } from '../../src/js/integrations/eventorigin'; describe('Event Origin', () => { diff --git a/packages/core/test/integrations/expoconstants.test.ts b/packages/core/test/integrations/expoconstants.test.ts index ed4604d159..72328e64a7 100644 --- a/packages/core/test/integrations/expoconstants.test.ts +++ b/packages/core/test/integrations/expoconstants.test.ts @@ -1,11 +1,13 @@ import type { Client, Event } from '@sentry/core'; + +import type { ExpoConstants } from '../../src/js/utils/expoglobalobject'; + import { EXPO_CONSTANTS_CONTEXT_KEY, expoConstantsIntegration, getExpoConstantsContext, } from '../../src/js/integrations/expoconstants'; import * as environment from '../../src/js/utils/environment'; -import type { ExpoConstants } from '../../src/js/utils/expoglobalobject'; import * as expoModules from '../../src/js/utils/expomodules'; jest.mock('../../src/js/utils/expomodules'); diff --git a/packages/core/test/integrations/expocontext.test.ts b/packages/core/test/integrations/expocontext.test.ts index faf4c35bb2..e12fa55aee 100644 --- a/packages/core/test/integrations/expocontext.test.ts +++ b/packages/core/test/integrations/expocontext.test.ts @@ -1,11 +1,13 @@ import { type Client, type Event, getCurrentScope, getGlobalScope, getIsolationScope } from '@sentry/core'; + +import type { ExpoUpdates } from '../../src/js/utils/expoglobalobject'; + import { expoContextIntegration, getExpoUpdatesContext, OTA_UPDATES_CONTEXT_KEY, } from '../../src/js/integrations/expocontext'; import * as environment from '../../src/js/utils/environment'; -import type { ExpoUpdates } from '../../src/js/utils/expoglobalobject'; import { getExpoDevice } from '../../src/js/utils/expomodules'; import * as expoModules from '../../src/js/utils/expomodules'; import { setupTestClient, TestClient } from '../mocks/client'; diff --git a/packages/core/test/integrations/expoupdateslistener.test.ts b/packages/core/test/integrations/expoupdateslistener.test.ts index 05f9233fb2..03863f93ac 100644 --- a/packages/core/test/integrations/expoupdateslistener.test.ts +++ b/packages/core/test/integrations/expoupdateslistener.test.ts @@ -1,4 +1,5 @@ import { addBreadcrumb, getCurrentScope, getGlobalScope, getIsolationScope } from '@sentry/core'; + import { expoUpdatesListenerIntegration, handleStateChange } from '../../src/js/integrations/expoupdateslistener'; import * as environment from '../../src/js/utils/environment'; import { setupTestClient } from '../mocks/client'; diff --git a/packages/core/test/integrations/graphql.test.ts b/packages/core/test/integrations/graphql.test.ts index 1fc4890452..f212b785d9 100644 --- a/packages/core/test/integrations/graphql.test.ts +++ b/packages/core/test/integrations/graphql.test.ts @@ -1,4 +1,5 @@ import { graphqlClientIntegration as browserGraphqlClientIntegration } from '@sentry/browser'; + import { graphqlIntegration } from '../../src/js'; jest.mock('@sentry/browser', () => ({ diff --git a/packages/core/test/integrations/integrationsexecutionorder.test.ts b/packages/core/test/integrations/integrationsexecutionorder.test.ts index 09c1f3fb65..df04a9327c 100644 --- a/packages/core/test/integrations/integrationsexecutionorder.test.ts +++ b/packages/core/test/integrations/integrationsexecutionorder.test.ts @@ -3,11 +3,14 @@ import * as mockWrapper from '../mockWrapper'; jest.mock('../../src/js/wrapper', () => mockWrapper); jest.mock('../../src/js/utils/environment'); -import { defaultStackParser } from '@sentry/browser'; import type { Integration } from '@sentry/core'; + +import { defaultStackParser } from '@sentry/browser'; + +import type { ReactNativeClientOptions } from '../../src/js/options'; + import { ReactNativeClient } from '../../src/js/client'; import { getDefaultIntegrations } from '../../src/js/integrations/default'; -import type { ReactNativeClientOptions } from '../../src/js/options'; import { isHermesEnabled, notWeb } from '../../src/js/utils/environment'; import { MOCK_DSN } from '../mockDsn'; diff --git a/packages/core/test/integrations/logEnricherIntegration.test.ts b/packages/core/test/integrations/logEnricherIntegration.test.ts index 12a6971857..c1480f9aa8 100644 --- a/packages/core/test/integrations/logEnricherIntegration.test.ts +++ b/packages/core/test/integrations/logEnricherIntegration.test.ts @@ -1,7 +1,10 @@ import type { Client, Log } from '@sentry/core'; + import { debug, getCurrentScope, getGlobalScope, getIsolationScope } from '@sentry/core'; -import { logEnricherIntegration } from '../../src/js/integrations/logEnricherIntegration'; + import type { NativeDeviceContextsResponse } from '../../src/js/NativeRNSentry'; + +import { logEnricherIntegration } from '../../src/js/integrations/logEnricherIntegration'; import { NATIVE } from '../../src/js/wrapper'; // Mock the NATIVE wrapper diff --git a/packages/core/test/integrations/modulesloader.test.ts b/packages/core/test/integrations/modulesloader.test.ts index 50b99e66b3..c6fb43bb2f 100644 --- a/packages/core/test/integrations/modulesloader.test.ts +++ b/packages/core/test/integrations/modulesloader.test.ts @@ -1,4 +1,5 @@ import type { Client, Event, EventHint } from '@sentry/core'; + import { modulesLoaderIntegration } from '../../src/js/integrations/modulesloader'; import { NATIVE } from '../../src/js/wrapper'; diff --git a/packages/core/test/integrations/nativelinkederrors.test.ts b/packages/core/test/integrations/nativelinkederrors.test.ts index 233686ebab..3297e79515 100644 --- a/packages/core/test/integrations/nativelinkederrors.test.ts +++ b/packages/core/test/integrations/nativelinkederrors.test.ts @@ -1,7 +1,10 @@ -import { defaultStackParser } from '@sentry/browser'; import type { Client, DebugImage, Event, EventHint, ExtendedError } from '@sentry/core'; -import { nativeLinkedErrorsIntegration } from '../../src/js/integrations/nativelinkederrors'; + +import { defaultStackParser } from '@sentry/browser'; + import type { NativeStackFrames } from '../../src/js/NativeRNSentry'; + +import { nativeLinkedErrorsIntegration } from '../../src/js/integrations/nativelinkederrors'; import { NATIVE } from '../../src/js/wrapper'; jest.mock('../../src/js/wrapper'); diff --git a/packages/core/test/integrations/primitiveTagIntegration.test.ts b/packages/core/test/integrations/primitiveTagIntegration.test.ts index e77a9aacd8..c51044900b 100644 --- a/packages/core/test/integrations/primitiveTagIntegration.test.ts +++ b/packages/core/test/integrations/primitiveTagIntegration.test.ts @@ -1,4 +1,5 @@ import type { Client } from '@sentry/core'; + import { primitiveTagIntegration } from '../../src/js/integrations/primitiveTagIntegration'; import { NATIVE } from '../../src/js/wrapper'; import { setupTestClient } from '../mocks/client'; diff --git a/packages/core/test/integrations/reactnativeerrorhandlers.test.ts b/packages/core/test/integrations/reactnativeerrorhandlers.test.ts index db5a8867f8..9ab4d7dfe7 100644 --- a/packages/core/test/integrations/reactnativeerrorhandlers.test.ts +++ b/packages/core/test/integrations/reactnativeerrorhandlers.test.ts @@ -2,7 +2,9 @@ jest.mock('../../src/js/integrations/reactnativeerrorhandlersutils'); jest.mock('../../src/js/utils/environment'); import type { SeverityLevel } from '@sentry/core'; + import { addGlobalUnhandledRejectionInstrumentationHandler, captureException, setCurrentClient } from '@sentry/core'; + import { reactNativeErrorHandlersIntegration } from '../../src/js/integrations/reactnativeerrorhandlers'; import { checkPromiseAndWarn, diff --git a/packages/core/test/integrations/reactnativeinfo.test.ts b/packages/core/test/integrations/reactnativeinfo.test.ts index 03bd75c8e9..78b1a540e7 100644 --- a/packages/core/test/integrations/reactnativeinfo.test.ts +++ b/packages/core/test/integrations/reactnativeinfo.test.ts @@ -1,6 +1,8 @@ import type { Client, Event, EventHint } from '@sentry/core'; + import type { ReactNativeError } from '../../src/js/integrations/debugsymbolicator'; import type { ReactNativeContext } from '../../src/js/integrations/reactnativeinfo'; + import { reactNativeInfoIntegration } from '../../src/js/integrations/reactnativeinfo'; let mockedIsHermesEnabled: jest.Mock; diff --git a/packages/core/test/integrations/release.test.ts b/packages/core/test/integrations/release.test.ts index 6a282f7d9b..be3a4f1b10 100644 --- a/packages/core/test/integrations/release.test.ts +++ b/packages/core/test/integrations/release.test.ts @@ -1,4 +1,5 @@ import type { Client } from '@sentry/core'; + import { nativeReleaseIntegration } from '../../src/js/integrations/release'; jest.mock('../../src/js/wrapper', () => ({ diff --git a/packages/core/test/integrations/rewriteframes.test.ts b/packages/core/test/integrations/rewriteframes.test.ts index 9230583513..6bc9825328 100644 --- a/packages/core/test/integrations/rewriteframes.test.ts +++ b/packages/core/test/integrations/rewriteframes.test.ts @@ -1,7 +1,9 @@ import type { Exception } from '@sentry/browser'; -import { defaultStackParser, eventFromException } from '@sentry/browser'; import type { Client, Event, EventHint } from '@sentry/core'; + +import { defaultStackParser, eventFromException } from '@sentry/browser'; import { Platform } from 'react-native'; + import { createReactNativeRewriteFrames } from '../../src/js/integrations/rewriteframes'; import { isExpo, isHermesEnabled } from '../../src/js/utils/environment'; import { mockFunction } from '../testutils'; diff --git a/packages/core/test/integrations/sdkinfo.test.ts b/packages/core/test/integrations/sdkinfo.test.ts index 8fd8bf43c6..fca38565b3 100644 --- a/packages/core/test/integrations/sdkinfo.test.ts +++ b/packages/core/test/integrations/sdkinfo.test.ts @@ -1,4 +1,5 @@ import type { Event, EventHint, Package } from '@sentry/core'; + import { SDK_NAME, SDK_VERSION } from '../../src/js'; import { sdkInfoIntegration } from '../../src/js/integrations/sdkinfo'; import { NATIVE } from '../../src/js/wrapper'; diff --git a/packages/core/test/integrations/spotlight.test.ts b/packages/core/test/integrations/spotlight.test.ts index d65f2c4385..8bcef972ad 100644 --- a/packages/core/test/integrations/spotlight.test.ts +++ b/packages/core/test/integrations/spotlight.test.ts @@ -1,6 +1,8 @@ import type { HttpRequestEventMap } from '@mswjs/interceptors'; -import { XMLHttpRequestInterceptor } from '@mswjs/interceptors/XMLHttpRequest'; import type { Client, Envelope } from '@sentry/core'; + +import { XMLHttpRequestInterceptor } from '@mswjs/interceptors/XMLHttpRequest'; + import { spotlightIntegration } from '../../src/js/integrations/spotlight'; globalThis.XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; diff --git a/packages/core/test/integrations/supabase.test.ts b/packages/core/test/integrations/supabase.test.ts index c502fdf3a8..4c130b2abd 100644 --- a/packages/core/test/integrations/supabase.test.ts +++ b/packages/core/test/integrations/supabase.test.ts @@ -1,4 +1,5 @@ import { supabaseIntegration as browserSupabaseIntegration } from '@sentry/browser'; + import { supabaseIntegration } from '../../src/js'; jest.mock('@sentry/browser', () => ({ diff --git a/packages/core/test/integrations/viewhierarchy.test.ts b/packages/core/test/integrations/viewhierarchy.test.ts index 574220d9c3..69020ce8ac 100644 --- a/packages/core/test/integrations/viewhierarchy.test.ts +++ b/packages/core/test/integrations/viewhierarchy.test.ts @@ -1,4 +1,5 @@ import type { Client, Event, EventHint } from '@sentry/core'; + import { viewHierarchyIntegration } from '../../src/js/integrations/viewhierarchy'; import { NATIVE } from '../../src/js/wrapper'; diff --git a/packages/core/test/metrics.test.ts b/packages/core/test/metrics.test.ts index bfa17aa624..e14ef503e8 100644 --- a/packages/core/test/metrics.test.ts +++ b/packages/core/test/metrics.test.ts @@ -1,4 +1,5 @@ import { getClient, metrics, setCurrentClient } from '@sentry/core'; + import { ReactNativeClient } from '../src/js'; import { mobileReplayIntegration } from '../src/js/replay/mobilereplay'; import { getDefaultTestClientOptions } from './mocks/client'; diff --git a/packages/core/test/mockWrapper.ts b/packages/core/test/mockWrapper.ts index 89c7486575..7a279cdf37 100644 --- a/packages/core/test/mockWrapper.ts +++ b/packages/core/test/mockWrapper.ts @@ -1,6 +1,7 @@ -import { type NATIVE as ORIGINAL_NATIVE } from '../src/js/wrapper'; import type { MockInterface } from './testutils'; +import { type NATIVE as ORIGINAL_NATIVE } from '../src/js/wrapper'; + type NativeType = typeof ORIGINAL_NATIVE; const NATIVE: MockInterface = { diff --git a/packages/core/test/mocks/client.ts b/packages/core/test/mocks/client.ts index bd73cf2d6c..8595bea471 100644 --- a/packages/core/test/mocks/client.ts +++ b/packages/core/test/mocks/client.ts @@ -1,4 +1,5 @@ import type { Event, EventHint, Integration, Outcome, ParameterizedString, Session, SeverityLevel } from '@sentry/core'; + import { Client, createTransport, @@ -9,6 +10,7 @@ import { resolvedSyncPromise, setCurrentClient, } from '@sentry/core'; + import type { ReactNativeClientOptions } from '../../src/js/options'; export function getDefaultTestClientOptions(options: Partial = {}): TestClientOptions { diff --git a/packages/core/test/playground/modal.test.tsx b/packages/core/test/playground/modal.test.tsx index 4d1fd9198b..29aab1b945 100644 --- a/packages/core/test/playground/modal.test.tsx +++ b/packages/core/test/playground/modal.test.tsx @@ -1,5 +1,6 @@ import { render } from '@testing-library/react-native'; import * as React from 'react'; + import { SentryPlayground } from '../../src/js/playground/modal'; describe('PlaygroundComponent', () => { diff --git a/packages/core/test/profiling.test.ts b/packages/core/test/profiling.test.ts index 8e16df0899..d8d47a0461 100644 --- a/packages/core/test/profiling.test.ts +++ b/packages/core/test/profiling.test.ts @@ -1,5 +1,6 @@ import type { Spec } from '../src/js/NativeRNSentry'; import type { ReactNativeClientOptions } from '../src/js/options'; + import { NATIVE } from '../src/js/wrapper'; jest.mock('react-native', () => { diff --git a/packages/core/test/profiling/convertHermesProfile.test.ts b/packages/core/test/profiling/convertHermesProfile.test.ts index 569f6778fd..fc12aa42f7 100644 --- a/packages/core/test/profiling/convertHermesProfile.test.ts +++ b/packages/core/test/profiling/convertHermesProfile.test.ts @@ -1,8 +1,10 @@ import type { ThreadCpuSample } from '@sentry/core'; -import { convertToSentryProfile, mapSamples } from '../../src/js/profiling/convertHermesProfile'; + import type * as Hermes from '../../src/js/profiling/hermes'; import type { RawThreadCpuProfile } from '../../src/js/profiling/types'; +import { convertToSentryProfile, mapSamples } from '../../src/js/profiling/convertHermesProfile'; + describe('convert hermes profile to sentry profile', () => { it('simple test profile', async () => { const hermesProfile: Hermes.Profile = { diff --git a/packages/core/test/profiling/hermes.test.ts b/packages/core/test/profiling/hermes.test.ts index f2c8d64a9c..21255b95ff 100644 --- a/packages/core/test/profiling/hermes.test.ts +++ b/packages/core/test/profiling/hermes.test.ts @@ -1,4 +1,5 @@ import type { ThreadCpuFrame } from '@sentry/core'; + import { parseHermesJSStackFrame } from '../../src/js/profiling/convertHermesProfile'; describe('hermes', () => { diff --git a/packages/core/test/profiling/integration.android.test.ts b/packages/core/test/profiling/integration.android.test.ts index cb49271090..eb5d324a60 100644 --- a/packages/core/test/profiling/integration.android.test.ts +++ b/packages/core/test/profiling/integration.android.test.ts @@ -1,5 +1,6 @@ -import { createAndroidWithHermesProfile } from '../../src/js/profiling/integration'; import type { AndroidCombinedProfileEvent } from '../../src/js/profiling/types'; + +import { createAndroidWithHermesProfile } from '../../src/js/profiling/integration'; import { createMockMinimalValidAndroidProfile, createMockMinimalValidHermesProfileEvent } from './fixtures'; describe('merge Hermes and Android profiles - createAndroidWithHermesProfile', () => { diff --git a/packages/core/test/profiling/integration.ios.test.ts b/packages/core/test/profiling/integration.ios.test.ts index 3302930e12..990f079b59 100644 --- a/packages/core/test/profiling/integration.ios.test.ts +++ b/packages/core/test/profiling/integration.ios.test.ts @@ -1,5 +1,6 @@ -import { addNativeProfileToHermesProfile } from '../../src/js/profiling/integration'; import type { CombinedProfileEvent } from '../../src/js/profiling/types'; + +import { addNativeProfileToHermesProfile } from '../../src/js/profiling/integration'; import { createMockMinimalValidAppleProfile, createMockMinimalValidHermesProfileEvent } from './fixtures'; describe('merge Hermes and Native profiles - addNativeProfileToHermesProfile', () => { diff --git a/packages/core/test/profiling/integration.test.ts b/packages/core/test/profiling/integration.test.ts index e0a4b393a6..0d34836d2e 100644 --- a/packages/core/test/profiling/integration.test.ts +++ b/packages/core/test/profiling/integration.test.ts @@ -5,12 +5,15 @@ jest.mock('../../src/js/utils/environment'); jest.mock('../../src/js/profiling/debugid'); import type { Envelope, Event, Integration, Profile, Span, ThreadCpuProfile, Transport } from '@sentry/core'; + import { getClient, spanToJSON } from '@sentry/core'; + +import type { HermesProfilingOptions } from '../../src/js/profiling/integration'; +import type { AndroidProfileEvent } from '../../src/js/profiling/types'; + import * as Sentry from '../../src/js'; import { getDebugMetadata } from '../../src/js/profiling/debugid'; -import type { HermesProfilingOptions } from '../../src/js/profiling/integration'; import { hermesProfilingIntegration } from '../../src/js/profiling/integration'; -import type { AndroidProfileEvent } from '../../src/js/profiling/types'; import { getDefaultEnvironment, isHermesEnabled, notWeb } from '../../src/js/utils/environment'; import { MOCK_DSN } from '../mockDsn'; import { envelopeItemPayload, envelopeItems } from '../testutils'; diff --git a/packages/core/test/profiling/integrationmerge.test.ts b/packages/core/test/profiling/integrationmerge.test.ts index 3302930e12..990f079b59 100644 --- a/packages/core/test/profiling/integrationmerge.test.ts +++ b/packages/core/test/profiling/integrationmerge.test.ts @@ -1,5 +1,6 @@ -import { addNativeProfileToHermesProfile } from '../../src/js/profiling/integration'; import type { CombinedProfileEvent } from '../../src/js/profiling/types'; + +import { addNativeProfileToHermesProfile } from '../../src/js/profiling/integration'; import { createMockMinimalValidAppleProfile, createMockMinimalValidHermesProfileEvent } from './fixtures'; describe('merge Hermes and Native profiles - addNativeProfileToHermesProfile', () => { diff --git a/packages/core/test/replay/browserReplay.test.ts b/packages/core/test/replay/browserReplay.test.ts index 7914c08f62..be12c27e21 100644 --- a/packages/core/test/replay/browserReplay.test.ts +++ b/packages/core/test/replay/browserReplay.test.ts @@ -1,6 +1,7 @@ import { describe, test } from '@jest/globals'; import * as SentryReact from '@sentry/react'; import { spyOn } from 'jest-mock'; + import { browserReplayIntegration } from '../../src/js/replay/browserReplay'; import * as environment from '../../src/js/utils/environment'; diff --git a/packages/core/test/replay/mobilereplay.test.ts b/packages/core/test/replay/mobilereplay.test.ts index f007d6a34b..c736db9c04 100644 --- a/packages/core/test/replay/mobilereplay.test.ts +++ b/packages/core/test/replay/mobilereplay.test.ts @@ -1,5 +1,7 @@ -import { afterEach, beforeEach, describe, expect, it, jest } from '@jest/globals'; import type { Client, DynamicSamplingContext, ErrorEvent, Event, EventHint } from '@sentry/core'; + +import { afterEach, beforeEach, describe, expect, it, jest } from '@jest/globals'; + import { mobileReplayIntegration } from '../../src/js/replay/mobilereplay'; import * as environment from '../../src/js/utils/environment'; import { NATIVE } from '../../src/js/wrapper'; diff --git a/packages/core/test/replay/xhrUtils.test.ts b/packages/core/test/replay/xhrUtils.test.ts index f348875dc7..477e8bc661 100644 --- a/packages/core/test/replay/xhrUtils.test.ts +++ b/packages/core/test/replay/xhrUtils.test.ts @@ -1,4 +1,5 @@ import type { Breadcrumb } from '@sentry/core'; + import { enrichXhrBreadcrumbsForMobileReplay } from '../../src/js/replay/xhrUtils'; describe('xhrUtils', () => { diff --git a/packages/core/test/scopeSync.test.ts b/packages/core/test/scopeSync.test.ts index c1da1841ba..fc6f8f354f 100644 --- a/packages/core/test/scopeSync.test.ts +++ b/packages/core/test/scopeSync.test.ts @@ -1,6 +1,8 @@ import type { Breadcrumb } from '@sentry/core'; + import * as SentryCore from '@sentry/core'; import { Scope } from '@sentry/core'; + import { enableSyncToNative } from '../src/js/scopeSync'; import { getDefaultTestClientOptions, TestClient } from './mocks/client'; diff --git a/packages/core/test/sdk.test.ts b/packages/core/test/sdk.test.ts index 6b56df4cb4..dc42f10169 100644 --- a/packages/core/test/sdk.test.ts +++ b/packages/core/test/sdk.test.ts @@ -1,10 +1,13 @@ import type { Breadcrumb, BreadcrumbHint, Integration, Scope } from '@sentry/core'; + import { debug, initAndBind } from '@sentry/core'; import { makeFetchTransport } from '@sentry/react'; -import { getDevServer } from '../src/js/integrations/debugsymbolicatorutils'; + import type { ReactNativeClientOptions } from '../src/js/options'; -import { init, withScope } from '../src/js/sdk'; import type { ReactNativeTracingIntegration } from '../src/js/tracing'; + +import { getDevServer } from '../src/js/integrations/debugsymbolicatorutils'; +import { init, withScope } from '../src/js/sdk'; import { REACT_NATIVE_TRACING_INTEGRATION_NAME, reactNativeTracingIntegration } from '../src/js/tracing'; import { makeNativeTransport } from '../src/js/transports/native'; import { getDefaultEnvironment, isExpoGo, notWeb } from '../src/js/utils/environment'; diff --git a/packages/core/test/sdk.withclient.test.ts b/packages/core/test/sdk.withclient.test.ts index f788717e73..fb25050885 100644 --- a/packages/core/test/sdk.withclient.test.ts +++ b/packages/core/test/sdk.withclient.test.ts @@ -1,4 +1,5 @@ import { debug, setCurrentClient } from '@sentry/core'; + import { crashedLastRun, flush } from '../src/js/sdk'; import { getDefaultTestClientOptions, TestClient } from './mocks/client'; import { NATIVE } from './mockWrapper'; diff --git a/packages/core/test/testutils.ts b/packages/core/test/testutils.ts index 64f1f321f1..dc7eda9864 100644 --- a/packages/core/test/testutils.ts +++ b/packages/core/test/testutils.ts @@ -1,4 +1,5 @@ import type { Session, Transport, UserFeedback } from '@sentry/core'; + import { rejectedSyncPromise } from '@sentry/core'; export type MockInterface = { diff --git a/packages/core/test/tools/metroMiddleware.test.ts b/packages/core/test/tools/metroMiddleware.test.ts index a12421e99f..c8bdb9e1d5 100644 --- a/packages/core/test/tools/metroMiddleware.test.ts +++ b/packages/core/test/tools/metroMiddleware.test.ts @@ -1,6 +1,8 @@ -import { afterEach, beforeEach, describe, expect, it, jest } from '@jest/globals'; import type { StackFrame } from '@sentry/core'; + +import { afterEach, beforeEach, describe, expect, it, jest } from '@jest/globals'; import * as fs from 'fs'; + import * as metroMiddleware from '../../src/js/tools/metroMiddleware'; const { withSentryMiddleware, createSentryMetroMiddleware, stackFramesContextMiddleware } = metroMiddleware; diff --git a/packages/core/test/tools/metroconfig.test.ts b/packages/core/test/tools/metroconfig.test.ts index 2136824854..b9b86207f6 100644 --- a/packages/core/test/tools/metroconfig.test.ts +++ b/packages/core/test/tools/metroconfig.test.ts @@ -1,7 +1,10 @@ import type { getDefaultConfig } from 'expo/metro-config'; import type { MetroConfig } from 'metro'; + import * as process from 'process'; + import type { SentryExpoConfigOptions } from '../../src/js/tools/metroconfig'; + import { getSentryExpoConfig, withSentryBabelTransformer, diff --git a/packages/core/test/tools/sentryBabelTransformer.test.ts b/packages/core/test/tools/sentryBabelTransformer.test.ts index 7e60c2259e..4dc4195db5 100644 --- a/packages/core/test/tools/sentryBabelTransformer.test.ts +++ b/packages/core/test/tools/sentryBabelTransformer.test.ts @@ -1,4 +1,5 @@ import * as process from 'process'; + import { createSentryBabelTransformer, SENTRY_BABEL_TRANSFORMER_OPTIONS, diff --git a/packages/core/test/tools/sentryMetroSerializer.test.ts b/packages/core/test/tools/sentryMetroSerializer.test.ts index 7dc0baefcb..104b230e12 100644 --- a/packages/core/test/tools/sentryMetroSerializer.test.ts +++ b/packages/core/test/tools/sentryMetroSerializer.test.ts @@ -1,8 +1,10 @@ -import * as fs from 'fs'; import type { MixedOutput, Module } from 'metro'; + +import * as fs from 'fs'; import CountingSet from 'metro/private/lib/CountingSet'; import * as countLines from 'metro/private/lib/countLines'; import { minify } from 'uglify-js'; + import { createSentryMetroSerializer } from '../../src/js/tools/sentryMetroSerializer'; import { createDebugIdSnippet, type MetroSerializer, type VirtualJSOutput } from '../../src/js/tools/utils'; diff --git a/packages/core/test/tools/sentryOptionsSerializer.test.ts b/packages/core/test/tools/sentryOptionsSerializer.test.ts index 2e855fffd3..8027ff1953 100644 --- a/packages/core/test/tools/sentryOptionsSerializer.test.ts +++ b/packages/core/test/tools/sentryOptionsSerializer.test.ts @@ -1,6 +1,8 @@ +import type { Graph, Module, SerializerOptions } from 'metro'; + import { logger } from '@sentry/core'; import * as fs from 'fs'; -import type { Graph, Module, SerializerOptions } from 'metro'; + import { withSentryOptionsFromFile } from '../../src/js/tools/sentryOptionsSerializer'; import { createSet } from '../../src/js/tools/utils'; diff --git a/packages/core/test/tools/sentryReleaseInjector.test.ts b/packages/core/test/tools/sentryReleaseInjector.test.ts index b4c506a70b..fa120839c2 100644 --- a/packages/core/test/tools/sentryReleaseInjector.test.ts +++ b/packages/core/test/tools/sentryReleaseInjector.test.ts @@ -1,4 +1,5 @@ import type { MixedOutput, Module, ReadOnlyGraph } from 'metro'; + import { unstableReleaseConstantsPlugin } from '../../src/js/tools/sentryReleaseInjector'; const mockedExpoConfigRequire = jest.fn(); diff --git a/packages/core/test/tools/utils.test.ts b/packages/core/test/tools/utils.test.ts index b752668a03..0c02d285c7 100644 --- a/packages/core/test/tools/utils.test.ts +++ b/packages/core/test/tools/utils.test.ts @@ -1,6 +1,9 @@ import type { Module } from 'metro'; + import * as countLines from 'metro/private/lib/countLines'; + import type { VirtualJSOutput } from '../../src/js/tools/utils'; + import { createSet, getExpoConfig, prependModule } from '../../src/js/tools/utils'; const mockedExpoConfigRequire = jest.fn(); diff --git a/packages/core/test/touchevents.test.tsx b/packages/core/test/touchevents.test.tsx index 32089530b8..d446457272 100644 --- a/packages/core/test/touchevents.test.tsx +++ b/packages/core/test/touchevents.test.tsx @@ -2,7 +2,9 @@ * @jest-environment jsdom */ import type { SeverityLevel } from '@sentry/core'; + import * as core from '@sentry/core'; + import { TouchEventBoundary } from '../src/js/touchevents'; import * as userInteractionModule from '../src/js/tracing/integrations/userInteraction'; import { getDefaultTestClientOptions, TestClient } from './mocks/client'; diff --git a/packages/core/test/trace.test.ts b/packages/core/test/trace.test.ts index 94b81bcee5..0f84d36e20 100644 --- a/packages/core/test/trace.test.ts +++ b/packages/core/test/trace.test.ts @@ -1,4 +1,5 @@ import { setCurrentClient, spanToJSON, startSpan } from '@sentry/core'; + import { getDefaultTestClientOptions, TestClient } from './mocks/client'; describe('parentSpanIsAlwaysRootSpan', () => { diff --git a/packages/core/test/tracing/addTracingExtensions.test.ts b/packages/core/test/tracing/addTracingExtensions.test.ts index c42f03a7f8..48a2a9a432 100644 --- a/packages/core/test/tracing/addTracingExtensions.test.ts +++ b/packages/core/test/tracing/addTracingExtensions.test.ts @@ -1,5 +1,7 @@ import type { Span } from '@sentry/core'; + import { getCurrentScope, spanToJSON, startSpanManual } from '@sentry/core'; + import { reactNativeTracingIntegration } from '../../src/js'; import { setupTestClient, type TestClient } from '../mocks/client'; diff --git a/packages/core/test/tracing/adjustTransactionDuration.test.ts b/packages/core/test/tracing/adjustTransactionDuration.test.ts index 95cef9da80..88ecf9836d 100644 --- a/packages/core/test/tracing/adjustTransactionDuration.test.ts +++ b/packages/core/test/tracing/adjustTransactionDuration.test.ts @@ -1,4 +1,5 @@ import { getClient, spanToJSON, startSpanManual } from '@sentry/core'; + import { adjustTransactionDuration } from '../../src/js/tracing/onSpanEndUtils'; import { setupTestClient } from '../mocks/client'; diff --git a/packages/core/test/tracing/expoAsset.test.ts b/packages/core/test/tracing/expoAsset.test.ts index 9d6fef8359..0f2e6a7584 100644 --- a/packages/core/test/tracing/expoAsset.test.ts +++ b/packages/core/test/tracing/expoAsset.test.ts @@ -1,4 +1,5 @@ import { SPAN_STATUS_ERROR, SPAN_STATUS_OK } from '@sentry/core'; + import { type ExpoAsset, wrapExpoAsset } from '../../src/js/tracing'; import { SPAN_ORIGIN_AUTO_RESOURCE_EXPO_ASSET } from '../../src/js/tracing/origin'; diff --git a/packages/core/test/tracing/expoImage.test.ts b/packages/core/test/tracing/expoImage.test.ts index 6dd1fc9ad1..9e848a7484 100644 --- a/packages/core/test/tracing/expoImage.test.ts +++ b/packages/core/test/tracing/expoImage.test.ts @@ -1,4 +1,5 @@ import { SPAN_STATUS_ERROR, SPAN_STATUS_OK } from '@sentry/core'; + import { type ExpoImage, wrapExpoImage } from '../../src/js/tracing'; import { SPAN_ORIGIN_AUTO_RESOURCE_EXPO_IMAGE } from '../../src/js/tracing/origin'; diff --git a/packages/core/test/tracing/expoRouter.test.ts b/packages/core/test/tracing/expoRouter.test.ts index 145cd76b54..5d76155e18 100644 --- a/packages/core/test/tracing/expoRouter.test.ts +++ b/packages/core/test/tracing/expoRouter.test.ts @@ -1,4 +1,5 @@ import { SPAN_STATUS_ERROR, SPAN_STATUS_OK } from '@sentry/core'; + import { type ExpoRouter, wrapExpoRouter } from '../../src/js/tracing'; import { SPAN_ORIGIN_AUTO_EXPO_ROUTER_PREFETCH } from '../../src/js/tracing/origin'; diff --git a/packages/core/test/tracing/gesturetracing.test.ts b/packages/core/test/tracing/gesturetracing.test.ts index 051ea3100f..7cc38aa469 100644 --- a/packages/core/test/tracing/gesturetracing.test.ts +++ b/packages/core/test/tracing/gesturetracing.test.ts @@ -1,5 +1,9 @@ import type { Breadcrumb } from '@sentry/core'; + import { getActiveSpan, spanToJSON, startSpan } from '@sentry/core'; + +import type { ReactNativeTracingIntegration } from '../../src/js/tracing/reactnativetracing'; + import { UI_ACTION } from '../../src/js/tracing'; import { DEFAULT_BREADCRUMB_CATEGORY as DEFAULT_GESTURE_BREADCRUMB_CATEGORY, @@ -8,7 +12,6 @@ import { } from '../../src/js/tracing/gesturetracing'; import { startUserInteractionSpan } from '../../src/js/tracing/integrations/userInteraction'; import { SPAN_ORIGIN_AUTO_INTERACTION } from '../../src/js/tracing/origin'; -import type { ReactNativeTracingIntegration } from '../../src/js/tracing/reactnativetracing'; import { reactNativeTracingIntegration } from '../../src/js/tracing/reactnativetracing'; import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../../src/js/tracing/semanticAttributes'; import { setupTestClient, type TestClient } from '../mocks/client'; diff --git a/packages/core/test/tracing/idleNavigationSpan.test.ts b/packages/core/test/tracing/idleNavigationSpan.test.ts index a0838d64cc..25bcd94b5c 100644 --- a/packages/core/test/tracing/idleNavigationSpan.test.ts +++ b/packages/core/test/tracing/idleNavigationSpan.test.ts @@ -1,8 +1,11 @@ import type { Span } from '@sentry/core'; -import { getActiveSpan, getCurrentScope, spanToJSON, startInactiveSpan, startSpanManual } from '@sentry/core'; import type { AppStateStatus } from 'react-native'; + +import { getActiveSpan, getCurrentScope, spanToJSON, startInactiveSpan, startSpanManual } from '@sentry/core'; import { AppState } from 'react-native'; + import type { ScopeWithMaybeSpan } from '../../src/js/tracing/span'; + import { SCOPE_SPAN_FIELD, startIdleNavigationSpan } from '../../src/js/tracing/span'; import { NATIVE } from '../../src/js/wrapper'; import { setupTestClient } from '../mocks/client'; diff --git a/packages/core/test/tracing/integrations/appStart.test.ts b/packages/core/test/tracing/integrations/appStart.test.ts index 0f8ecc2a51..feb71ace53 100644 --- a/packages/core/test/tracing/integrations/appStart.test.ts +++ b/packages/core/test/tracing/integrations/appStart.test.ts @@ -1,4 +1,5 @@ import type { ErrorEvent, Event, Integration, SpanJSON, TransactionEvent } from '@sentry/core'; + import { getCurrentScope, getGlobalScope, @@ -10,11 +11,13 @@ import { startInactiveSpan, timestampInSeconds, } from '@sentry/core'; + +import type { NativeAppStartResponse } from '../../../src/js/NativeRNSentry'; + import { APP_START_COLD as APP_START_COLD_MEASUREMENT, APP_START_WARM as APP_START_WARM_MEASUREMENT, } from '../../../src/js/measurements'; -import type { NativeAppStartResponse } from '../../../src/js/NativeRNSentry'; import { APP_START_COLD as APP_START_COLD_OP, APP_START_WARM as APP_START_WARM_OP, diff --git a/packages/core/test/tracing/integrations/nativeframes.test.ts b/packages/core/test/tracing/integrations/nativeframes.test.ts index d47ed8299c..703add3e10 100644 --- a/packages/core/test/tracing/integrations/nativeframes.test.ts +++ b/packages/core/test/tracing/integrations/nativeframes.test.ts @@ -1,5 +1,7 @@ import type { Event, Measurements } from '@sentry/core'; + import { getCurrentScope, getGlobalScope, getIsolationScope, setCurrentClient, startSpan } from '@sentry/core'; + import { nativeFramesIntegration } from '../../../src/js'; import { NATIVE } from '../../../src/js/wrapper'; import { getDefaultTestClientOptions, TestClient } from '../../mocks/client'; diff --git a/packages/core/test/tracing/integrations/stallTracking/stalltracking.background.test.ts b/packages/core/test/tracing/integrations/stallTracking/stalltracking.background.test.ts index 8a7270124f..048266f818 100644 --- a/packages/core/test/tracing/integrations/stallTracking/stalltracking.background.test.ts +++ b/packages/core/test/tracing/integrations/stallTracking/stalltracking.background.test.ts @@ -1,4 +1,5 @@ import type { AppStateStatus } from 'react-native'; + import { stallTrackingIntegration } from '../../../../src/js/tracing/integrations/stalltracking'; type StallTrackingWithTestProperties = ReturnType & { diff --git a/packages/core/test/tracing/integrations/stallTracking/stalltracking.test.ts b/packages/core/test/tracing/integrations/stallTracking/stalltracking.test.ts index 1b5848e32e..b4d5dbb43e 100644 --- a/packages/core/test/tracing/integrations/stallTracking/stalltracking.test.ts +++ b/packages/core/test/tracing/integrations/stallTracking/stalltracking.test.ts @@ -1,4 +1,5 @@ import type { Span } from '@sentry/core'; + import { getCurrentScope, getGlobalScope, @@ -9,6 +10,7 @@ import { startSpanManual, timestampInSeconds, } from '@sentry/core'; + import { stallTrackingIntegration } from '../../../../src/js/tracing/integrations/stalltracking'; import { getDefaultTestClientOptions, TestClient } from '../../../mocks/client'; import { expectNonZeroStallMeasurements, expectStallMeasurements } from './stalltrackingutils'; diff --git a/packages/core/test/tracing/integrations/userInteraction.test.ts b/packages/core/test/tracing/integrations/userInteraction.test.ts index f01034cd5e..c39097745d 100644 --- a/packages/core/test/tracing/integrations/userInteraction.test.ts +++ b/packages/core/test/tracing/integrations/userInteraction.test.ts @@ -1,4 +1,6 @@ import type { Span } from '@sentry/core'; +import type { AppStateStatus } from 'react-native'; + import { getActiveSpan, getCurrentScope, @@ -7,19 +9,20 @@ import { startInactiveSpan, startSpanManual, } from '@sentry/core'; -import type { AppStateStatus } from 'react-native'; import { AppState } from 'react-native'; + +import type { ReactNativeTracingIntegration } from '../../../src/js/tracing/reactnativetracing'; +import type { TestClient } from '../../mocks/client'; + import { startUserInteractionSpan, userInteractionIntegration, } from '../../../src/js/tracing/integrations/userInteraction'; import { SPAN_ORIGIN_MANUAL_INTERACTION } from '../../../src/js/tracing/origin'; -import type { ReactNativeTracingIntegration } from '../../../src/js/tracing/reactnativetracing'; import { reactNativeTracingIntegration } from '../../../src/js/tracing/reactnativetracing'; import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../../../src/js/tracing/semanticAttributes'; import { startIdleNavigationSpan } from '../../../src/js/tracing/span'; import { NATIVE } from '../../../src/js/wrapper'; -import type { TestClient } from '../../mocks/client'; import { setupTestClient } from '../../mocks/client'; type MockAppState = { diff --git a/packages/core/test/tracing/mockedtimetodisplaynative.tsx b/packages/core/test/tracing/mockedtimetodisplaynative.tsx index 12c9b7e6ae..906386d833 100644 --- a/packages/core/test/tracing/mockedtimetodisplaynative.tsx +++ b/packages/core/test/tracing/mockedtimetodisplaynative.tsx @@ -1,6 +1,8 @@ import * as React from 'react'; import { View } from 'react-native'; + import type { RNSentryOnDrawReporterProps } from '../../src/js/tracing/timetodisplaynative.types'; + import { NATIVE } from '../mockWrapper'; export let nativeComponentExists = true; @@ -19,9 +21,9 @@ export function mockRecordedTimeToDisplay({ ttid = {}, ttfd = {}, }: { - 'ttidNavigation'?: Record, - ttid?: Record, - ttfd?: Record, + ttidNavigation?: Record; + ttid?: Record; + ttfd?: Record; }): void { NATIVE.popTimeToDisplayFor.mockImplementation((key: string) => { if (key.startsWith('ttid-navigation-')) { @@ -52,4 +54,4 @@ function RNSentryOnDrawReporterMock(props: RNSentryOnDrawReporterProps): React.R export const getRNSentryOnDrawReporter = (): typeof RNSentryOnDrawReporterMock => { return RNSentryOnDrawReporterMock; -} +}; diff --git a/packages/core/test/tracing/onSpanEndUtils.test.ts b/packages/core/test/tracing/onSpanEndUtils.test.ts index d5ea30dd2e..05f717a895 100644 --- a/packages/core/test/tracing/onSpanEndUtils.test.ts +++ b/packages/core/test/tracing/onSpanEndUtils.test.ts @@ -1,5 +1,7 @@ import type { Client, Span } from '@sentry/core'; + import { getClient, startSpanManual } from '@sentry/core'; + import { adjustTransactionDuration, cancelInBackground, diff --git a/packages/core/test/tracing/reactnativenavigation.test.ts b/packages/core/test/tracing/reactnativenavigation.test.ts index d568ad6bcd..1ff880b599 100644 --- a/packages/core/test/tracing/reactnativenavigation.test.ts +++ b/packages/core/test/tracing/reactnativenavigation.test.ts @@ -1,4 +1,6 @@ import type { Event, StartSpanOptions } from '@sentry/core'; +import type { EmitterSubscription } from 'react-native'; + import { getActiveSpan, getCurrentScope, @@ -7,14 +9,15 @@ import { setCurrentClient, spanToJSON, } from '@sentry/core'; -import type { EmitterSubscription } from 'react-native'; -import { reactNativeTracingIntegration } from '../../src/js'; -import { SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NATIVE_NAVIGATION } from '../../src/js/tracing/origin'; + import type { BottomTabPressedEvent, ComponentWillAppearEvent, EventsRegistry, } from '../../src/js/tracing/reactnativenavigation'; + +import { reactNativeTracingIntegration } from '../../src/js'; +import { SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NATIVE_NAVIGATION } from '../../src/js/tracing/origin'; import { reactNativeNavigationIntegration } from '../../src/js/tracing/reactnativenavigation'; import { SEMANTIC_ATTRIBUTE_PREVIOUS_ROUTE_COMPONENT_ID, diff --git a/packages/core/test/tracing/reactnativetracing.test.ts b/packages/core/test/tracing/reactnativetracing.test.ts index eabd944984..688be37e18 100644 --- a/packages/core/test/tracing/reactnativetracing.test.ts +++ b/packages/core/test/tracing/reactnativetracing.test.ts @@ -1,6 +1,7 @@ -import * as SentryBrowser from '@sentry/browser'; import type { Event } from '@sentry/core'; +import * as SentryBrowser from '@sentry/browser'; + jest.mock('../../src/js/wrapper', () => { return { NATIVE: { @@ -13,9 +14,10 @@ jest.mock('../../src/js/wrapper', () => { }; }); +import type { TestClient } from '../mocks/client'; + import { reactNativeTracingIntegration } from '../../src/js/tracing/reactnativetracing'; import { isWeb } from '../../src/js/utils/environment'; -import type { TestClient } from '../mocks/client'; import { setupTestClient } from '../mocks/client'; jest.mock('../../src/js/tracing/utils', () => { diff --git a/packages/core/test/tracing/reactnavigation.stalltracking.test.ts b/packages/core/test/tracing/reactnavigation.stalltracking.test.ts index 0d6e5fda9a..e33da6c377 100644 --- a/packages/core/test/tracing/reactnavigation.stalltracking.test.ts +++ b/packages/core/test/tracing/reactnavigation.stalltracking.test.ts @@ -4,6 +4,7 @@ jest.mock('../../src/js/tracing/utils', () => ({ })); import { getCurrentScope, getGlobalScope, getIsolationScope, setCurrentClient, startSpanManual } from '@sentry/core'; + import { reactNativeTracingIntegration, reactNavigationIntegration } from '../../src/js'; import { stallTrackingIntegration } from '../../src/js/tracing/integrations/stalltracking'; import { isNearToNow } from '../../src/js/tracing/utils'; diff --git a/packages/core/test/tracing/reactnavigation.test.ts b/packages/core/test/tracing/reactnavigation.test.ts index cbd3db81f3..23bb2fb9d6 100644 --- a/packages/core/test/tracing/reactnavigation.test.ts +++ b/packages/core/test/tracing/reactnavigation.test.ts @@ -1,4 +1,5 @@ import type { Event, Measurements, SentrySpan, StartSpanOptions } from '@sentry/core'; + import { getActiveSpan, getCurrentScope, @@ -7,9 +8,11 @@ import { setCurrentClient, spanToJSON, } from '@sentry/core'; + +import type { NavigationRoute } from '../../src/js/tracing/reactnavigation'; + import { nativeFramesIntegration, reactNativeTracingIntegration } from '../../src/js'; import { SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NAVIGATION } from '../../src/js/tracing/origin'; -import type { NavigationRoute } from '../../src/js/tracing/reactnavigation'; import { extractDynamicRouteParams, reactNavigationIntegration } from '../../src/js/tracing/reactnavigation'; import { SEMANTIC_ATTRIBUTE_PREVIOUS_ROUTE_KEY, diff --git a/packages/core/test/tracing/reactnavigation.ttid.test.tsx b/packages/core/test/tracing/reactnavigation.ttid.test.tsx index 026d1094b9..14f4c6e812 100644 --- a/packages/core/test/tracing/reactnavigation.ttid.test.tsx +++ b/packages/core/test/tracing/reactnavigation.ttid.test.tsx @@ -1,7 +1,9 @@ import type { Scope, Span, SpanJSON, TransactionEvent, Transport } from '@sentry/core'; + import { getActiveSpan, spanToJSON, timestampInSeconds } from '@sentry/core'; -import * as TestRenderer from '@testing-library/react-native' +import * as TestRenderer from '@testing-library/react-native'; import * as React from 'react'; + import * as mockWrapper from '../mockWrapper'; import * as mockedSentryEventEmitter from '../utils/mockedSentryeventemitterfallback'; import * as mockedtimetodisplaynative from './mockedtimetodisplaynative'; @@ -15,7 +17,11 @@ import * as Sentry from '../../src/js'; import { startSpanManual } from '../../src/js'; import { TimeToFullDisplay, TimeToInitialDisplay } from '../../src/js/tracing'; import { _setAppStartEndData } from '../../src/js/tracing/integrations/appStart'; -import { SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NAVIGATION, SPAN_ORIGIN_AUTO_UI_TIME_TO_DISPLAY, SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY } from '../../src/js/tracing/origin'; +import { + SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NAVIGATION, + SPAN_ORIGIN_AUTO_UI_TIME_TO_DISPLAY, + SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY, +} from '../../src/js/tracing/origin'; import { SPAN_THREAD_NAME, SPAN_THREAD_NAME_JAVASCRIPT } from '../../src/js/tracing/span'; import { isHermesEnabled, notWeb } from '../../src/js/utils/environment'; import { RN_GLOBAL_OBJ } from '../../src/js/utils/worldwide'; @@ -24,7 +30,6 @@ import { nowInSeconds, secondInFutureTimestampMs } from '../testutils'; import { mockRecordedTimeToDisplay } from './mockedtimetodisplaynative'; import { createMockNavigationAndAttachTo } from './reactnavigationutils'; - const SCOPE_SPAN_FIELD = '_sentrySpan'; type ScopeWithMaybeSpan = Scope & { @@ -50,7 +55,7 @@ describe('React Navigation - TTID', () => { }); _setAppStartEndData({ timestampMs: mockedAppStartTimeSeconds * 1000, - endFrames: null + endFrames: null, }); const sut = createTestedInstrumentation({ enableTimeToInitialDisplay: true }); @@ -352,7 +357,9 @@ describe('React Navigation - TTID', () => { const transaction = getLastTransaction(transportSendMock); expect(getSpanDurationMs(transaction, 'ui.load.initial_display')).toBeDefined(); expect(transaction.measurements?.time_to_initial_display?.value).toBeDefined(); - expect(getSpanDurationMs(transaction, 'ui.load.initial_display')).toEqual(transaction.measurements?.time_to_initial_display?.value); + expect(getSpanDurationMs(transaction, 'ui.load.initial_display')).toEqual( + transaction.measurements?.time_to_initial_display?.value, + ); }); test('ttfd span duration and measurement should equal ttid from ttfd is called earlier than ttid', () => { @@ -380,7 +387,9 @@ describe('React Navigation - TTID', () => { expect(transaction.measurements?.time_to_full_display?.value).toBeDefined(); expect(transaction.measurements?.time_to_initial_display?.value).toBeDefined(); - expect(transaction.measurements?.time_to_full_display?.value).toEqual(transaction.measurements?.time_to_initial_display?.value); + expect(transaction.measurements?.time_to_full_display?.value).toEqual( + transaction.measurements?.time_to_initial_display?.value, + ); }); test('ttfd span duration and measurement should equal for application start up', () => { @@ -401,7 +410,9 @@ describe('React Navigation - TTID', () => { const transaction = getLastTransaction(transportSendMock); expect(getSpanDurationMs(transaction, 'ui.load.full_display')).toBeDefined(); expect(transaction.measurements?.time_to_full_display?.value).toBeDefined(); - expect(getSpanDurationMs(transaction, 'ui.load.full_display')).toEqual(transaction.measurements?.time_to_full_display?.value); + expect(getSpanDurationMs(transaction, 'ui.load.full_display')).toEqual( + transaction.measurements?.time_to_full_display?.value, + ); }); test('idle transaction should cancel the ttid span if new frame not received', () => { @@ -503,7 +514,7 @@ describe('React Navigation - TTID', () => { spans: expect.arrayContaining([ expect.objectContaining>({ op: 'ui.load.initial_display', - timestamp: manualInitialDisplayEndTimestampMs / 1_000 + timestamp: manualInitialDisplayEndTimestampMs / 1_000, }), ]), measurements: expect.objectContaining['measurements']>({ @@ -661,9 +672,9 @@ describe('React Navigation - TTID', () => { } function createTestedInstrumentation(options?: { - enableTimeToInitialDisplay?: boolean - enableTimeToInitialDisplayForPreloadedRoutes?: boolean - ignoreEmptyBackNavigationTransactions?: boolean + enableTimeToInitialDisplay?: boolean; + enableTimeToInitialDisplayForPreloadedRoutes?: boolean; + ignoreEmptyBackNavigationTransactions?: boolean; }) { const sut = Sentry.reactNavigationIntegration({ ...options, @@ -694,11 +705,7 @@ function initSentry(sut: ReturnType): dsn: MOCK_DSN, tracesSampleRate: 1.0, enableStallTracking: false, - integrations: [ - sut, - Sentry.reactNativeTracingIntegration(), - Sentry.timeToDisplayIntegration(), - ], + integrations: [sut, Sentry.reactNativeTracingIntegration(), Sentry.timeToDisplayIntegration()], transport: () => ({ send: transportSendMock.mockResolvedValue({}), flush: jest.fn().mockResolvedValue(true), diff --git a/packages/core/test/tracing/timetodisplay.test.tsx b/packages/core/test/tracing/timetodisplay.test.tsx index 8258dc224a..0f3602b2a8 100644 --- a/packages/core/test/tracing/timetodisplay.test.tsx +++ b/packages/core/test/tracing/timetodisplay.test.tsx @@ -1,5 +1,14 @@ import type { Event, Measurements, Span, SpanJSON } from '@sentry/core'; -import { debug , getCurrentScope, getGlobalScope, getIsolationScope, setCurrentClient, spanToJSON, startSpanManual } from '@sentry/core'; + +import { + debug, + getCurrentScope, + getGlobalScope, + getIsolationScope, + setCurrentClient, + spanToJSON, + startSpanManual, +} from '@sentry/core'; jest.spyOn(debug, 'warn'); @@ -13,11 +22,21 @@ jest.mock('../../src/js/tracing/timetodisplaynative', () => mockedtimetodisplayn import { render } from '@testing-library/react-native'; import * as React from 'react'; + import { timeToDisplayIntegration } from '../../src/js/tracing/integrations/timeToDisplayIntegration'; import { SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY } from '../../src/js/tracing/origin'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../../src/js/tracing/semanticAttributes'; -import { SPAN_THREAD_NAME , SPAN_THREAD_NAME_JAVASCRIPT } from '../../src/js/tracing/span'; -import { startTimeToFullDisplaySpan, startTimeToInitialDisplaySpan, TimeToFullDisplay, TimeToInitialDisplay, updateInitialDisplaySpan } from '../../src/js/tracing/timetodisplay'; +import { + SEMANTIC_ATTRIBUTE_SENTRY_OP, + SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, +} from '../../src/js/tracing/semanticAttributes'; +import { SPAN_THREAD_NAME, SPAN_THREAD_NAME_JAVASCRIPT } from '../../src/js/tracing/span'; +import { + startTimeToFullDisplaySpan, + startTimeToInitialDisplaySpan, + TimeToFullDisplay, + TimeToInitialDisplay, + updateInitialDisplaySpan, +} from '../../src/js/tracing/timetodisplay'; import { getDefaultTestClientOptions, TestClient } from '../mocks/client'; import { nowInSeconds, secondAgoTimestampMs, secondInFutureTimestampMs } from '../testutils'; @@ -26,11 +45,12 @@ jest.mock('../../src/js/utils/environment', () => ({ isTurboModuleEnabled: jest.fn().mockReturnValue(false), })); -const { mockRecordedTimeToDisplay, getMockedOnDrawReportedProps, clearMockedOnDrawReportedProps } = mockedtimetodisplaynative; +const { mockRecordedTimeToDisplay, getMockedOnDrawReportedProps, clearMockedOnDrawReportedProps } = + mockedtimetodisplaynative; jest.useFakeTimers({ advanceTimers: true, - doNotFake: ['performance'] // Keep real performance API + doNotFake: ['performance'], // Keep real performance API }); describe('TimeToDisplay', () => { @@ -47,10 +67,7 @@ describe('TimeToDisplay', () => { }); client = new TestClient({ ...options, - integrations: [ - ...options.integrations, - timeToDisplayIntegration(), - ], + integrations: [...options.integrations, timeToDisplayIntegration()], }); setCurrentClient(client); client.init(); @@ -68,7 +85,7 @@ describe('TimeToDisplay', () => { name: 'Root Manual Span', startTime: secondAgoTimestampMs(), }, - (activeSpan: Span | undefined) => { + (activeSpan: Span | undefined) => { startTimeToInitialDisplaySpan(); render(); mockRecordedTimeToDisplay({ @@ -251,8 +268,9 @@ describe('TimeToDisplay', () => { expectInitialDisplayMeasurementOnSpan(client.event!); expectFullDisplayMeasurementOnSpan(client.event!); - expect(client.event!.measurements!.time_to_full_display.value) - .toEqual(client.event!.measurements!.time_to_initial_display.value); + expect(client.event!.measurements!.time_to_full_display.value).toEqual( + client.event!.measurements!.time_to_initial_display.value, + ); }); test('full display which ended before initial display is extended to initial display end', async () => { @@ -267,8 +285,18 @@ describe('TimeToDisplay', () => { startTimeToInitialDisplaySpan(); startTimeToFullDisplaySpan(); - const timeToDisplayComponent = render(<>); - timeToDisplayComponent.update(<>); + const timeToDisplayComponent = render( + <> + + + , + ); + timeToDisplayComponent.update( + <> + + + , + ); mockRecordedTimeToDisplay({ ttfd: { @@ -306,77 +334,88 @@ function getFullDisplaySpanJSON(spans: SpanJSON[]) { } function expectFinishedInitialDisplaySpan(event: Event) { - expect(getInitialDisplaySpanJSON(event.spans!)).toEqual(expect.objectContaining>({ - data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.load.initial_display', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY, - [SPAN_THREAD_NAME]: SPAN_THREAD_NAME_JAVASCRIPT, - }, - description: 'Time To Initial Display', - op: 'ui.load.initial_display', - parent_span_id: event.contexts.trace.span_id, - start_timestamp: event.start_timestamp, - status: 'ok', - timestamp: expect.any(Number), - })); + expect(getInitialDisplaySpanJSON(event.spans!)).toEqual( + expect.objectContaining>({ + data: { + [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.load.initial_display', + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY, + [SPAN_THREAD_NAME]: SPAN_THREAD_NAME_JAVASCRIPT, + }, + description: 'Time To Initial Display', + op: 'ui.load.initial_display', + parent_span_id: event.contexts.trace.span_id, + start_timestamp: event.start_timestamp, + status: 'ok', + timestamp: expect.any(Number), + }), + ); } function expectFinishedFullDisplaySpan(event: Event) { - expect(getFullDisplaySpanJSON(event.spans!)).toEqual(expect.objectContaining>({ - data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.load.full_display', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY, - [SPAN_THREAD_NAME]: SPAN_THREAD_NAME_JAVASCRIPT, - }, - description: 'Time To Full Display', - op: 'ui.load.full_display', - parent_span_id: event.contexts.trace.span_id, - start_timestamp: event.start_timestamp, - status: 'ok', - timestamp: expect.any(Number), - })); + expect(getFullDisplaySpanJSON(event.spans!)).toEqual( + expect.objectContaining>({ + data: { + [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.load.full_display', + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY, + [SPAN_THREAD_NAME]: SPAN_THREAD_NAME_JAVASCRIPT, + }, + description: 'Time To Full Display', + op: 'ui.load.full_display', + parent_span_id: event.contexts.trace.span_id, + start_timestamp: event.start_timestamp, + status: 'ok', + timestamp: expect.any(Number), + }), + ); } - function expectDeadlineExceededFullDisplaySpan(event: Event) { - expect(getFullDisplaySpanJSON(event.spans!)).toEqual(expect.objectContaining>({ - data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.load.full_display', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY, - [SPAN_THREAD_NAME]: SPAN_THREAD_NAME_JAVASCRIPT, - }, - description: 'Time To Full Display', - op: 'ui.load.full_display', - parent_span_id: event.contexts.trace.span_id, - start_timestamp: event.start_timestamp, - status: 'deadline_exceeded', - timestamp: expect.any(Number), - })); + expect(getFullDisplaySpanJSON(event.spans!)).toEqual( + expect.objectContaining>({ + data: { + [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.load.full_display', + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY, + [SPAN_THREAD_NAME]: SPAN_THREAD_NAME_JAVASCRIPT, + }, + description: 'Time To Full Display', + op: 'ui.load.full_display', + parent_span_id: event.contexts.trace.span_id, + start_timestamp: event.start_timestamp, + status: 'deadline_exceeded', + timestamp: expect.any(Number), + }), + ); } function expectNoTimeToDisplaySpans(event: Event) { - expect(event.spans).toEqual(expect.not.arrayContaining([ - expect.objectContaining>({ op: 'ui.load.initial_display' }), - expect.objectContaining>({ op: 'ui.load.full_display' }), - ])); + expect(event.spans).toEqual( + expect.not.arrayContaining([ + expect.objectContaining>({ op: 'ui.load.initial_display' }), + expect.objectContaining>({ op: 'ui.load.full_display' }), + ]), + ); } function expectInitialDisplayMeasurementOnSpan(event: Event) { - expect(event.measurements).toEqual(expect.objectContaining({ - time_to_initial_display: { - value: expect.any(Number), - unit: 'millisecond', - }, - })); + expect(event.measurements).toEqual( + expect.objectContaining({ + time_to_initial_display: { + value: expect.any(Number), + unit: 'millisecond', + }, + }), + ); } function expectFullDisplayMeasurementOnSpan(event: Event) { - expect(event.measurements).toEqual(expect.objectContaining({ - time_to_full_display: { - value: expect.any(Number), - unit: 'millisecond', - }, - })); + expect(event.measurements).toEqual( + expect.objectContaining({ + time_to_full_display: { + value: expect.any(Number), + unit: 'millisecond', + }, + }), + ); } function expectNoInitialDisplayMeasurementOnSpan(event: Event) { @@ -407,10 +446,7 @@ describe('Frame Data', () => { }); client = new TestClient({ ...options, - integrations: [ - ...options.integrations, - timeToDisplayIntegration(), - ], + integrations: [...options.integrations, timeToDisplayIntegration()], }); setCurrentClient(client); client.init(); @@ -429,9 +465,7 @@ describe('Frame Data', () => { const startFrames = { totalFrames: 100, slowFrames: 2, frozenFrames: 1 }; const endFrames = { totalFrames: 150, slowFrames: 5, frozenFrames: 2 }; - mockWrapper.NATIVE.fetchNativeFrames - .mockResolvedValueOnce(startFrames) - .mockResolvedValueOnce(endFrames); + mockWrapper.NATIVE.fetchNativeFrames.mockResolvedValueOnce(startFrames).mockResolvedValueOnce(endFrames); await startSpanManual( { @@ -531,9 +565,7 @@ describe('Frame Data', () => { test('does not attach frame data when frames are zero', async () => { const frames = { totalFrames: 100, slowFrames: 2, frozenFrames: 1 }; - mockWrapper.NATIVE.fetchNativeFrames - .mockResolvedValueOnce(frames) - .mockResolvedValueOnce(frames); // Same frames = delta of 0 + mockWrapper.NATIVE.fetchNativeFrames.mockResolvedValueOnce(frames).mockResolvedValueOnce(frames); // Same frames = delta of 0 startSpanManual( { diff --git a/packages/core/test/tracing/timetodisplaynative.web.test.tsx b/packages/core/test/tracing/timetodisplaynative.web.test.tsx index 6956bc81a2..ccd5100d61 100644 --- a/packages/core/test/tracing/timetodisplaynative.web.test.tsx +++ b/packages/core/test/tracing/timetodisplaynative.web.test.tsx @@ -27,5 +27,5 @@ describe('timetodisplaynative', () => { const drawReported = getRNSentryOnDrawReporter(); expect(drawReported.name).toBe('RNSentryOnDrawReporterNoop'); - }); + }); }); diff --git a/packages/core/test/transports/encodePolyfill.test.ts b/packages/core/test/transports/encodePolyfill.test.ts index 6bc319f97f..e3a3b8cc40 100644 --- a/packages/core/test/transports/encodePolyfill.test.ts +++ b/packages/core/test/transports/encodePolyfill.test.ts @@ -1,4 +1,5 @@ import { SDK_VERSION } from '@sentry/core'; + import { encodePolyfill, useEncodePolyfill } from '../../src/js/transports/encodePolyfill'; import { RN_GLOBAL_OBJ } from '../../src/js/utils/worldwide'; diff --git a/packages/core/test/transports/native.test.ts b/packages/core/test/transports/native.test.ts index 72a0c936ca..267f2b4d59 100644 --- a/packages/core/test/transports/native.test.ts +++ b/packages/core/test/transports/native.test.ts @@ -1,4 +1,5 @@ import type { Envelope } from '@sentry/core'; + import { NativeTransport } from '../../src/js/transports/native'; jest.mock('../../src/js/wrapper', () => ({ diff --git a/packages/core/test/utils/ignorerequirecyclelogs.test.ts b/packages/core/test/utils/ignorerequirecyclelogs.test.ts index 52b87e691d..11f62b9d2c 100644 --- a/packages/core/test/utils/ignorerequirecyclelogs.test.ts +++ b/packages/core/test/utils/ignorerequirecyclelogs.test.ts @@ -1,4 +1,5 @@ import { LogBox } from 'react-native'; + import { ignoreRequireCycleLogs } from '../../src/js/utils/ignorerequirecyclelogs'; jest.mock('react-native', () => ({ diff --git a/packages/core/test/utils/mockedSentryeventemitterfallback.ts b/packages/core/test/utils/mockedSentryeventemitterfallback.ts index 9ad6dcdf5d..74ebd4f53a 100644 --- a/packages/core/test/utils/mockedSentryeventemitterfallback.ts +++ b/packages/core/test/utils/mockedSentryeventemitterfallback.ts @@ -1,5 +1,6 @@ import { timestampInSeconds } from '@sentry/core'; import * as EventEmitter from 'events'; + import type { NewFrameEvent } from '../../src/js/utils/sentryeventemitter'; import type { SentryEventEmitterFallback } from '../../src/js/utils/sentryeventemitterfallback'; import type { MockInterface } from '../testutils'; diff --git a/packages/core/test/utils/sentryeventemitter.test.ts b/packages/core/test/utils/sentryeventemitter.test.ts index 7338e86061..bdc956318a 100644 --- a/packages/core/test/utils/sentryeventemitter.test.ts +++ b/packages/core/test/utils/sentryeventemitter.test.ts @@ -1,4 +1,5 @@ import type { NewFrameEventName } from '../../src/js/utils/sentryeventemitter'; + import { createSentryEventEmitter } from '../../src/js/utils/sentryeventemitter'; describe('Sentry Event Emitter', () => { diff --git a/packages/core/test/utils/sentryeventemitterfallback.test.ts b/packages/core/test/utils/sentryeventemitterfallback.test.ts index 84cc996934..e13ccc8f1e 100644 --- a/packages/core/test/utils/sentryeventemitterfallback.test.ts +++ b/packages/core/test/utils/sentryeventemitterfallback.test.ts @@ -1,4 +1,5 @@ import { debug } from '@sentry/core'; + import { NewFrameEventName } from '../../src/js/utils/sentryeventemitter'; import { createSentryFallbackEventEmitter } from '../../src/js/utils/sentryeventemitterfallback'; diff --git a/packages/core/test/wrap.mocked.test.tsx b/packages/core/test/wrap.mocked.test.tsx index 686363711c..94be7dd2f2 100644 --- a/packages/core/test/wrap.mocked.test.tsx +++ b/packages/core/test/wrap.mocked.test.tsx @@ -1,7 +1,9 @@ +import type { ReactNativeWrapperOptions } from 'src/js/options'; + // We can't test wrap with mock and non mocked components, otherwise it will break the RN testing library. import { render } from '@testing-library/react-native'; import * as React from 'react'; -import type { ReactNativeWrapperOptions } from 'src/js/options'; + import * as environment from '../src/js/utils/environment'; jest.doMock('../src/js/touchevents', () => { @@ -22,9 +24,7 @@ jest.doMock('../src/js/tracing', () => { jest.doMock('@sentry/react', () => { return { - Profiler: jest.fn(({ children }: { children: React.ReactNode }) => ( -

{children}
- )), + Profiler: jest.fn(({ children }: { children: React.ReactNode }) =>
{children}
), }; }); @@ -112,7 +112,7 @@ describe('Sentry.wrap', () => { includeRender: true, includeUpdates: true, }), - expect.toBeNil() + expect.toBeNil(), ); expect(ReactNativeProfiler).not.toHaveBeenCalledWith( diff --git a/packages/core/test/wrap.test.tsx b/packages/core/test/wrap.test.tsx index 5d967b7852..35145d189d 100644 --- a/packages/core/test/wrap.test.tsx +++ b/packages/core/test/wrap.test.tsx @@ -3,27 +3,28 @@ import { debug, setCurrentClient } from '@sentry/core'; import { render } from '@testing-library/react-native'; import * as React from 'react'; import { Text } from 'react-native'; + import * as AppRegistry from '../src/js/integrations/appRegistry'; import { wrap } from '../src/js/sdk'; import { getDefaultTestClientOptions, TestClient } from './mocks/client'; describe('ReactNativeProfiler', () => { - it('should wrap the component and init with a warning when getAppRegistryIntegration returns undefined', () => { - debug.warn = jest.fn(); - const getAppRegistryIntegration = jest.spyOn(AppRegistry, 'getAppRegistryIntegration').mockReturnValueOnce(undefined); - const Mock: React.FC = () => Test; - const client = new TestClient( - getDefaultTestClientOptions(), - ); - setCurrentClient(client); + it('should wrap the component and init with a warning when getAppRegistryIntegration returns undefined', () => { + debug.warn = jest.fn(); + const getAppRegistryIntegration = jest + .spyOn(AppRegistry, 'getAppRegistryIntegration') + .mockReturnValueOnce(undefined); + const Mock: React.FC = () => Test; + const client = new TestClient(getDefaultTestClientOptions()); + setCurrentClient(client); - client.init(); - const ActualWrapped = wrap(Mock); + client.init(); + const ActualWrapped = wrap(Mock); - const { getByText } = render(); + const { getByText } = render(); - expect(getAppRegistryIntegration).toHaveBeenCalled(); - expect(debug.warn).toHaveBeenCalledWith('AppRegistryIntegration.onRunApplication not found or invalid.'); - expect(getByText('Test')).toBeTruthy(); - }); + expect(getAppRegistryIntegration).toHaveBeenCalled(); + expect(debug.warn).toHaveBeenCalledWith('AppRegistryIntegration.onRunApplication not found or invalid.'); + expect(getByText('Test')).toBeTruthy(); }); +}); diff --git a/packages/core/test/wrapper.test.ts b/packages/core/test/wrapper.test.ts index cc7b79c0d9..5762929a4e 100644 --- a/packages/core/test/wrapper.test.ts +++ b/packages/core/test/wrapper.test.ts @@ -8,10 +8,13 @@ import type { MetricType, SeverityLevel, } from '@sentry/core'; + import { createEnvelope, debug } from '@sentry/core'; import * as RN from 'react-native'; + import type { Spec } from '../src/js/NativeRNSentry'; import type { ReactNativeOptions } from '../src/js/options'; + import { base64StringFromByteArray, utf8ToBytes } from '../src/js/vendor'; import { NATIVE } from '../src/js/wrapper'; diff --git a/performance-tests/TestAppPlain/package.json b/performance-tests/TestAppPlain/package.json index 7f77d4c4c5..e842aa8c46 100644 --- a/performance-tests/TestAppPlain/package.json +++ b/performance-tests/TestAppPlain/package.json @@ -25,7 +25,6 @@ "@types/react": "^19.1.0", "@types/react-test-renderer": "^19.1.0", "jest": "^29.6.3", - "prettier": "2.8.8", "react-test-renderer": "19.1.0", "typescript": "5.0.4" }, diff --git a/performance-tests/TestAppSentry/package.json b/performance-tests/TestAppSentry/package.json index 4388f3253a..8a1796e4e8 100644 --- a/performance-tests/TestAppSentry/package.json +++ b/performance-tests/TestAppSentry/package.json @@ -27,7 +27,6 @@ "@types/react": "^19.1.0", "@types/react-test-renderer": "^19.1.0", "jest": "^29.6.3", - "prettier": "2.8.8", "react-test-renderer": "19.1.0", "sentry-react-native-samples-utils": "workspace:^", "typescript": "5.0.4" diff --git a/samples/expo/package.json b/samples/expo/package.json index b86e4f477a..00000bb44c 100644 --- a/samples/expo/package.json +++ b/samples/expo/package.json @@ -11,7 +11,7 @@ "ios": "expo run:ios", "ts:check": "tsc", "lint": "npx oxlint", - "fix": "npx oxlint --fix && prettier --write \"**/*.{js,jsx,ts,tsx,json}\"", + "fix": "npx oxlint --fix && npx oxfmt \"**/*.{js,jsx,ts,tsx}\"", "export": "expo export --source-maps --clear --platform all", "export:web": "expo export --source-maps --clear --platform web", "prebuild": "expo prebuild --clean --no-install", @@ -49,7 +49,6 @@ "@babel/preset-env": "^7.26.0", "@sentry/babel-plugin-component-annotate": "5.1.1", "@types/node": "20.10.4", - "prettier": "2.8.8", "sentry-react-native-samples-utils": "workspace:^" }, "overrides": { diff --git a/samples/react-native-macos/package.json b/samples/react-native-macos/package.json index ff794d0b14..1f1dae03c1 100644 --- a/samples/react-native-macos/package.json +++ b/samples/react-native-macos/package.json @@ -43,7 +43,6 @@ "@types/react-native-vector-icons": "^6.4.18", "babel-plugin-module-resolver": "^5.0.0", "jest": "^29.6.3", - "prettier": "2.8.8", "sentry-react-native-samples-utils": "workspace:^", "typescript": "5.0.4" }, diff --git a/samples/react-native/package.json b/samples/react-native/package.json index aa8087a91e..3e62546ff8 100644 --- a/samples/react-native/package.json +++ b/samples/react-native/package.json @@ -87,7 +87,6 @@ "detox": "^20.33.0", "jest": "^29.6.3", "patch-package": "^8.0.0", - "prettier": "2.8.8", "react-test-renderer": "19.1.0", "sentry-react-native-samples-utils": "workspace:^", "ts-jest": "^29.3.1", diff --git a/yarn.lock b/yarn.lock index 621e93e184..a7c46a4fc1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7801,6 +7801,139 @@ __metadata: languageName: node linkType: hard +"@oxfmt/binding-android-arm-eabi@npm:0.42.0": + version: 0.42.0 + resolution: "@oxfmt/binding-android-arm-eabi@npm:0.42.0" + conditions: os=android & cpu=arm + languageName: node + linkType: hard + +"@oxfmt/binding-android-arm64@npm:0.42.0": + version: 0.42.0 + resolution: "@oxfmt/binding-android-arm64@npm:0.42.0" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + +"@oxfmt/binding-darwin-arm64@npm:0.42.0": + version: 0.42.0 + resolution: "@oxfmt/binding-darwin-arm64@npm:0.42.0" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@oxfmt/binding-darwin-x64@npm:0.42.0": + version: 0.42.0 + resolution: "@oxfmt/binding-darwin-x64@npm:0.42.0" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@oxfmt/binding-freebsd-x64@npm:0.42.0": + version: 0.42.0 + resolution: "@oxfmt/binding-freebsd-x64@npm:0.42.0" + conditions: os=freebsd & cpu=x64 + languageName: node + linkType: hard + +"@oxfmt/binding-linux-arm-gnueabihf@npm:0.42.0": + version: 0.42.0 + resolution: "@oxfmt/binding-linux-arm-gnueabihf@npm:0.42.0" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@oxfmt/binding-linux-arm-musleabihf@npm:0.42.0": + version: 0.42.0 + resolution: "@oxfmt/binding-linux-arm-musleabihf@npm:0.42.0" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@oxfmt/binding-linux-arm64-gnu@npm:0.42.0": + version: 0.42.0 + resolution: "@oxfmt/binding-linux-arm64-gnu@npm:0.42.0" + conditions: os=linux & cpu=arm64 & libc=glibc + languageName: node + linkType: hard + +"@oxfmt/binding-linux-arm64-musl@npm:0.42.0": + version: 0.42.0 + resolution: "@oxfmt/binding-linux-arm64-musl@npm:0.42.0" + conditions: os=linux & cpu=arm64 & libc=musl + languageName: node + linkType: hard + +"@oxfmt/binding-linux-ppc64-gnu@npm:0.42.0": + version: 0.42.0 + resolution: "@oxfmt/binding-linux-ppc64-gnu@npm:0.42.0" + conditions: os=linux & cpu=ppc64 & libc=glibc + languageName: node + linkType: hard + +"@oxfmt/binding-linux-riscv64-gnu@npm:0.42.0": + version: 0.42.0 + resolution: "@oxfmt/binding-linux-riscv64-gnu@npm:0.42.0" + conditions: os=linux & cpu=riscv64 & libc=glibc + languageName: node + linkType: hard + +"@oxfmt/binding-linux-riscv64-musl@npm:0.42.0": + version: 0.42.0 + resolution: "@oxfmt/binding-linux-riscv64-musl@npm:0.42.0" + conditions: os=linux & cpu=riscv64 & libc=musl + languageName: node + linkType: hard + +"@oxfmt/binding-linux-s390x-gnu@npm:0.42.0": + version: 0.42.0 + resolution: "@oxfmt/binding-linux-s390x-gnu@npm:0.42.0" + conditions: os=linux & cpu=s390x & libc=glibc + languageName: node + linkType: hard + +"@oxfmt/binding-linux-x64-gnu@npm:0.42.0": + version: 0.42.0 + resolution: "@oxfmt/binding-linux-x64-gnu@npm:0.42.0" + conditions: os=linux & cpu=x64 & libc=glibc + languageName: node + linkType: hard + +"@oxfmt/binding-linux-x64-musl@npm:0.42.0": + version: 0.42.0 + resolution: "@oxfmt/binding-linux-x64-musl@npm:0.42.0" + conditions: os=linux & cpu=x64 & libc=musl + languageName: node + linkType: hard + +"@oxfmt/binding-openharmony-arm64@npm:0.42.0": + version: 0.42.0 + resolution: "@oxfmt/binding-openharmony-arm64@npm:0.42.0" + conditions: os=openharmony & cpu=arm64 + languageName: node + linkType: hard + +"@oxfmt/binding-win32-arm64-msvc@npm:0.42.0": + version: 0.42.0 + resolution: "@oxfmt/binding-win32-arm64-msvc@npm:0.42.0" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@oxfmt/binding-win32-ia32-msvc@npm:0.42.0": + version: 0.42.0 + resolution: "@oxfmt/binding-win32-ia32-msvc@npm:0.42.0" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + +"@oxfmt/binding-win32-x64-msvc@npm:0.42.0": + version: 0.42.0 + resolution: "@oxfmt/binding-win32-x64-msvc@npm:0.42.0" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + "@oxlint-tsgolint/darwin-arm64@npm:0.17.4": version: 0.17.4 resolution: "@oxlint-tsgolint/darwin-arm64@npm:0.17.4" @@ -10821,9 +10954,9 @@ __metadata: jest-extended: ^4.0.2 madge: ^6.1.0 metro: 0.83.1 + oxfmt: ^0.42.0 oxlint: ^1.56.0 oxlint-tsgolint: ^0.17.4 - prettier: ^2.0.5 react: 19.1.0 react-native: 0.80.1 react-test-renderer: 19.1.0 @@ -12080,7 +12213,6 @@ __metadata: "@types/react": ^19.1.0 "@types/react-test-renderer": ^19.1.0 jest: ^29.6.3 - prettier: 2.8.8 react: 19.1.0 react-native: 0.80.2 react-test-renderer: 19.1.0 @@ -12107,7 +12239,6 @@ __metadata: "@types/react": ^19.1.0 "@types/react-test-renderer": ^19.1.0 jest: ^29.6.3 - prettier: 2.8.8 react: 19.1.0 react-native: 0.80.2 react-test-renderer: 19.1.0 @@ -25763,6 +25894,75 @@ __metadata: languageName: node linkType: hard +"oxfmt@npm:^0.42.0": + version: 0.42.0 + resolution: "oxfmt@npm:0.42.0" + dependencies: + "@oxfmt/binding-android-arm-eabi": 0.42.0 + "@oxfmt/binding-android-arm64": 0.42.0 + "@oxfmt/binding-darwin-arm64": 0.42.0 + "@oxfmt/binding-darwin-x64": 0.42.0 + "@oxfmt/binding-freebsd-x64": 0.42.0 + "@oxfmt/binding-linux-arm-gnueabihf": 0.42.0 + "@oxfmt/binding-linux-arm-musleabihf": 0.42.0 + "@oxfmt/binding-linux-arm64-gnu": 0.42.0 + "@oxfmt/binding-linux-arm64-musl": 0.42.0 + "@oxfmt/binding-linux-ppc64-gnu": 0.42.0 + "@oxfmt/binding-linux-riscv64-gnu": 0.42.0 + "@oxfmt/binding-linux-riscv64-musl": 0.42.0 + "@oxfmt/binding-linux-s390x-gnu": 0.42.0 + "@oxfmt/binding-linux-x64-gnu": 0.42.0 + "@oxfmt/binding-linux-x64-musl": 0.42.0 + "@oxfmt/binding-openharmony-arm64": 0.42.0 + "@oxfmt/binding-win32-arm64-msvc": 0.42.0 + "@oxfmt/binding-win32-ia32-msvc": 0.42.0 + "@oxfmt/binding-win32-x64-msvc": 0.42.0 + tinypool: 2.1.0 + dependenciesMeta: + "@oxfmt/binding-android-arm-eabi": + optional: true + "@oxfmt/binding-android-arm64": + optional: true + "@oxfmt/binding-darwin-arm64": + optional: true + "@oxfmt/binding-darwin-x64": + optional: true + "@oxfmt/binding-freebsd-x64": + optional: true + "@oxfmt/binding-linux-arm-gnueabihf": + optional: true + "@oxfmt/binding-linux-arm-musleabihf": + optional: true + "@oxfmt/binding-linux-arm64-gnu": + optional: true + "@oxfmt/binding-linux-arm64-musl": + optional: true + "@oxfmt/binding-linux-ppc64-gnu": + optional: true + "@oxfmt/binding-linux-riscv64-gnu": + optional: true + "@oxfmt/binding-linux-riscv64-musl": + optional: true + "@oxfmt/binding-linux-s390x-gnu": + optional: true + "@oxfmt/binding-linux-x64-gnu": + optional: true + "@oxfmt/binding-linux-x64-musl": + optional: true + "@oxfmt/binding-openharmony-arm64": + optional: true + "@oxfmt/binding-win32-arm64-msvc": + optional: true + "@oxfmt/binding-win32-ia32-msvc": + optional: true + "@oxfmt/binding-win32-x64-msvc": + optional: true + bin: + oxfmt: bin/oxfmt + checksum: fd1f968aa040f87d5cf6b57822fcb8e627e0125fc13289b00121b7ab7f4776779dc43c3ab9044e548ce422f896374a0ef072f0027a8a8cad3112dbaa2e238569 + languageName: node + linkType: hard + "oxlint-tsgolint@npm:^0.17.4": version: 0.17.4 resolution: "oxlint-tsgolint@npm:0.17.4" @@ -26753,15 +26953,6 @@ __metadata: languageName: node linkType: hard -"prettier@npm:2.8.8, prettier@npm:^2.0.5": - version: 2.8.8 - resolution: "prettier@npm:2.8.8" - bin: - prettier: bin-prettier.js - checksum: b49e409431bf129dd89238d64299ba80717b57ff5a6d1c1a8b1a28b590d998a34e083fa13573bc732bb8d2305becb4c9a4407f8486c81fa7d55100eb08263cf8 - languageName: node - linkType: hard - "pretty-bytes@npm:^5.6.0": version: 5.6.0 resolution: "pretty-bytes@npm:5.6.0" @@ -29332,7 +29523,6 @@ __metadata: expo-status-bar: ~55.0.4 expo-updates: ~55.0.12 expo-web-browser: ~55.0.9 - prettier: 2.8.8 react: 19.2.0 react-dom: 19.2.0 react-native: 0.83.2 @@ -29366,7 +29556,6 @@ __metadata: babel-plugin-module-resolver: ^5.0.0 delay: ^6.0.0 jest: ^29.6.3 - prettier: 2.8.8 react: 18.2.0 react-native: 0.73.9 react-native-gesture-handler: 2.14.0 @@ -29419,7 +29608,6 @@ __metadata: detox: ^20.33.0 jest: ^29.6.3 patch-package: ^8.0.0 - prettier: 2.8.8 react: 19.1.0 react-native: 0.80.2 react-native-build-config: ^0.3.2 @@ -29464,9 +29652,9 @@ __metadata: google-java-format: ^1.4.0 lerna: ^8.1.8 npm-run-all2: ^6.2.2 + oxfmt: ^0.42.0 oxlint: ^1.56.0 pmd-bin: ^2.5.0 - prettier: ^2.0.5 react-native-version: ^4.0.0 replace-in-file: ^7.0.1 languageName: unknown @@ -30947,6 +31135,13 @@ __metadata: languageName: node linkType: hard +"tinypool@npm:2.1.0": + version: 2.1.0 + resolution: "tinypool@npm:2.1.0" + checksum: f45eafaecb602509301716e70344d6532f20d29a38c2bd163de849fc0bfa3536090fcb7fc92b42b62698e586680cf45813f8b98c3995b63e2c9deb844da87ef4 + languageName: node + linkType: hard + "tmp@npm:^0.2.4": version: 0.2.5 resolution: "tmp@npm:0.2.5"