@sentry/react-native 7.1.0 → 7.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/RNSentry.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/libs/replay-stubs.jar +0 -0
- package/android/replay-stubs/build.gradle +1 -1
- package/android/src/main/java/io/sentry/react/RNSentryVersion.java +1 -1
- package/dist/js/client.d.ts.map +1 -1
- package/dist/js/client.js +4 -7
- package/dist/js/client.js.map +1 -1
- package/dist/js/integrations/logEnricherIntegration.js +28 -9
- package/dist/js/integrations/logEnricherIntegration.js.map +1 -1
- package/dist/js/playground/modal.d.ts.map +1 -1
- package/dist/js/playground/modal.js +2 -2
- package/dist/js/playground/modal.js.map +1 -1
- package/dist/js/replay/mobilereplay.d.ts +1 -0
- package/dist/js/replay/mobilereplay.d.ts.map +1 -1
- package/dist/js/replay/mobilereplay.js +15 -7
- package/dist/js/replay/mobilereplay.js.map +1 -1
- package/dist/js/tools/metroconfig.d.ts +1 -1
- package/dist/js/tools/metroconfig.d.ts.map +1 -1
- package/dist/js/tools/metroconfig.js.map +1 -1
- package/dist/js/tools/utils.d.ts.map +1 -1
- package/dist/js/tools/utils.js +2 -8
- package/dist/js/tools/utils.js.map +1 -1
- package/dist/js/tools/vendor/metro/countLines.d.ts +3 -0
- package/dist/js/tools/vendor/metro/countLines.d.ts.map +1 -0
- package/dist/js/tools/vendor/metro/countLines.js +27 -0
- package/dist/js/tools/vendor/metro/countLines.js.map +1 -0
- package/dist/js/tools/vendor/metro/utils.d.ts.map +1 -1
- package/dist/js/tools/vendor/metro/utils.js +17 -8
- package/dist/js/tools/vendor/metro/utils.js.map +1 -1
- package/dist/js/touchevents.js.map +1 -1
- package/dist/js/tracing/reactnativetracing.js.map +1 -1
- package/dist/js/tracing/reactnavigation.js.map +1 -1
- package/dist/js/version.d.ts +1 -1
- package/dist/js/version.js +1 -1
- package/dist/js/version.js.map +1 -1
- package/dist/js/wrapper.d.ts.map +1 -1
- package/dist/js/wrapper.js +1 -0
- package/dist/js/wrapper.js.map +1 -1
- package/ios/RNSentry+fetchNativeStack.m +1 -2
- package/ios/RNSentry.h +1 -2
- package/ios/RNSentry.mm +48 -68
- package/ios/RNSentryExperimentalOptions.h +7 -0
- package/ios/RNSentryExperimentalOptions.m +8 -0
- package/ios/RNSentryVersion.m +1 -1
- package/ios/Replay/RNSentryReplayMask.mm +1 -2
- package/ios/Replay/RNSentryReplayUnmask.mm +1 -2
- package/package.json +10 -10
- package/plugin/build/withSentryAndroidGradlePlugin.d.ts +1 -1
- package/plugin/build/withSentryAndroidGradlePlugin.js +1 -1
- package/scripts/expo-upload-sourcemaps.js +1 -1
- package/scripts/sentry-xcode.sh +2 -1
- package/sentry.gradle +8 -2
- package/ts3.8/dist/js/replay/mobilereplay.d.ts +1 -0
- package/ts3.8/dist/js/version.d.ts +1 -1
package/RNSentry.podspec
CHANGED
|
@@ -46,7 +46,7 @@ Pod::Spec.new do |s|
|
|
|
46
46
|
|
|
47
47
|
s.compiler_flags = other_cflags
|
|
48
48
|
|
|
49
|
-
s.dependency 'Sentry/HybridSDK', '8.56.
|
|
49
|
+
s.dependency 'Sentry/HybridSDK', '8.56.2'
|
|
50
50
|
|
|
51
51
|
if defined? install_modules_dependencies
|
|
52
52
|
# Default React Native dependencies for 0.71 and above (new and legacy architecture)
|
package/android/build.gradle
CHANGED
|
Binary file
|
|
@@ -2,7 +2,7 @@ package io.sentry.react;
|
|
|
2
2
|
|
|
3
3
|
class RNSentryVersion {
|
|
4
4
|
static final String REACT_NATIVE_SDK_PACKAGE_NAME = "npm:@sentry/react-native";
|
|
5
|
-
static final String REACT_NATIVE_SDK_PACKAGE_VERSION = "7.
|
|
5
|
+
static final String REACT_NATIVE_SDK_PACKAGE_VERSION = "7.3.0";
|
|
6
6
|
static final String NATIVE_SDK_NAME = "sentry.native.android.react-native";
|
|
7
7
|
static final String ANDROID_SDK_NAME = "sentry.java.android.react-native";
|
|
8
8
|
static final String REACT_NATIVE_SDK_NAME = "sentry.javascript.react-native";
|
package/dist/js/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/js/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAGV,QAAQ,EACR,KAAK,EACL,SAAS,EAET,aAAa,EACb,4BAA4B,EAC5B,YAAY,EACb,MAAM,cAAc,CAAC;AACtB,OAAO,EAGL,MAAM,EAIP,MAAM,cAAc,CAAC;AAKtB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAW1D;;;;;GAKG;AACH,qBAAa,iBAAkB,SAAQ,MAAM,CAAC,wBAAwB,CAAC;IACrE,OAAO,CAAC,eAAe,CAAY;IACnC,OAAO,CAAC,oBAAoB,CAA4C;IAExE;;;OAGG;gBACgB,OAAO,EAAE,wBAAwB;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/js/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAGV,QAAQ,EACR,KAAK,EACL,SAAS,EAET,aAAa,EACb,4BAA4B,EAC5B,YAAY,EACb,MAAM,cAAc,CAAC;AACtB,OAAO,EAGL,MAAM,EAIP,MAAM,cAAc,CAAC;AAKtB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAW1D;;;;;GAKG;AACH,qBAAa,iBAAkB,SAAQ,MAAM,CAAC,wBAAwB,CAAC;IACrE,OAAO,CAAC,eAAe,CAAY;IACnC,OAAO,CAAC,oBAAoB,CAA4C;IAExE;;;OAGG;gBACgB,OAAO,EAAE,wBAAwB;IA0CpD;;OAEG;IACI,kBAAkB,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,GAAE,SAAc,GAAG,WAAW,CAAC,KAAK,CAAC;IAIvF;;OAEG;IACI,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC;IAIrG;;;OAGG;IACI,WAAW,IAAI,IAAI;IAI1B;;OAEG;IACI,KAAK,IAAI,WAAW,CAAC,OAAO,CAAC;IAOpC;;;OAGG;IACI,mBAAmB,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI;IAUxD;;OAEG;IACI,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,WAAW,CAAC,4BAA4B,CAAC;IAiClF;;OAEG;IACI,IAAI,IAAI,IAAI;IAKnB;;;;OAIG;IACI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM,IAAI;IAKtD;;;;OAIG;IACI,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAKnD;;OAEG;IACH,OAAO,CAAC,cAAc;IA6BtB;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAShC;;OAEG;IACH,OAAO,CAAC,qBAAqB;CAa9B"}
|
package/dist/js/client.js
CHANGED
|
@@ -23,14 +23,11 @@ export class ReactNativeClient extends Client {
|
|
|
23
23
|
* @param options Configuration options for this SDK.
|
|
24
24
|
*/
|
|
25
25
|
constructor(options) {
|
|
26
|
-
var _a, _b;
|
|
26
|
+
var _a, _b, _c, _d;
|
|
27
27
|
ignoreRequireCycleLogs((_a = ReactNativeLibraries.ReactNativeVersion) === null || _a === void 0 ? void 0 : _a.version);
|
|
28
|
-
options._metadata = options._metadata || {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if ((_b = options._metadata) === null || _b === void 0 ? void 0 : _b.sdk) {
|
|
32
|
-
options._metadata.sdk.settings = Object.assign({ infer_ip: options.sendDefaultPii ? 'auto' : 'never' }, options._metadata.sdk.settings);
|
|
33
|
-
}
|
|
28
|
+
options._metadata = Object.assign(Object.assign({}, options._metadata), { sdk: Object.assign(Object.assign({}, (((_b = options._metadata) === null || _b === void 0 ? void 0 : _b.sdk) || defaultSdkInfo)), { settings: Object.assign({
|
|
29
|
+
// Only allow IP inferral by Relay if sendDefaultPii is true
|
|
30
|
+
infer_ip: options.sendDefaultPii ? 'auto' : 'never' }, (_d = (_c = options._metadata) === null || _c === void 0 ? void 0 : _c.sdk) === null || _d === void 0 ? void 0 : _d.settings) }) });
|
|
34
31
|
// We default this to true, as it is the safer scenario
|
|
35
32
|
options.parentSpanIsAlwaysRootSpan =
|
|
36
33
|
options.parentSpanIsAlwaysRootSpan === undefined ? true : options.parentSpanIsAlwaysRootSpan;
|
package/dist/js/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/js/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAYvE,OAAO,EACL,yBAAyB,EACzB,yBAAyB,EACzB,MAAM,EACN,sBAAsB,EACtB,KAAK,EACL,WAAW,GACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAGhE,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAEpC;;;;;GAK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AO,IAAI,IAAI,CAAC,QAAQ,CAAC,kBAAkB,EAAE;YAC/C,KAAK,CAAC,KAAK,CACT,QAAQ,EACR,6NAA6N,CAC9N,CAAC;SACH;IACH,CAAC;IAED;;OAEG;IACK,qBAAqB,CAAC,QAAmB,EAAE,QAA8B;QAC/E,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;YACvB,MAAM,gBAAgB,GAAqB;gBACzC,EAAE,IAAI,EAAE,eAAe,EAAE;gBACzB;oBACE,SAAS,EAAE,sBAAsB,EAAE;oBACnC,gBAAgB,EAAE,QAAQ;iBAC3B;aACF,CAAC;YAEF,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;SACxC;IACH,CAAC;CACF","sourcesContent":["import { eventFromException, eventFromMessage } from '@sentry/browser';\nimport type {\n ClientReportEnvelope,\n ClientReportItem,\n Envelope,\n Event,\n EventHint,\n Outcome,\n SeverityLevel,\n TransportMakeRequestResponse,\n UserFeedback,\n} from '@sentry/core';\nimport {\n _INTERNAL_flushLogsBuffer,\n addAutoIpAddressToSession,\n Client,\n dateTimestampInSeconds,\n debug,\n SentryError,\n} from '@sentry/core';\nimport { Alert } from 'react-native';\nimport { getDevServer } from './integrations/debugsymbolicatorutils';\nimport { defaultSdkInfo } from './integrations/sdkinfo';\nimport { getDefaultSidecarUrl } from './integrations/spotlight';\nimport type { ReactNativeClientOptions } from './options';\nimport type { mobileReplayIntegration } from './replay/mobilereplay';\nimport { MOBILE_REPLAY_INTEGRATION_NAME } from './replay/mobilereplay';\nimport { createUserFeedbackEnvelope, items } from './utils/envelope';\nimport { ignoreRequireCycleLogs } from './utils/ignorerequirecyclelogs';\nimport { mergeOutcomes } from './utils/outcome';\nimport { ReactNativeLibraries } from './utils/rnlibraries';\nimport { NATIVE } from './wrapper';\n\nconst DEFAULT_FLUSH_INTERVAL = 5000;\n\n/**\n * The Sentry React Native SDK Client.\n *\n * @see ReactNativeClientOptions for documentation on configuration options.\n * @see SentryClient for usage documentation.\n */\nexport class ReactNativeClient extends Client<ReactNativeClientOptions> {\n private _outcomesBuffer: Outcome[];\n private _logFlushIdleTimeout: ReturnType<typeof setTimeout> | undefined;\n\n /**\n * Creates a new React Native SDK instance.\n * @param options Configuration options for this SDK.\n */\n public constructor(options: ReactNativeClientOptions) {\n ignoreRequireCycleLogs(ReactNativeLibraries.ReactNativeVersion?.version);\n options._metadata = options._metadata || {};\n options._metadata.sdk = options._metadata.sdk || defaultSdkInfo;\n\n // Only allow IP inferral by Relay if sendDefaultPii is true\n if (options._metadata?.sdk) {\n options._metadata.sdk.settings = {\n infer_ip: options.sendDefaultPii ? 'auto' : 'never',\n ...options._metadata.sdk.settings,\n };\n }\n\n // We default this to true, as it is the safer scenario\n options.parentSpanIsAlwaysRootSpan =\n options.parentSpanIsAlwaysRootSpan === undefined ? true : options.parentSpanIsAlwaysRootSpan;\n super(options);\n\n this._outcomesBuffer = [];\n\n if (options.sendDefaultPii === true) {\n this.on('beforeSendSession', addAutoIpAddressToSession);\n }\n\n if (options.enableLogs) {\n this.on('flush', () => {\n _INTERNAL_flushLogsBuffer(this);\n });\n\n this.on('afterCaptureLog', () => {\n if (this._logFlushIdleTimeout) {\n clearTimeout(this._logFlushIdleTimeout);\n }\n\n this._logFlushIdleTimeout = setTimeout(() => {\n _INTERNAL_flushLogsBuffer(this);\n }, DEFAULT_FLUSH_INTERVAL);\n });\n }\n }\n\n /**\n * @inheritDoc\n */\n public eventFromException(exception: unknown, hint: EventHint = {}): PromiseLike<Event> {\n return eventFromException(this._options.stackParser, exception, hint, this._options.attachStacktrace);\n }\n\n /**\n * @inheritDoc\n */\n public eventFromMessage(message: string, level?: SeverityLevel, hint?: EventHint): PromiseLike<Event> {\n return eventFromMessage(this._options.stackParser, message, level, hint, this._options.attachStacktrace);\n }\n\n /**\n * If native client is available it will trigger a native crash.\n * Use this only for testing purposes.\n */\n public nativeCrash(): void {\n NATIVE.nativeCrash();\n }\n\n /**\n * @inheritDoc\n */\n public close(): PromiseLike<boolean> {\n // As super.close() flushes queued events, we wait for that to finish before closing the native SDK.\n return super.close().then((result: boolean) => {\n return NATIVE.closeNativeSdk().then(() => result) as PromiseLike<boolean>;\n });\n }\n\n /**\n * Sends user feedback to Sentry.\n * @deprecated Use `Sentry.captureFeedback` instead.\n */\n public captureUserFeedback(feedback: UserFeedback): void {\n const envelope = createUserFeedbackEnvelope(feedback, {\n metadata: this._options._metadata,\n dsn: this.getDsn(),\n tunnel: undefined,\n });\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.sendEnvelope(envelope);\n }\n\n /**\n * @inheritdoc\n */\n public sendEnvelope(envelope: Envelope): PromiseLike<TransportMakeRequestResponse> {\n const outcomes = this._clearOutcomes();\n this._outcomesBuffer = mergeOutcomes(this._outcomesBuffer, outcomes);\n\n if (this._options.sendClientReports) {\n this._attachClientReportTo(this._outcomesBuffer, envelope as ClientReportEnvelope);\n }\n\n let shouldClearOutcomesBuffer = true;\n if (this._isEnabled() && this._transport && this._dsn) {\n this.emit('beforeEnvelope', envelope);\n\n this._transport.send(envelope).then(null, reason => {\n if (reason instanceof SentryError) {\n // SentryError is thrown by SyncPromise\n shouldClearOutcomesBuffer = false;\n // If this is called asynchronously we want the _outcomesBuffer to be cleared\n debug.error('SentryError while sending event, keeping outcomes buffer:', reason);\n } else {\n debug.error('Error while sending event:', reason);\n }\n });\n } else {\n debug.error('Transport disabled');\n }\n\n if (shouldClearOutcomesBuffer) {\n this._outcomesBuffer = []; // if send fails synchronously the _outcomesBuffer will stay intact\n }\n\n return Promise.resolve({});\n }\n\n /**\n * @inheritDoc\n */\n public init(): void {\n super.init();\n this._initNativeSdk();\n }\n\n /**\n * Register a hook on this client.\n *\n * (Generic method signature to allow for custom React Native Client events.)\n */\n public on(hook: string, callback: unknown): () => void {\n // @ts-expect-error on from the base class doesn't support generic types\n return super.on(hook, callback);\n }\n\n /**\n * Emit a hook that was previously registered via `on()`.\n *\n * (Generic method signature to allow for custom React Native Client events.)\n */\n public emit(hook: string, ...rest: unknown[]): void {\n // @ts-expect-error emit from the base class doesn't support generic types\n super.emit(hook, ...rest);\n }\n\n /**\n * Starts native client with dsn and options\n */\n private _initNativeSdk(): void {\n NATIVE.initNativeSdk({\n ...this._options,\n defaultSidecarUrl: getDefaultSidecarUrl(),\n devServerUrl: getDevServer()?.url || '',\n mobileReplayOptions:\n this._integrations[MOBILE_REPLAY_INTEGRATION_NAME] &&\n 'options' in this._integrations[MOBILE_REPLAY_INTEGRATION_NAME]\n ? (this._integrations[MOBILE_REPLAY_INTEGRATION_NAME] as ReturnType<typeof mobileReplayIntegration>).options\n : undefined,\n })\n .then(\n (result: boolean) => {\n return result;\n },\n () => {\n this._showCannotConnectDialog();\n return false;\n },\n )\n .then((didCallNativeInit: boolean) => {\n this._options.onReady?.({ didCallNativeInit });\n this.emit('afterInit');\n })\n .then(undefined, error => {\n debug.error('The OnReady callback threw an error: ', error);\n });\n }\n\n /**\n * If the user is in development mode, and the native nagger is enabled then it will show an alert.\n */\n private _showCannotConnectDialog(): void {\n if (__DEV__ && this._options.enableNativeNagger) {\n Alert.alert(\n 'Sentry',\n 'Warning, could not connect to Sentry native SDK.\\nIf you do not want to use the native component please pass `enableNative: false` in the options.\\nVisit: https://docs.sentry.io/platforms/react-native/ for more details.',\n );\n }\n }\n\n /**\n * Attaches a client report from outcomes to the envelope.\n */\n private _attachClientReportTo(outcomes: Outcome[], envelope: ClientReportEnvelope): void {\n if (outcomes.length > 0) {\n const clientReportItem: ClientReportItem = [\n { type: 'client_report' },\n {\n timestamp: dateTimestampInSeconds(),\n discarded_events: outcomes,\n },\n ];\n\n envelope[items].push(clientReportItem);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/js/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAYvE,OAAO,EACL,yBAAyB,EACzB,yBAA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AAI,CACH,CAAC,MAAe,EAAE,EAAE;YAClB,OAAO,MAAM,CAAC;QAChB,CAAC,EACD,GAAG,EAAE;YACH,IAAI,CAAC,wBAAwB,EAAE,CAAC;YAChC,OAAO,KAAK,CAAC;QACf,CAAC,CACF;aACA,IAAI,CAAC,CAAC,iBAA0B,EAAE,EAAE;;YACnC,MAAA,MAAA,IAAI,CAAC,QAAQ,EAAC,OAAO,mDAAG,EAAE,iBAAiB,EAAE,CAAC,CAAC;YAC/C,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACzB,CAAC,CAAC;aACD,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE;YACvB,KAAK,CAAC,KAAK,CAAC,uCAAuC,EAAE,KAAK,CAAC,CAAC;QAC9D,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACK,wBAAwB;QAC9B,IAAI,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,kBAAkB,EAAE;YAC/C,KAAK,CAAC,KAAK,CACT,QAAQ,EACR,6NAA6N,CAC9N,CAAC;SACH;IACH,CAAC;IAED;;OAEG;IACK,qBAAqB,CAAC,QAAmB,EAAE,QAA8B;QAC/E,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;YACvB,MAAM,gBAAgB,GAAqB;gBACzC,EAAE,IAAI,EAAE,eAAe,EAAE;gBACzB;oBACE,SAAS,EAAE,sBAAsB,EAAE;oBACnC,gBAAgB,EAAE,QAAQ;iBAC3B;aACF,CAAC;YAEF,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;SACxC;IACH,CAAC;CACF","sourcesContent":["import { eventFromException, eventFromMessage } from '@sentry/browser';\nimport type {\n ClientReportEnvelope,\n ClientReportItem,\n Envelope,\n Event,\n EventHint,\n Outcome,\n SeverityLevel,\n TransportMakeRequestResponse,\n UserFeedback,\n} from '@sentry/core';\nimport {\n _INTERNAL_flushLogsBuffer,\n addAutoIpAddressToSession,\n Client,\n dateTimestampInSeconds,\n debug,\n SentryError,\n} from '@sentry/core';\nimport { Alert } from 'react-native';\nimport { getDevServer } from './integrations/debugsymbolicatorutils';\nimport { defaultSdkInfo } from './integrations/sdkinfo';\nimport { getDefaultSidecarUrl } from './integrations/spotlight';\nimport type { ReactNativeClientOptions } from './options';\nimport type { mobileReplayIntegration } from './replay/mobilereplay';\nimport { MOBILE_REPLAY_INTEGRATION_NAME } from './replay/mobilereplay';\nimport { createUserFeedbackEnvelope, items } from './utils/envelope';\nimport { ignoreRequireCycleLogs } from './utils/ignorerequirecyclelogs';\nimport { mergeOutcomes } from './utils/outcome';\nimport { ReactNativeLibraries } from './utils/rnlibraries';\nimport { NATIVE } from './wrapper';\n\nconst DEFAULT_FLUSH_INTERVAL = 5000;\n\n/**\n * The Sentry React Native SDK Client.\n *\n * @see ReactNativeClientOptions for documentation on configuration options.\n * @see SentryClient for usage documentation.\n */\nexport class ReactNativeClient extends Client<ReactNativeClientOptions> {\n private _outcomesBuffer: Outcome[];\n private _logFlushIdleTimeout: ReturnType<typeof setTimeout> | undefined;\n\n /**\n * Creates a new React Native SDK instance.\n * @param options Configuration options for this SDK.\n */\n public constructor(options: ReactNativeClientOptions) {\n ignoreRequireCycleLogs(ReactNativeLibraries.ReactNativeVersion?.version);\n options._metadata = {\n ...options._metadata,\n sdk: {\n ...(options._metadata?.sdk || defaultSdkInfo),\n settings: {\n // Only allow IP inferral by Relay if sendDefaultPii is true\n infer_ip: options.sendDefaultPii ? 'auto' : 'never',\n ...options._metadata?.sdk?.settings,\n },\n },\n };\n\n // We default this to true, as it is the safer scenario\n options.parentSpanIsAlwaysRootSpan =\n options.parentSpanIsAlwaysRootSpan === undefined ? true : options.parentSpanIsAlwaysRootSpan;\n super(options);\n\n this._outcomesBuffer = [];\n\n if (options.sendDefaultPii === true) {\n this.on('beforeSendSession', addAutoIpAddressToSession);\n }\n\n if (options.enableLogs) {\n this.on('flush', () => {\n _INTERNAL_flushLogsBuffer(this);\n });\n\n this.on('afterCaptureLog', () => {\n if (this._logFlushIdleTimeout) {\n clearTimeout(this._logFlushIdleTimeout);\n }\n\n this._logFlushIdleTimeout = setTimeout(() => {\n _INTERNAL_flushLogsBuffer(this);\n }, DEFAULT_FLUSH_INTERVAL);\n });\n }\n }\n\n /**\n * @inheritDoc\n */\n public eventFromException(exception: unknown, hint: EventHint = {}): PromiseLike<Event> {\n return eventFromException(this._options.stackParser, exception, hint, this._options.attachStacktrace);\n }\n\n /**\n * @inheritDoc\n */\n public eventFromMessage(message: string, level?: SeverityLevel, hint?: EventHint): PromiseLike<Event> {\n return eventFromMessage(this._options.stackParser, message, level, hint, this._options.attachStacktrace);\n }\n\n /**\n * If native client is available it will trigger a native crash.\n * Use this only for testing purposes.\n */\n public nativeCrash(): void {\n NATIVE.nativeCrash();\n }\n\n /**\n * @inheritDoc\n */\n public close(): PromiseLike<boolean> {\n // As super.close() flushes queued events, we wait for that to finish before closing the native SDK.\n return super.close().then((result: boolean) => {\n return NATIVE.closeNativeSdk().then(() => result);\n });\n }\n\n /**\n * Sends user feedback to Sentry.\n * @deprecated Use `Sentry.captureFeedback` instead.\n */\n public captureUserFeedback(feedback: UserFeedback): void {\n const envelope = createUserFeedbackEnvelope(feedback, {\n metadata: this._options._metadata,\n dsn: this.getDsn(),\n tunnel: undefined,\n });\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.sendEnvelope(envelope);\n }\n\n /**\n * @inheritdoc\n */\n public sendEnvelope(envelope: Envelope): PromiseLike<TransportMakeRequestResponse> {\n const outcomes = this._clearOutcomes();\n this._outcomesBuffer = mergeOutcomes(this._outcomesBuffer, outcomes);\n\n if (this._options.sendClientReports) {\n this._attachClientReportTo(this._outcomesBuffer, envelope as ClientReportEnvelope);\n }\n\n let shouldClearOutcomesBuffer = true;\n if (this._isEnabled() && this._transport && this._dsn) {\n this.emit('beforeEnvelope', envelope);\n\n this._transport.send(envelope).then(null, reason => {\n if (reason instanceof SentryError) {\n // SentryError is thrown by SyncPromise\n shouldClearOutcomesBuffer = false;\n // If this is called asynchronously we want the _outcomesBuffer to be cleared\n debug.error('SentryError while sending event, keeping outcomes buffer:', reason);\n } else {\n debug.error('Error while sending event:', reason);\n }\n });\n } else {\n debug.error('Transport disabled');\n }\n\n if (shouldClearOutcomesBuffer) {\n this._outcomesBuffer = []; // if send fails synchronously the _outcomesBuffer will stay intact\n }\n\n return Promise.resolve({});\n }\n\n /**\n * @inheritDoc\n */\n public init(): void {\n super.init();\n this._initNativeSdk();\n }\n\n /**\n * Register a hook on this client.\n *\n * (Generic method signature to allow for custom React Native Client events.)\n */\n public on(hook: string, callback: unknown): () => void {\n // @ts-expect-error on from the base class doesn't support generic types\n return super.on(hook, callback);\n }\n\n /**\n * Emit a hook that was previously registered via `on()`.\n *\n * (Generic method signature to allow for custom React Native Client events.)\n */\n public emit(hook: string, ...rest: unknown[]): void {\n // @ts-expect-error emit from the base class doesn't support generic types\n super.emit(hook, ...rest);\n }\n\n /**\n * Starts native client with dsn and options\n */\n private _initNativeSdk(): void {\n NATIVE.initNativeSdk({\n ...this._options,\n defaultSidecarUrl: getDefaultSidecarUrl(),\n devServerUrl: getDevServer()?.url || '',\n mobileReplayOptions:\n this._integrations[MOBILE_REPLAY_INTEGRATION_NAME] &&\n 'options' in this._integrations[MOBILE_REPLAY_INTEGRATION_NAME]\n ? (this._integrations[MOBILE_REPLAY_INTEGRATION_NAME] as ReturnType<typeof mobileReplayIntegration>).options\n : undefined,\n })\n .then(\n (result: boolean) => {\n return result;\n },\n () => {\n this._showCannotConnectDialog();\n return false;\n },\n )\n .then((didCallNativeInit: boolean) => {\n this._options.onReady?.({ didCallNativeInit });\n this.emit('afterInit');\n })\n .then(undefined, error => {\n debug.error('The OnReady callback threw an error: ', error);\n });\n }\n\n /**\n * If the user is in development mode, and the native nagger is enabled then it will show an alert.\n */\n private _showCannotConnectDialog(): void {\n if (__DEV__ && this._options.enableNativeNagger) {\n Alert.alert(\n 'Sentry',\n 'Warning, could not connect to Sentry native SDK.\\nIf you do not want to use the native component please pass `enableNative: false` in the options.\\nVisit: https://docs.sentry.io/platforms/react-native/ for more details.',\n );\n }\n }\n\n /**\n * Attaches a client report from outcomes to the envelope.\n */\n private _attachClientReportTo(outcomes: Outcome[], envelope: ClientReportEnvelope): void {\n if (outcomes.length > 0) {\n const clientReportItem: ClientReportItem = [\n { type: 'client_report' },\n {\n timestamp: dateTimestampInSeconds(),\n discarded_events: outcomes,\n },\n ];\n\n envelope[items].push(clientReportItem);\n }\n }\n}\n"]}
|
|
@@ -17,7 +17,7 @@ export const logEnricherIntegration = () => {
|
|
|
17
17
|
client.on('afterInit', () => {
|
|
18
18
|
cacheLogContext().then(() => {
|
|
19
19
|
client.on('beforeCaptureLog', (log) => {
|
|
20
|
-
processLog(log);
|
|
20
|
+
processLog(log, client);
|
|
21
21
|
});
|
|
22
22
|
}, reason => {
|
|
23
23
|
debug.log(reason);
|
|
@@ -27,6 +27,19 @@ export const logEnricherIntegration = () => {
|
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
29
|
let NativeCache = undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Sets a log attribute if the value exists and the attribute key is not already present.
|
|
32
|
+
*
|
|
33
|
+
* @param logAttributes - The log attributes object to modify.
|
|
34
|
+
* @param key - The attribute key to set.
|
|
35
|
+
* @param value - The value to set (only sets if truthy and key not present).
|
|
36
|
+
* @param setEvenIfPresent - Whether to set the attribute if it is present. Defaults to true.
|
|
37
|
+
*/
|
|
38
|
+
function setLogAttribute(logAttributes, key, value, setEvenIfPresent = true) {
|
|
39
|
+
if (value && (!logAttributes[key] || setEvenIfPresent)) {
|
|
40
|
+
logAttributes[key] = value;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
30
43
|
function cacheLogContext() {
|
|
31
44
|
var _a, _b, _c, _d, _e, _f;
|
|
32
45
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -49,17 +62,23 @@ function cacheLogContext() {
|
|
|
49
62
|
return Promise.resolve();
|
|
50
63
|
});
|
|
51
64
|
}
|
|
52
|
-
function processLog(log) {
|
|
65
|
+
function processLog(log, client) {
|
|
53
66
|
var _a;
|
|
54
67
|
if (NativeCache === undefined) {
|
|
55
68
|
return;
|
|
56
69
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
70
|
+
// Save log.attributes to a new variable
|
|
71
|
+
const logAttributes = (_a = log.attributes) !== null && _a !== void 0 ? _a : {};
|
|
72
|
+
// Use setLogAttribute with the variable instead of direct assignment
|
|
73
|
+
setLogAttribute(logAttributes, 'device.brand', NativeCache.brand);
|
|
74
|
+
setLogAttribute(logAttributes, 'device.model', NativeCache.model);
|
|
75
|
+
setLogAttribute(logAttributes, 'device.family', NativeCache.family);
|
|
76
|
+
setLogAttribute(logAttributes, 'os.name', NativeCache.os);
|
|
77
|
+
setLogAttribute(logAttributes, 'os.version', NativeCache.version);
|
|
78
|
+
setLogAttribute(logAttributes, 'sentry.release', NativeCache.release);
|
|
79
|
+
const replay = client.getIntegrationByName('MobileReplay');
|
|
80
|
+
setLogAttribute(logAttributes, 'sentry.replay_id', replay === null || replay === void 0 ? void 0 : replay.getReplayId());
|
|
81
|
+
// Set log.attributes to the variable
|
|
82
|
+
log.attributes = logAttributes;
|
|
64
83
|
}
|
|
65
84
|
//# sourceMappingURL=logEnricherIntegration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logEnricherIntegration.js","sourceRoot":"","sources":["../../../src/js/integrations/logEnricherIntegration.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAEvC,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAgB,EAAE;IACtD,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,KAAK,CAAC,MAAyB;YAC7B,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,GAAG,EAAE;gBAC1B,eAAe,EAAE,CAAC,IAAI,CACpB,GAAG,EAAE;oBACH,MAAM,CAAC,EAAE,CAAC,kBAAkB,EAAE,CAAC,GAAQ,EAAE,EAAE;wBACzC,UAAU,CAAC,GAAG,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"logEnricherIntegration.js","sourceRoot":"","sources":["../../../src/js/integrations/logEnricherIntegration.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAEvC,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAgB,EAAE;IACtD,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,KAAK,CAAC,MAAyB;YAC7B,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,GAAG,EAAE;gBAC1B,eAAe,EAAE,CAAC,IAAI,CACpB,GAAG,EAAE;oBACH,MAAM,CAAC,EAAE,CAAC,kBAAkB,EAAE,CAAC,GAAQ,EAAE,EAAE;wBACzC,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;oBAC1B,CAAC,CAAC,CAAC;gBACL,CAAC,EACD,MAAM,CAAC,EAAE;oBACP,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;gBACpB,CAAC,CACF,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,IAAI,WAAW,GAAwC,SAAS,CAAC;AAEjE;;;;;;;GAOG;AACH,SAAS,eAAe,CACtB,aAAsC,EACtC,GAAW,EACX,KAAc,EACd,gBAAgB,GAAG,IAAI;IAEvB,IAAI,KAAK,IAAI,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI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E,CAAC;IAE3C,qEAAqE;IACrE,eAAe,CAAC,aAAa,EAAE,cAAc,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;IAClE,eAAe,CAAC,aAAa,EAAE,cAAc,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;IAClE,eAAe,CAAC,aAAa,EAAE,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACpE,eAAe,CAAC,aAAa,EAAE,SAAS,EAAE,WAAW,CAAC,EAAE,CAAC,CAAC;IAC1D,eAAe,CAAC,aAAa,EAAE,YAAY,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAClE,eAAe,CAAC,aAAa,EAAE,gBAAgB,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAEtE,MAAM,MAAM,GAAG,MAAM,CAAC,oBAAoB,CAAqD,cAAc,CAAC,CAAC;IAC/G,eAAe,CAAC,aAAa,EAAE,kBAAkB,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,WAAW,EAAE,CAAC,CAAC;IAE1E,qCAAqC;IACrC,GAAG,CAAC,UAAU,GAAG,aAAa,CAAC;AACjC,CAAC","sourcesContent":["/* eslint-disable complexity */\nimport type { Integration, Log } from '@sentry/core';\nimport { debug } from '@sentry/core';\nimport type { ReactNativeClient } from '../client';\nimport { NATIVE } from '../wrapper';\n\nconst INTEGRATION_NAME = 'LogEnricher';\n\nexport const logEnricherIntegration = (): Integration => {\n return {\n name: INTEGRATION_NAME,\n setup(client: ReactNativeClient) {\n client.on('afterInit', () => {\n cacheLogContext().then(\n () => {\n client.on('beforeCaptureLog', (log: Log) => {\n processLog(log, client);\n });\n },\n reason => {\n debug.log(reason);\n },\n );\n });\n },\n };\n};\n\nlet NativeCache: Record<string, unknown> | undefined = undefined;\n\n/**\n * Sets a log attribute if the value exists and the attribute key is not already present.\n *\n * @param logAttributes - The log attributes object to modify.\n * @param key - The attribute key to set.\n * @param value - The value to set (only sets if truthy and key not present).\n * @param setEvenIfPresent - Whether to set the attribute if it is present. Defaults to true.\n */\nfunction setLogAttribute(\n logAttributes: Record<string, unknown>,\n key: string,\n value: unknown,\n setEvenIfPresent = true,\n): void {\n if (value && (!logAttributes[key] || setEvenIfPresent)) {\n logAttributes[key] = value;\n }\n}\n\nasync function cacheLogContext(): Promise<void> {\n try {\n const response = await NATIVE.fetchNativeLogAttributes();\n\n NativeCache = {\n ...(response?.contexts?.device && {\n brand: response.contexts.device?.brand,\n model: response.contexts.device?.model,\n family: response.contexts.device?.family,\n }),\n ...(response?.contexts?.os && {\n os: response.contexts.os.name,\n version: response.contexts.os.version,\n }),\n ...(response?.contexts?.release && {\n release: response.contexts.release,\n }),\n };\n } catch (e) {\n return Promise.reject(`[LOGS]: Failed to prepare attributes from Native Layer: ${e}`);\n }\n return Promise.resolve();\n}\n\nfunction processLog(log: Log, client: ReactNativeClient): void {\n if (NativeCache === undefined) {\n return;\n }\n\n // Save log.attributes to a new variable\n const logAttributes = log.attributes ?? {};\n\n // Use setLogAttribute with the variable instead of direct assignment\n setLogAttribute(logAttributes, 'device.brand', NativeCache.brand);\n setLogAttribute(logAttributes, 'device.model', NativeCache.model);\n setLogAttribute(logAttributes, 'device.family', NativeCache.family);\n setLogAttribute(logAttributes, 'os.name', NativeCache.os);\n setLogAttribute(logAttributes, 'os.version', NativeCache.version);\n setLogAttribute(logAttributes, 'sentry.release', NativeCache.release);\n\n const replay = client.getIntegrationByName<Integration & { getReplayId: () => string | null }>('MobileReplay');\n setLogAttribute(logAttributes, 'sentry.replay_id', replay?.getReplayId());\n\n // Set log.attributes to the variable\n log.attributes = logAttributes;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../src/js/playground/modal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../src/js/playground/modal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAkB/B;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,oBAAoB,kEAEtB;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAE,2BAa3D,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;MAMzB,MAAM,YA+HT,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable max-lines */
|
|
2
2
|
import { debug } from '@sentry/core';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import { Animated, Image, Modal, Platform, Pressable,
|
|
4
|
+
import { Animated, Image, Modal, Platform, Pressable, StyleSheet, Text, useColorScheme, View, } from 'react-native';
|
|
5
5
|
import { getDevServer } from '../integrations/debugsymbolicatorutils';
|
|
6
6
|
import { isExpo, isExpoGo, isWeb } from '../utils/environment';
|
|
7
7
|
import { bug as bugAnimation, hi as hiAnimation, thumbsup as thumbsupAnimation } from './animations';
|
|
@@ -76,7 +76,7 @@ export const SentryPlayground = ({ projectId, organizationSlug, }) => {
|
|
|
76
76
|
return (React.createElement(Modal, { presentationStyle: "formSheet", visible: show, animationType: "slide", onRequestClose: () => {
|
|
77
77
|
setShow(false);
|
|
78
78
|
} },
|
|
79
|
-
React.createElement(
|
|
79
|
+
React.createElement(View, { style: styles.background },
|
|
80
80
|
React.createElement(View, { style: styles.container },
|
|
81
81
|
React.createElement(Text, { style: styles.welcomeText }, "Welcome to Sentry Playground!"),
|
|
82
82
|
React.createElement(Animated.View, { style: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.js","sourceRoot":"","sources":["../../../src/js/playground/modal.tsx"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,QAAQ,EACR,KA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KAEnC,aAAa,kCACR,iBAAiB,CAAC,aAAa,KAClC,WAAW,EAAE,oBAAoB,EACjC,eAAe,EAAE,oBAAoB,KAEvC,uBAAuB,kCAClB,iBAAiB,CAAC,uBAAuB,KAC5C,eAAe,EAAE,oBAAoB,OAEvC,CAAC;AAEH,SAAS,gBAAgB,CAAC,GAAW;IACnC,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IACjC,IAAI,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,GAAG,EAAE;QAClB,sDAAsD;QACtD,4DAA4D;QAC5D,KAAK,CAAC,GAAG,SAAS,CAAC,GAAG,UAAU,EAAE;YAChC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,CAAC;SAC9B,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;YACX,KAAK,CAAC,KAAK,CAAC,oBAAoB,EAAE,CAAC,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;KACJ;SAAM;QACL,KAAK,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;KAC7C;AACH,CAAC","sourcesContent":["/* eslint-disable max-lines */\nimport { debug } from '@sentry/core';\nimport * as React from 'react';\nimport {\n Animated,\n Image,\n Modal,\n Platform,\n Pressable,\n SafeAreaView,\n StyleSheet,\n Text,\n useColorScheme,\n View,\n} from 'react-native';\nimport { getDevServer } from '../integrations/debugsymbolicatorutils';\nimport { isExpo, isExpoGo, isWeb } from '../utils/environment';\nimport { bug as bugAnimation, hi as hiAnimation, thumbsup as thumbsupAnimation } from './animations';\nimport { nativeCrashExample, tryCatchExample, uncaughtErrorExample } from './examples';\nimport { bug as bugImage, hi as hiImage, thumbsup as thumbsupImage } from './images';\n\n/**\n * Wrapper to add Sentry Playground to your application\n * to test your Sentry React Native SDK setup.\n *\n * @example\n * ```tsx\n * import * as Sentry from '@sentry/react-native';\n * import { withSentryPlayground } from '@sentry/react-native/playground';\n *\n * function App() {\n * return <View>...</View>;\n * }\n *\n * export default withSentryPlayground(Sentry.wrap(App), {\n * projectId: '123456',\n * organizationSlug: 'my-org'\n * });\n * ```\n */\nexport const withSentryPlayground = <P extends object>(\n Component: React.ComponentType<P>,\n options: { projectId?: string; organizationSlug?: string } = {},\n): React.ComponentType<P> => {\n const Wrapper = (props: P): React.ReactElement => {\n return (\n <>\n <SentryPlayground projectId={options.projectId} organizationSlug={options.organizationSlug} />\n <Component {...props} />\n </>\n );\n };\n\n Wrapper.displayName = 'withSentryPlayground()';\n return Wrapper;\n};\n\nexport const SentryPlayground = ({\n projectId,\n organizationSlug,\n}: {\n projectId?: string;\n organizationSlug?: string;\n}): React.ReactElement => {\n const issuesStreamUrl =\n projectId && organizationSlug\n ? `https://${organizationSlug}.sentry.io/issues/?project=${projectId}&statsPeriod=1h`\n : 'https://sentry.io/';\n const styles = useColorScheme() === 'dark' ? defaultDarkStyles : lightStyles;\n\n const [show, setShow] = React.useState(true);\n const [animation, setAnimation] = React.useState('hi');\n\n const onAnimationPress = (): void => {\n switch (animation) {\n case 'hi':\n setAnimation('thumbsup');\n break;\n default:\n setAnimation('hi');\n }\n };\n\n const showOpenSentryButton = !isExpo();\n const isNativeCrashDisabled = isWeb() || isExpoGo() || __DEV__;\n\n const animationContainerYPosition = React.useRef(new Animated.Value(0)).current;\n\n const springAnimation = Animated.sequence([\n Animated.timing(animationContainerYPosition, {\n toValue: -50,\n duration: 300,\n useNativeDriver: true,\n }),\n Animated.spring(animationContainerYPosition, {\n toValue: 0,\n friction: 4,\n tension: 40,\n useNativeDriver: true,\n }),\n ]);\n\n const changeAnimationToBug = (func: () => void): void => {\n setAnimation('bug');\n springAnimation.start(() => {\n func();\n });\n };\n\n return (\n <Modal\n presentationStyle=\"formSheet\"\n visible={show}\n animationType=\"slide\"\n onRequestClose={() => {\n setShow(false);\n }}\n >\n <SafeAreaView style={styles.background}>\n <View style={styles.container}>\n <Text style={styles.welcomeText}>Welcome to Sentry Playground!</Text>\n <Animated.View\n style={{\n width: '100%',\n alignItems: 'center',\n justifyContent: 'center',\n transform: [{ translateY: animationContainerYPosition }],\n }}\n onTouchEnd={() => {\n springAnimation.start();\n }}\n >\n <Pressable onPress={onAnimationPress}>\n <Animation id={animation} />\n </Pressable>\n </Animated.View>\n <View style={styles.listContainer}>\n <Row\n title={'captureException()'}\n description={'In a try-catch scenario, errors can be reported using manual APIs.'}\n actionDescription={'Try'}\n action={tryCatchExample}\n />\n <Row\n title={'throw new Error()'}\n description={'Uncaught errors are automatically reported by the React Native Global Handler.'}\n actionDescription={'Throw'}\n action={() => changeAnimationToBug(uncaughtErrorExample)}\n />\n <Row\n title={'throw RuntimeException()'}\n description={\n isNativeCrashDisabled\n ? 'For testing native crashes, build the mobile application in release mode.'\n : 'Unhandled errors in native layers such as Java, Objective-C, C, Swift, or Kotlin are automatically reported.'\n }\n actionDescription={'Crash'}\n action={nativeCrashExample}\n last\n disabled={isNativeCrashDisabled}\n />\n </View>\n <View style={{ marginTop: 40 }} />\n <View\n style={{\n width: '100%',\n flexDirection: 'row', // Arrange buttons horizontally\n justifyContent: 'space-evenly', // Space between buttons\n }}\n >\n {showOpenSentryButton && (\n <Button\n secondary\n title={'Open Sentry'}\n onPress={() => {\n openURLInBrowser(issuesStreamUrl);\n }}\n />\n )}\n <Button\n title={'Go to my App'}\n onPress={() => {\n setShow(false);\n }}\n />\n </View>\n </View>\n </SafeAreaView>\n </Modal>\n );\n};\n\nconst Animation = ({ id }: { id: string }): React.ReactElement | null => {\n const shouldFallbackToImage = Platform.OS === 'android';\n\n switch (id) {\n case 'hi':\n return (\n <Image source={{ uri: shouldFallbackToImage ? hiImage : hiAnimation }} style={{ width: 100, height: 100 }} />\n );\n case 'bug':\n return (\n <Image source={{ uri: shouldFallbackToImage ? bugImage : bugAnimation }} style={{ width: 100, height: 100 }} />\n );\n case 'thumbsup':\n return (\n <Image\n source={{ uri: shouldFallbackToImage ? thumbsupImage : thumbsupAnimation }}\n style={{ width: 100, height: 100 }}\n />\n );\n default:\n return null;\n }\n};\n\nconst Row = ({\n last = false,\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n action = () => {},\n actionDescription = '',\n title,\n description,\n disabled = false,\n}: {\n last?: boolean;\n action?: () => void;\n actionDescription?: string;\n title: string;\n description: string;\n disabled?: boolean;\n}): React.ReactElement => {\n const styles = useColorScheme() === 'dark' ? defaultDarkStyles : lightStyles;\n\n return (\n <View style={[styles.rowContainer, last && styles.lastRowContainer]}>\n <View style={{ flexShrink: 1, paddingRight: 12 }}>\n <Text style={styles.rowTitle}>{title}</Text>\n <Text style={{ color: 'rgb(146, 130, 170)', fontSize: 12 }}>{description}</Text>\n </View>\n <View>\n <Button disabled={disabled} secondary onPress={action} title={actionDescription} />\n </View>\n </View>\n );\n};\n\nconst Button = ({\n onPress,\n title,\n secondary,\n disabled = false,\n}: {\n onPress: () => void;\n title: string;\n secondary?: boolean;\n disabled?: boolean;\n}): React.ReactElement => {\n const styles = useColorScheme() === 'dark' ? defaultDarkStyles : lightStyles;\n\n return (\n <View style={[styles.buttonBottomLayer, styles.buttonCommon, secondary && styles.buttonSecondaryBottomLayer]}>\n <Pressable\n style={({ pressed }) => [\n styles.buttonMainContainer,\n pressed && styles.buttonMainContainerPressed,\n styles.buttonCommon,\n secondary && styles.buttonSecondaryContainer,\n disabled && styles.buttonDisabledContainer,\n ]}\n onPress={onPress}\n disabled={disabled}\n >\n <Text\n style={[styles.buttonText, secondary && styles.buttonSecondaryText, disabled && styles.buttonDisabledText]}\n >\n {title}\n </Text>\n </Pressable>\n </View>\n );\n};\n\nconst defaultDarkStyles = StyleSheet.create({\n welcomeText: { color: 'rgb(246, 245, 250)', fontSize: 24, fontWeight: 'bold' },\n background: {\n flex: 1,\n backgroundColor: 'rgb(26, 20, 31)',\n width: '100%',\n minHeight: '100%',\n alignItems: 'center', // Center content horizontally\n justifyContent: 'center', // Center content vertically\n },\n container: {\n flex: 1,\n flexDirection: 'column',\n padding: 12,\n marginTop: 20,\n width: '100%',\n alignItems: 'center', // Center image and button container\n justifyContent: 'space-evenly', // Center image and button container\n },\n buttonContainer: {\n flexDirection: 'row', // Arrange buttons horizontally\n marginTop: 20, // Add some space above the buttons\n },\n listContainer: {\n backgroundColor: 'rgb(39, 36, 51)',\n width: '100%',\n flexDirection: 'column',\n marginTop: 20, // Add some space above the buttons\n borderColor: 'rgb(7, 5, 15)',\n borderWidth: 1,\n borderRadius: 8,\n },\n rowTitle: {\n color: 'rgb(246, 245, 250)',\n fontSize: 14,\n fontWeight: 'bold',\n textAlign: 'left',\n fontFamily: 'Menlo',\n },\n rowContainer: {\n overflow: 'hidden',\n flexDirection: 'row',\n justifyContent: 'space-between', // Space between buttons\n paddingTop: 16,\n paddingBottom: 10,\n paddingHorizontal: 10,\n borderColor: 'rgb(7, 5, 15)',\n borderBottomWidth: 1,\n },\n lastRowContainer: {\n borderBottomWidth: 0, // Remove border for the last row\n },\n buttonCommon: {\n borderRadius: 8,\n },\n buttonBottomLayer: {\n backgroundColor: 'rgb(7, 5, 15)',\n },\n buttonMainContainer: {\n paddingVertical: 8,\n paddingHorizontal: 13,\n backgroundColor: 'rgb(117, 83, 255)',\n transform: [{ translateY: -4 }],\n borderWidth: 1,\n borderColor: 'rgb(7, 5, 15)',\n },\n buttonSecondaryContainer: {\n backgroundColor: 'rgb(39, 36, 51)',\n },\n buttonSecondaryBottomLayer: {},\n buttonSecondaryText: {},\n buttonMainContainerPressed: {\n transform: [{ translateY: 0 }],\n },\n buttonText: {\n color: 'rgb(246, 245, 250)',\n fontSize: 16,\n fontWeight: 'bold',\n textAlign: 'center',\n },\n buttonDisabledText: {\n color: 'rgb(146, 130, 170)',\n },\n buttonDisabledContainer: {\n transform: [{ translateY: -2 }],\n backgroundColor: 'rgb(39, 36, 51)',\n },\n});\n\nconst lightStyles: typeof defaultDarkStyles = StyleSheet.create({\n ...defaultDarkStyles,\n welcomeText: {\n ...defaultDarkStyles.welcomeText,\n color: 'rgb(24, 20, 35)',\n },\n background: {\n ...defaultDarkStyles.background,\n backgroundColor: 'rgb(251, 250, 255)',\n },\n buttonMainContainer: {\n ...defaultDarkStyles.buttonMainContainer,\n backgroundColor: 'rgb(117, 83, 255)',\n borderColor: 'rgb(85, 61, 184)',\n },\n buttonBottomLayer: {\n backgroundColor: 'rgb(85, 61, 184)',\n },\n buttonSecondaryContainer: {\n backgroundColor: 'rgb(255, 255, 255)',\n borderColor: 'rgb(218, 215, 229)',\n },\n buttonSecondaryBottomLayer: {\n backgroundColor: 'rgb(218, 215, 229)',\n },\n buttonText: {\n ...defaultDarkStyles.buttonText,\n },\n buttonSecondaryText: {\n ...defaultDarkStyles.buttonText,\n color: 'rgb(24, 20, 35)',\n },\n rowTitle: {\n ...defaultDarkStyles.rowTitle,\n color: 'rgb(24, 20, 35)',\n },\n rowContainer: {\n ...defaultDarkStyles.rowContainer,\n borderColor: 'rgb(218, 215, 229)',\n },\n listContainer: {\n ...defaultDarkStyles.listContainer,\n borderColor: 'rgb(218, 215, 229)',\n backgroundColor: 'rgb(255, 255, 255)',\n },\n buttonDisabledContainer: {\n ...defaultDarkStyles.buttonDisabledContainer,\n backgroundColor: 'rgb(238, 235, 249)',\n },\n});\n\nfunction openURLInBrowser(url: string): void {\n const devServer = getDevServer();\n if (devServer?.url) {\n // This doesn't work for Expo project with Web enabled\n // disable-next-line @typescript-eslint/no-floating-promises\n fetch(`${devServer.url}open-url`, {\n method: 'POST',\n body: JSON.stringify({ url }),\n }).catch(e => {\n debug.error('Error opening URL:', e);\n });\n } else {\n debug.error('Dev server URL not available');\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"modal.js","sourceRoot":"","sources":["../../../src/js/playground/modal.tsx"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,QAAQ,EACR,KAAK,EACL,KAAK,EACL,QAAQ,EACR,SAAS,EACT,UA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E,oBAAoB,EACjC,eAAe,EAAE,oBAAoB,KAEvC,uBAAuB,kCAClB,iBAAiB,CAAC,uBAAuB,KAC5C,eAAe,EAAE,oBAAoB,OAEvC,CAAC;AAEH,SAAS,gBAAgB,CAAC,GAAW;IACnC,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IACjC,IAAI,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,GAAG,EAAE;QAClB,sDAAsD;QACtD,4DAA4D;QAC5D,KAAK,CAAC,GAAG,SAAS,CAAC,GAAG,UAAU,EAAE;YAChC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,CAAC;SAC9B,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;YACX,KAAK,CAAC,KAAK,CAAC,oBAAoB,EAAE,CAAC,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;KACJ;SAAM;QACL,KAAK,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;KAC7C;AACH,CAAC","sourcesContent":["/* eslint-disable max-lines */\nimport { debug } from '@sentry/core';\nimport * as React from 'react';\nimport {\n Animated,\n Image,\n Modal,\n Platform,\n Pressable,\n StyleSheet,\n Text,\n useColorScheme,\n View,\n} from 'react-native';\nimport { getDevServer } from '../integrations/debugsymbolicatorutils';\nimport { isExpo, isExpoGo, isWeb } from '../utils/environment';\nimport { bug as bugAnimation, hi as hiAnimation, thumbsup as thumbsupAnimation } from './animations';\nimport { nativeCrashExample, tryCatchExample, uncaughtErrorExample } from './examples';\nimport { bug as bugImage, hi as hiImage, thumbsup as thumbsupImage } from './images';\n\n/**\n * Wrapper to add Sentry Playground to your application\n * to test your Sentry React Native SDK setup.\n *\n * @example\n * ```tsx\n * import * as Sentry from '@sentry/react-native';\n * import { withSentryPlayground } from '@sentry/react-native/playground';\n *\n * function App() {\n * return <View>...</View>;\n * }\n *\n * export default withSentryPlayground(Sentry.wrap(App), {\n * projectId: '123456',\n * organizationSlug: 'my-org'\n * });\n * ```\n */\nexport const withSentryPlayground = <P extends object>(\n Component: React.ComponentType<P>,\n options: { projectId?: string; organizationSlug?: string } = {},\n): React.ComponentType<P> => {\n const Wrapper = (props: P): React.ReactElement => {\n return (\n <>\n <SentryPlayground projectId={options.projectId} organizationSlug={options.organizationSlug} />\n <Component {...props} />\n </>\n );\n };\n\n Wrapper.displayName = 'withSentryPlayground()';\n return Wrapper;\n};\n\nexport const SentryPlayground = ({\n projectId,\n organizationSlug,\n}: {\n projectId?: string;\n organizationSlug?: string;\n}): React.ReactElement => {\n const issuesStreamUrl =\n projectId && organizationSlug\n ? `https://${organizationSlug}.sentry.io/issues/?project=${projectId}&statsPeriod=1h`\n : 'https://sentry.io/';\n const styles = useColorScheme() === 'dark' ? defaultDarkStyles : lightStyles;\n\n const [show, setShow] = React.useState(true);\n const [animation, setAnimation] = React.useState('hi');\n\n const onAnimationPress = (): void => {\n switch (animation) {\n case 'hi':\n setAnimation('thumbsup');\n break;\n default:\n setAnimation('hi');\n }\n };\n\n const showOpenSentryButton = !isExpo();\n const isNativeCrashDisabled = isWeb() || isExpoGo() || __DEV__;\n\n const animationContainerYPosition = React.useRef(new Animated.Value(0)).current;\n\n const springAnimation = Animated.sequence([\n Animated.timing(animationContainerYPosition, {\n toValue: -50,\n duration: 300,\n useNativeDriver: true,\n }),\n Animated.spring(animationContainerYPosition, {\n toValue: 0,\n friction: 4,\n tension: 40,\n useNativeDriver: true,\n }),\n ]);\n\n const changeAnimationToBug = (func: () => void): void => {\n setAnimation('bug');\n springAnimation.start(() => {\n func();\n });\n };\n\n return (\n <Modal\n presentationStyle=\"formSheet\"\n visible={show}\n animationType=\"slide\"\n onRequestClose={() => {\n setShow(false);\n }}\n >\n <View style={styles.background}>\n <View style={styles.container}>\n <Text style={styles.welcomeText}>Welcome to Sentry Playground!</Text>\n <Animated.View\n style={{\n width: '100%',\n alignItems: 'center',\n justifyContent: 'center',\n transform: [{ translateY: animationContainerYPosition }],\n }}\n onTouchEnd={() => {\n springAnimation.start();\n }}\n >\n <Pressable onPress={onAnimationPress}>\n <Animation id={animation} />\n </Pressable>\n </Animated.View>\n <View style={styles.listContainer}>\n <Row\n title={'captureException()'}\n description={'In a try-catch scenario, errors can be reported using manual APIs.'}\n actionDescription={'Try'}\n action={tryCatchExample}\n />\n <Row\n title={'throw new Error()'}\n description={'Uncaught errors are automatically reported by the React Native Global Handler.'}\n actionDescription={'Throw'}\n action={() => changeAnimationToBug(uncaughtErrorExample)}\n />\n <Row\n title={'throw RuntimeException()'}\n description={\n isNativeCrashDisabled\n ? 'For testing native crashes, build the mobile application in release mode.'\n : 'Unhandled errors in native layers such as Java, Objective-C, C, Swift, or Kotlin are automatically reported.'\n }\n actionDescription={'Crash'}\n action={nativeCrashExample}\n last\n disabled={isNativeCrashDisabled}\n />\n </View>\n <View style={{ marginTop: 40 }} />\n <View\n style={{\n width: '100%',\n flexDirection: 'row', // Arrange buttons horizontally\n justifyContent: 'space-evenly', // Space between buttons\n }}\n >\n {showOpenSentryButton && (\n <Button\n secondary\n title={'Open Sentry'}\n onPress={() => {\n openURLInBrowser(issuesStreamUrl);\n }}\n />\n )}\n <Button\n title={'Go to my App'}\n onPress={() => {\n setShow(false);\n }}\n />\n </View>\n </View>\n </View>\n </Modal>\n );\n};\n\nconst Animation = ({ id }: { id: string }): React.ReactElement | null => {\n const shouldFallbackToImage = Platform.OS === 'android';\n\n switch (id) {\n case 'hi':\n return (\n <Image source={{ uri: shouldFallbackToImage ? hiImage : hiAnimation }} style={{ width: 100, height: 100 }} />\n );\n case 'bug':\n return (\n <Image source={{ uri: shouldFallbackToImage ? bugImage : bugAnimation }} style={{ width: 100, height: 100 }} />\n );\n case 'thumbsup':\n return (\n <Image\n source={{ uri: shouldFallbackToImage ? thumbsupImage : thumbsupAnimation }}\n style={{ width: 100, height: 100 }}\n />\n );\n default:\n return null;\n }\n};\n\nconst Row = ({\n last = false,\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n action = () => {},\n actionDescription = '',\n title,\n description,\n disabled = false,\n}: {\n last?: boolean;\n action?: () => void;\n actionDescription?: string;\n title: string;\n description: string;\n disabled?: boolean;\n}): React.ReactElement => {\n const styles = useColorScheme() === 'dark' ? defaultDarkStyles : lightStyles;\n\n return (\n <View style={[styles.rowContainer, last && styles.lastRowContainer]}>\n <View style={{ flexShrink: 1, paddingRight: 12 }}>\n <Text style={styles.rowTitle}>{title}</Text>\n <Text style={{ color: 'rgb(146, 130, 170)', fontSize: 12 }}>{description}</Text>\n </View>\n <View>\n <Button disabled={disabled} secondary onPress={action} title={actionDescription} />\n </View>\n </View>\n );\n};\n\nconst Button = ({\n onPress,\n title,\n secondary,\n disabled = false,\n}: {\n onPress: () => void;\n title: string;\n secondary?: boolean;\n disabled?: boolean;\n}): React.ReactElement => {\n const styles = useColorScheme() === 'dark' ? defaultDarkStyles : lightStyles;\n\n return (\n <View style={[styles.buttonBottomLayer, styles.buttonCommon, secondary && styles.buttonSecondaryBottomLayer]}>\n <Pressable\n style={({ pressed }) => [\n styles.buttonMainContainer,\n pressed && styles.buttonMainContainerPressed,\n styles.buttonCommon,\n secondary && styles.buttonSecondaryContainer,\n disabled && styles.buttonDisabledContainer,\n ]}\n onPress={onPress}\n disabled={disabled}\n >\n <Text\n style={[styles.buttonText, secondary && styles.buttonSecondaryText, disabled && styles.buttonDisabledText]}\n >\n {title}\n </Text>\n </Pressable>\n </View>\n );\n};\n\nconst defaultDarkStyles = StyleSheet.create({\n welcomeText: { color: 'rgb(246, 245, 250)', fontSize: 24, fontWeight: 'bold' },\n background: {\n flex: 1,\n backgroundColor: 'rgb(26, 20, 31)',\n width: '100%',\n minHeight: '100%',\n alignItems: 'center', // Center content horizontally\n justifyContent: 'center', // Center content vertically\n },\n container: {\n flex: 1,\n flexDirection: 'column',\n padding: 12,\n marginTop: 20,\n width: '100%',\n alignItems: 'center', // Center image and button container\n justifyContent: 'space-evenly', // Center image and button container\n },\n buttonContainer: {\n flexDirection: 'row', // Arrange buttons horizontally\n marginTop: 20, // Add some space above the buttons\n },\n listContainer: {\n backgroundColor: 'rgb(39, 36, 51)',\n width: '100%',\n flexDirection: 'column',\n marginTop: 20, // Add some space above the buttons\n borderColor: 'rgb(7, 5, 15)',\n borderWidth: 1,\n borderRadius: 8,\n },\n rowTitle: {\n color: 'rgb(246, 245, 250)',\n fontSize: 14,\n fontWeight: 'bold',\n textAlign: 'left',\n fontFamily: 'Menlo',\n },\n rowContainer: {\n overflow: 'hidden',\n flexDirection: 'row',\n justifyContent: 'space-between', // Space between buttons\n paddingTop: 16,\n paddingBottom: 10,\n paddingHorizontal: 10,\n borderColor: 'rgb(7, 5, 15)',\n borderBottomWidth: 1,\n },\n lastRowContainer: {\n borderBottomWidth: 0, // Remove border for the last row\n },\n buttonCommon: {\n borderRadius: 8,\n },\n buttonBottomLayer: {\n backgroundColor: 'rgb(7, 5, 15)',\n },\n buttonMainContainer: {\n paddingVertical: 8,\n paddingHorizontal: 13,\n backgroundColor: 'rgb(117, 83, 255)',\n transform: [{ translateY: -4 }],\n borderWidth: 1,\n borderColor: 'rgb(7, 5, 15)',\n },\n buttonSecondaryContainer: {\n backgroundColor: 'rgb(39, 36, 51)',\n },\n buttonSecondaryBottomLayer: {},\n buttonSecondaryText: {},\n buttonMainContainerPressed: {\n transform: [{ translateY: 0 }],\n },\n buttonText: {\n color: 'rgb(246, 245, 250)',\n fontSize: 16,\n fontWeight: 'bold',\n textAlign: 'center',\n },\n buttonDisabledText: {\n color: 'rgb(146, 130, 170)',\n },\n buttonDisabledContainer: {\n transform: [{ translateY: -2 }],\n backgroundColor: 'rgb(39, 36, 51)',\n },\n});\n\nconst lightStyles: typeof defaultDarkStyles = StyleSheet.create({\n ...defaultDarkStyles,\n welcomeText: {\n ...defaultDarkStyles.welcomeText,\n color: 'rgb(24, 20, 35)',\n },\n background: {\n ...defaultDarkStyles.background,\n backgroundColor: 'rgb(251, 250, 255)',\n },\n buttonMainContainer: {\n ...defaultDarkStyles.buttonMainContainer,\n backgroundColor: 'rgb(117, 83, 255)',\n borderColor: 'rgb(85, 61, 184)',\n },\n buttonBottomLayer: {\n backgroundColor: 'rgb(85, 61, 184)',\n },\n buttonSecondaryContainer: {\n backgroundColor: 'rgb(255, 255, 255)',\n borderColor: 'rgb(218, 215, 229)',\n },\n buttonSecondaryBottomLayer: {\n backgroundColor: 'rgb(218, 215, 229)',\n },\n buttonText: {\n ...defaultDarkStyles.buttonText,\n },\n buttonSecondaryText: {\n ...defaultDarkStyles.buttonText,\n color: 'rgb(24, 20, 35)',\n },\n rowTitle: {\n ...defaultDarkStyles.rowTitle,\n color: 'rgb(24, 20, 35)',\n },\n rowContainer: {\n ...defaultDarkStyles.rowContainer,\n borderColor: 'rgb(218, 215, 229)',\n },\n listContainer: {\n ...defaultDarkStyles.listContainer,\n borderColor: 'rgb(218, 215, 229)',\n backgroundColor: 'rgb(255, 255, 255)',\n },\n buttonDisabledContainer: {\n ...defaultDarkStyles.buttonDisabledContainer,\n backgroundColor: 'rgb(238, 235, 249)',\n },\n});\n\nfunction openURLInBrowser(url: string): void {\n const devServer = getDevServer();\n if (devServer?.url) {\n // This doesn't work for Expo project with Web enabled\n // disable-next-line @typescript-eslint/no-floating-promises\n fetch(`${devServer.url}open-url`, {\n method: 'POST',\n body: JSON.stringify({ url }),\n }).catch(e => {\n debug.error('Error opening URL:', e);\n });\n } else {\n debug.error('Dev server URL not available');\n }\n}\n"]}
|
|
@@ -59,6 +59,7 @@ export interface MobileReplayOptions {
|
|
|
59
59
|
}
|
|
60
60
|
type MobileReplayIntegration = Integration & {
|
|
61
61
|
options: Required<MobileReplayOptions>;
|
|
62
|
+
getReplayId: () => string | null;
|
|
62
63
|
};
|
|
63
64
|
/**
|
|
64
65
|
* The Mobile Replay Integration, let's you adjust the default mobile replay options.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mobilereplay.d.ts","sourceRoot":"","sources":["../../../src/js/replay/mobilereplay.ts"],"names":[],"mappings":"AA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AAM,MAAM,GAAG,IAAI,CAAC;CAClC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,uBAAuB,iBAAiB,mBAAmB,KAAoB,uBA2E3F,CAAC"}
|
|
@@ -64,15 +64,18 @@ export const mobileReplayIntegration = (initOptions = defaultOptions) => {
|
|
|
64
64
|
// Event is not an error, will not capture replay
|
|
65
65
|
return event;
|
|
66
66
|
}
|
|
67
|
-
const recordingReplayId = NATIVE.getCurrentReplayId();
|
|
68
|
-
if (recordingReplayId) {
|
|
69
|
-
debug.log(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} assign already recording replay ${recordingReplayId} for event ${event.event_id}.`);
|
|
70
|
-
return event;
|
|
71
|
-
}
|
|
72
67
|
const replayId = yield NATIVE.captureReplay(isHardCrash(event));
|
|
73
68
|
if (!replayId) {
|
|
74
|
-
|
|
75
|
-
|
|
69
|
+
const recordingReplayId = NATIVE.getCurrentReplayId();
|
|
70
|
+
if (recordingReplayId) {
|
|
71
|
+
debug.log(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} assign already recording replay ${recordingReplayId} for event ${event.event_id}.`);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
debug.log(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} not sampled for event ${event.event_id}.`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
debug.log(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} Captured recording replay ${replayId} for event ${event.event_id}.`);
|
|
76
79
|
}
|
|
77
80
|
return event;
|
|
78
81
|
});
|
|
@@ -93,6 +96,9 @@ export const mobileReplayIntegration = (initOptions = defaultOptions) => {
|
|
|
93
96
|
});
|
|
94
97
|
client.on('beforeAddBreadcrumb', enrichXhrBreadcrumbsForMobileReplay);
|
|
95
98
|
}
|
|
99
|
+
function getReplayId() {
|
|
100
|
+
return NATIVE.getCurrentReplayId();
|
|
101
|
+
}
|
|
96
102
|
// TODO: When adding manual API, ensure overlap with the web replay so users can use the same API interchangeably
|
|
97
103
|
// https://github.com/getsentry/sentry-javascript/blob/develop/packages/replay-internal/src/integration.ts#L45
|
|
98
104
|
return {
|
|
@@ -100,12 +106,14 @@ export const mobileReplayIntegration = (initOptions = defaultOptions) => {
|
|
|
100
106
|
setup,
|
|
101
107
|
processEvent,
|
|
102
108
|
options: options,
|
|
109
|
+
getReplayId: getReplayId,
|
|
103
110
|
};
|
|
104
111
|
};
|
|
105
112
|
const mobileReplayIntegrationNoop = () => {
|
|
106
113
|
return {
|
|
107
114
|
name: MOBILE_REPLAY_INTEGRATION_NAME,
|
|
108
115
|
options: defaultOptions,
|
|
116
|
+
getReplayId: () => null, // Mock implementation for noop version
|
|
109
117
|
};
|
|
110
118
|
};
|
|
111
119
|
//# sourceMappingURL=mobilereplay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mobilereplay.js","sourceRoot":"","sources":["../../../src/js/replay/mobilereplay.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,mCAAmC,EAAE,MAAM,YAAY,CAAC;AAEjE,MAAM,CAAC,MAAM,8BAA8B,GAAG,cAAc,CAAC;AAiE7D,MAAM,cAAc,GAAkC;IACpD,WAAW,EAAE,IAAI;IACjB,aAAa,EAAE,IAAI;IACnB,cAAc,EAAE,IAAI;IACpB,8BAA8B,EAAE,KAAK;IACrC,oBAAoB,EAAE,IAAI;IAC1B,uBAAuB,EAAE,KAAK;CAC/B,CAAC;AAEF,SAAS,YAAY,CAAC,W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c;QAC3B,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;YACrB,OAAO;SACR;QAED,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,GAA2B,EAAE,EAAE;YACrD,IAAI,GAAG,CAAC,SAAS,EAAE;gBACjB,OAAO;aACR;YAED,6GAA6G;YAC7G,MAAM,eAAe,GAAG,MAAM,CAAC,kBAAkB,EAAE,CAAC;YACpD,IAAI,eAAe,EAAE;gBACnB,GAAG,CAAC,SAAS,GAAG,eAAe,CAAC;aACjC;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,mCAAmC,CAAC,CAAC;IACxE,CAAC;IAED,SAAS,WAAW;QAClB,OAAO,MAAM,CAAC,kBAAkB,EAAE,CAAC;IACrC,CAAC;IAED,iHAAiH;IACjH,8GAA8G;IAC9G,OAAO;QACL,IAAI,EAAE,8BAA8B;QACpC,KAAK;QACL,YAAY;QACZ,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE,WAAW;KACzB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,2BAA2B,GAAG,GAA4B,EAAE;IAChE,OAAO;QACL,IAAI,EAAE,8BAA8B;QACpC,OAAO,EAAE,cAAc;QACvB,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,uCAAuC;KACjE,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { Client, DynamicSamplingContext, Event, Integration } from '@sentry/core';\nimport { debug } from '@sentry/core';\nimport { isHardCrash } from '../misc';\nimport { hasHooks } from '../utils/clientutils';\nimport { isExpoGo, notMobileOs } from '../utils/environment';\nimport { NATIVE } from '../wrapper';\nimport { enrichXhrBreadcrumbsForMobileReplay } from './xhrUtils';\n\nexport const MOBILE_REPLAY_INTEGRATION_NAME = 'MobileReplay';\n\nexport interface MobileReplayOptions {\n /**\n * Mask all text in recordings\n *\n * @default true\n */\n maskAllText?: boolean;\n\n /**\n * Mask all images in recordings\n *\n * @default true\n */\n maskAllImages?: boolean;\n\n /**\n * Mask all vector graphics in recordings\n * Supports `react-native-svg`\n *\n * @default true\n */\n maskAllVectors?: boolean;\n\n /**\n * Enables the up to 5x faster experimental view renderer used by the Session Replay integration on iOS.\n *\n * Enabling this flag will reduce the amount of time it takes to render each frame of the session replay on the main thread, therefore reducing\n * interruptions and visual lag.\n *\n * - Experiment: This is an experimental feature and is therefore disabled by default.\n *\n * @deprecated Use `enableViewRendererV2` instead.\n */\n enableExperimentalViewRenderer?: boolean;\n\n /**\n * Enables up to 5x faster new view renderer used by the Session Replay integration on iOS.\n *\n * Enabling this flag will reduce the amount of time it takes to render each frame of the session replay on the main thread, therefore reducing\n * interruptions and visual lag. [Our benchmarks](https://github.com/getsentry/sentry-cocoa/pull/4940) have shown a significant improvement of\n * **up to 4-5x faster rendering** (reducing `~160ms` to `~36ms` per frame) on older devices.\n *\n * - Experiment: In case you are noticing issues with the new view renderer, please report the issue on [GitHub](https://github.com/getsentry/sentry-cocoa).\n * Eventually, we will remove this feature flag and use the new view renderer by default.\n *\n * @default true\n */\n enableViewRendererV2?: boolean;\n\n /**\n * Enables up to 5x faster but incomplete view rendering used by the Session Replay integration on iOS.\n *\n * Enabling this flag will reduce the amount of time it takes to render each frame of the session replay on the main thread, therefore reducing\n * interruptions and visual lag.\n *\n * - Note: This flag can only be used together with `enableExperimentalViewRenderer` with up to 20% faster render times.\n * - Experiment: This is an experimental feature and is therefore disabled by default.\n *\n * @default false\n */\n enableFastViewRendering?: boolean;\n}\n\nconst defaultOptions: Required<MobileReplayOptions> = {\n maskAllText: true,\n maskAllImages: true,\n maskAllVectors: true,\n enableExperimentalViewRenderer: false,\n enableViewRendererV2: true,\n enableFastViewRendering: false,\n};\n\nfunction mergeOptions(initOptions: Partial<MobileReplayOptions>): Required<MobileReplayOptions> {\n const merged = {\n ...defaultOptions,\n ...initOptions,\n };\n\n if (initOptions.enableViewRendererV2 === undefined && initOptions.enableExperimentalViewRenderer !== undefined) {\n merged.enableViewRendererV2 = initOptions.enableExperimentalViewRenderer;\n }\n\n return merged;\n}\n\ntype MobileReplayIntegration = Integration & {\n options: Required<MobileReplayOptions>;\n getReplayId: () => string | null;\n};\n\n/**\n * The Mobile Replay Integration, let's you adjust the default mobile replay options.\n * To be passed to `Sentry.init` with `replaysOnErrorSampleRate` or `replaysSessionSampleRate`.\n *\n * ```javascript\n * Sentry.init({\n * replaysOnErrorSampleRate: 1.0,\n * replaysSessionSampleRate: 1.0,\n * integrations: [mobileReplayIntegration({\n * // Adjust the default options\n * })],\n * });\n * ```\n *\n * @experimental\n */\nexport const mobileReplayIntegration = (initOptions: MobileReplayOptions = defaultOptions): MobileReplayIntegration => {\n if (isExpoGo()) {\n debug.warn(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} is not supported in Expo Go. Use EAS Build or \\`expo prebuild\\` to enable it.`,\n );\n }\n if (notMobileOs()) {\n debug.warn(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} is not supported on this platform.`);\n }\n\n if (isExpoGo() || notMobileOs()) {\n return mobileReplayIntegrationNoop();\n }\n\n const options = mergeOptions(initOptions);\n\n async function processEvent(event: Event): Promise<Event> {\n const hasException = event.exception?.values && event.exception.values.length > 0;\n if (!hasException) {\n // Event is not an error, will not capture replay\n return event;\n }\n\n const replayId = await NATIVE.captureReplay(isHardCrash(event));\n if (!replayId) {\n const recordingReplayId = NATIVE.getCurrentReplayId();\n if (recordingReplayId) {\n debug.log(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} assign already recording replay ${recordingReplayId} for event ${event.event_id}.`,\n );\n } else {\n debug.log(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} not sampled for event ${event.event_id}.`);\n }\n } else {\n debug.log(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} Captured recording replay ${replayId} for event ${event.event_id}.`,\n );\n }\n\n return event;\n }\n\n function setup(client: Client): void {\n if (!hasHooks(client)) {\n return;\n }\n\n client.on('createDsc', (dsc: DynamicSamplingContext) => {\n if (dsc.replay_id) {\n return;\n }\n\n // TODO: For better performance, we should emit replayId changes on native, and hold the replayId value in JS\n const currentReplayId = NATIVE.getCurrentReplayId();\n if (currentReplayId) {\n dsc.replay_id = currentReplayId;\n }\n });\n\n client.on('beforeAddBreadcrumb', enrichXhrBreadcrumbsForMobileReplay);\n }\n\n function getReplayId(): string | null {\n return NATIVE.getCurrentReplayId();\n }\n\n // TODO: When adding manual API, ensure overlap with the web replay so users can use the same API interchangeably\n // https://github.com/getsentry/sentry-javascript/blob/develop/packages/replay-internal/src/integration.ts#L45\n return {\n name: MOBILE_REPLAY_INTEGRATION_NAME,\n setup,\n processEvent,\n options: options,\n getReplayId: getReplayId,\n };\n};\n\nconst mobileReplayIntegrationNoop = (): MobileReplayIntegration => {\n return {\n name: MOBILE_REPLAY_INTEGRATION_NAME,\n options: defaultOptions,\n getReplayId: () => null, // Mock implementation for noop version\n };\n};\n"]}
|
|
@@ -25,7 +25,7 @@ export interface SentryExpoConfigOptions {
|
|
|
25
25
|
/**
|
|
26
26
|
* Pass a custom `getDefaultConfig` function to override the default Expo configuration getter.
|
|
27
27
|
*/
|
|
28
|
-
getDefaultConfig?:
|
|
28
|
+
getDefaultConfig?: (projectRoot: string, options?: Record<string, unknown>) => Record<string, unknown>;
|
|
29
29
|
/**
|
|
30
30
|
* For Expo Web, inject `release` and `version` options from `app.json`, the Expo Application Config.
|
|
31
31
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metroconfig.d.ts","sourceRoot":"","sources":["../../../src/js/tools/metroconfig.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAsC,MAAM,OAAO,CAAC;AAY7E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAErE,cAAc,yBAAyB,CAAC;AAIxC,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,uBAAuB,CAAC,EACpB,OAAO,GACP;QAC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K,CAAC,IAAI,KAAK,QAAQ;QAC9B,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,6CAA6C,CAAC;YACjE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,wCAAwC,CAAC,CAAC,CAAC;IAEnE,MAAM,cAAc,GAAG,CAAC,KAAiB,EAAkC,EAAE;QAC3E,MAAM,8BAA8B,GAAG,CACrC,qBAAsD,EACjC,EAAE,CAAC,iCACrB,qBAAqB,KACxB,QAAQ,EAAE,CAAA,qBAAqB,aAArB,qBAAqB,uBAArB,qBAAqB,CAAE,QAAQ,KAAI,4BAA4B,CAAC,KAAK,CAAC,IAChF,CAAC;QAEH,MAAM,yBAAyB,GAAG,CAAA,sBAAsB,aAAtB,sBAAsB,uBAAtB,sBAAsB,CAAG,KAAK,CAAC,KAAI,SAAS,CAAC;QAE/E,IAAI,yBAAyB,KAAK,SAAS,IAAI,MAAM,IAAI,yBAAyB,EAAE;YAClF,OAAO,yBAAyB,CAAC,IAAI,CAAsB,qBAAqB,CAAC,EAAE,CACjF,8BAA8B,CAAC,qBAAqB,CAAC,CACtD,CAAC;SACH;QAED,OAAO,8BAA8B,CAAC,yBAAyB,CAAC,CAAC;IACnE,CAAC,CAAC;IAEF,uCACK,MAAM,KACT,YAAY,kCACP,MAAM,CAAC,YAAY,KACtB,cAAc,OAEhB;AACJ,CAAC;AAjCD,8DAiCC;AAED;;;;GAIG;AACH,SAAS,8BAA8B;IACrC,aAAG,CAAC,6BAA6B,GAAG,MAAM,CAAC;AAC7C,CAAC","sourcesContent":["import { debug } from '@sentry/core';\nimport type { MetroConfig, MixedOutput, Module, ReadOnlyGraph } from 'metro';\nimport type { CustomResolutionContext, CustomResolver, Resolution } from 'metro-resolver';\nimport * as process from 'process';\nimport { env } from 'process';\nimport { enableLogger } from './enableLogger';\nimport { withSentryMiddleware } from './metroMiddleware';\nimport {\n setSentryBabelTransformerOptions,\n setSentryDefaultBabelTransformerPathEnv,\n} from './sentryBabelTransformerUtils';\nimport { createSentryMetroSerializer, unstableBeforeAssetSerializationDebugIdPlugin } from './sentryMetroSerializer';\nimport { unstableReleaseConstantsPlugin } from './sentryReleaseInjector';\nimport type { DefaultConfigOptions } from './vendor/expo/expoconfig';\n\nexport * from './sentryMetroSerializer';\n\nenableLogger();\n\nexport interface SentryMetroConfigOptions {\n /**\n * Annotates React components with Sentry data.\n * @default false\n */\n annotateReactComponents?:\n | boolean\n | {\n ignoredComponents?: string[];\n };\n /**\n * Adds the Sentry replay package for web.\n * @default true\n */\n includeWebReplay?: boolean;\n /**\n * Add Sentry Metro Server Middleware which\n * enables the app to fetch stack frames source context.\n * @default true\n */\n enableSourceContextInDevelopment?: boolean;\n}\n\nexport interface SentryExpoConfigOptions {\n /**\n * Pass a custom `getDefaultConfig` function to override the default Expo configuration getter.\n */\n getDefaultConfig?: typeof getSentryExpoConfig;\n\n /**\n * For Expo Web, inject `release` and `version` options from `app.json`, the Expo Application Config.\n *\n * @default true\n */\n injectReleaseForWeb?: boolean;\n}\n\n/**\n * Adds Sentry to the Metro config.\n *\n * Adds Debug ID to the output bundle and source maps.\n * Collapses Sentry frames from the stack trace view in LogBox.\n */\nexport function withSentryConfig(\n config: MetroConfig,\n {\n annotateReactComponents = false,\n includeWebReplay = true,\n enableSourceContextInDevelopment = true,\n }: SentryMetroConfigOptions = {},\n): MetroConfig {\n setSentryMetroDevServerEnvFlag();\n\n let newConfig = config;\n\n newConfig = withSentryDebugId(newConfig);\n newConfig = withSentryFramesCollapsed(newConfig);\n if (annotateReactComponents) {\n newConfig = withSentryBabelTransformer(newConfig, annotateReactComponents);\n }\n if (includeWebReplay === false) {\n newConfig = withSentryResolver(newConfig, includeWebReplay);\n }\n if (enableSourceContextInDevelopment) {\n newConfig = withSentryMiddleware(newConfig);\n }\n\n return newConfig;\n}\n\n/**\n * This function returns Default Expo configuration with Sentry plugins.\n */\nexport function getSentryExpoConfig(\n projectRoot: string,\n options: DefaultConfigOptions & SentryExpoConfigOptions & SentryMetroConfigOptions = {},\n): MetroConfig {\n setSentryMetroDevServerEnvFlag();\n\n const getDefaultConfig = options.getDefaultConfig || loadExpoMetroConfigModule().getDefaultConfig;\n const config = getDefaultConfig(projectRoot, {\n ...options,\n unstable_beforeAssetSerializationPlugins: [\n ...(options.unstable_beforeAssetSerializationPlugins || []),\n ...(options.injectReleaseForWeb ?? true ? [unstableReleaseConstantsPlugin(projectRoot)] : []),\n unstableBeforeAssetSerializationDebugIdPlugin,\n ],\n });\n\n let newConfig = withSentryFramesCollapsed(config);\n if (options.annotateReactComponents) {\n newConfig = withSentryBabelTransformer(newConfig, options.annotateReactComponents);\n }\n\n if (options.includeWebReplay === false) {\n newConfig = withSentryResolver(newConfig, options.includeWebReplay);\n }\n\n if (options.enableSourceContextInDevelopment ?? true) {\n newConfig = withSentryMiddleware(newConfig);\n }\n\n return newConfig;\n}\n\nfunction loadExpoMetroConfigModule(): {\n getDefaultConfig: (\n projectRoot: string,\n options: {\n unstable_beforeAssetSerializationPlugins?: ((serializationInput: {\n graph: ReadOnlyGraph<MixedOutput>;\n premodules: Module[];\n debugId?: string;\n }) => Module[])[];\n },\n ) => MetroConfig;\n} {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n return require('expo/metro-config');\n } catch (e) {\n throw new Error('Unable to load `expo/metro-config`. Make sure you have Expo installed.');\n }\n}\n\n/**\n * Adds Sentry Babel transformer to the Metro config.\n */\nexport function withSentryBabelTransformer(\n config: MetroConfig,\n annotateReactComponents: true | { ignoredComponents?: string[] },\n): MetroConfig {\n const defaultBabelTransformerPath = config.transformer?.babelTransformerPath;\n debug.log('Default Babel transformer path from `config.transformer`:', defaultBabelTransformerPath);\n\n if (!defaultBabelTransformerPath) {\n // This has to be console.warn because the options is enabled but won't be used\n // eslint-disable-next-line no-console\n console.warn('`transformer.babelTransformerPath` is undefined.');\n // eslint-disable-next-line no-console\n console.warn('Sentry Babel transformer cannot be used. Not adding it...');\n return config;\n }\n\n if (defaultBabelTransformerPath) {\n setSentryDefaultBabelTransformerPathEnv(defaultBabelTransformerPath);\n }\n\n if (typeof annotateReactComponents === 'object') {\n setSentryBabelTransformerOptions({\n annotateReactComponents,\n });\n }\n\n return {\n ...config,\n transformer: {\n ...config.transformer,\n babelTransformerPath: require.resolve('./sentryBabelTransformer'),\n },\n };\n}\n\ntype MetroCustomSerializer = Required<Required<MetroConfig>['serializer']>['customSerializer'] | undefined;\n\nfunction withSentryDebugId(config: MetroConfig): MetroConfig {\n const customSerializer = createSentryMetroSerializer(\n config.serializer?.customSerializer || undefined,\n ) as MetroCustomSerializer;\n // MetroConfig types customSerializers as async only, but sync returns are also supported\n // The default serializer is sync\n\n return {\n ...config,\n serializer: {\n ...config.serializer,\n customSerializer,\n },\n };\n}\n\n// Based on: https://github.com/facebook/metro/blob/c21daba415ea26511e157f794689caab9abe8236/packages/metro-resolver/src/resolve.js#L86-L91\ntype CustomResolverBeforeMetro068 = (\n context: CustomResolutionContext,\n realModuleName: string,\n platform: string | null,\n moduleName?: string,\n) => Resolution;\n\n/**\n * Includes `@sentry/replay` packages based on the `includeWebReplay` flag and current bundle `platform`.\n */\nexport function withSentryResolver(config: MetroConfig, includeWebReplay: boolean | undefined): MetroConfig {\n const originalResolver = config.resolver?.resolveRequest as CustomResolver | CustomResolverBeforeMetro068 | undefined;\n\n const sentryResolverRequest: CustomResolver = (\n context: CustomResolutionContext,\n moduleName: string,\n platform: string | null,\n oldMetroModuleName?: string,\n ) => {\n if (\n (includeWebReplay === false ||\n (includeWebReplay === undefined && (platform === 'android' || platform === 'ios'))) &&\n !!(oldMetroModuleName ?? moduleName).match(/@sentry(?:-internal)?\\/replay/)\n ) {\n return { type: 'empty' } as Resolution;\n }\n if (originalResolver) {\n return oldMetroModuleName\n ? originalResolver(context, moduleName, platform, oldMetroModuleName)\n : originalResolver(context, moduleName, platform);\n }\n\n // Prior 0.68, resolve context.resolveRequest is sentryResolver itself, where on later version it is the default resolver.\n if (context.resolveRequest === sentryResolverRequest) {\n // eslint-disable-next-line no-console\n console.error(\n `Error: [@sentry/react-native/metro] Can not resolve the defaultResolver on Metro older than 0.68.\nPlease follow one of the following options:\n- Include your resolverRequest on your metroconfig.\n- Update your Metro version to 0.68 or higher.\n- Set includeWebReplay as true on your metro config.\n- If you are still facing issues, report the issue at http://www.github.com/getsentry/sentry-react-native/issues`,\n );\n // Return required for test.\n return process.exit(-1);\n }\n\n return context.resolveRequest(context, moduleName, platform);\n };\n\n return {\n ...config,\n resolver: {\n ...config.resolver,\n resolveRequest: sentryResolverRequest,\n },\n };\n}\n\ntype MetroFrame = Parameters<Required<Required<MetroConfig>['symbolicator']>['customizeFrame']>[0];\ntype MetroCustomizeFrame = { readonly collapse?: boolean };\ntype MetroCustomizeFrameReturnValue =\n | ReturnType<Required<Required<MetroConfig>['symbolicator']>['customizeFrame']>\n | undefined;\n\n/**\n * Collapses Sentry internal frames from the stack trace view in LogBox.\n */\nexport function withSentryFramesCollapsed(config: MetroConfig): MetroConfig {\n const originalCustomizeFrame = config.symbolicator?.customizeFrame;\n const collapseSentryInternalFrames = (frame: MetroFrame): boolean =>\n typeof frame.file === 'string' &&\n (frame.file.includes('node_modules/@sentry/core/cjs/instrument.js') ||\n frame.file.includes('node_modules/@sentry/core/cjs/debug.js'));\n\n const customizeFrame = (frame: MetroFrame): MetroCustomizeFrameReturnValue => {\n const originalOrSentryCustomizeFrame = (\n originalCustomization: MetroCustomizeFrame | undefined,\n ): MetroCustomizeFrame => ({\n ...originalCustomization,\n collapse: originalCustomization?.collapse || collapseSentryInternalFrames(frame),\n });\n\n const maybePromiseCustomization = originalCustomizeFrame?.(frame) || undefined;\n\n if (maybePromiseCustomization !== undefined && 'then' in maybePromiseCustomization) {\n return maybePromiseCustomization.then<MetroCustomizeFrame>(originalCustomization =>\n originalOrSentryCustomizeFrame(originalCustomization),\n );\n }\n\n return originalOrSentryCustomizeFrame(maybePromiseCustomization);\n };\n\n return {\n ...config,\n symbolicator: {\n ...config.symbolicator,\n customizeFrame,\n },\n };\n}\n\n/**\n * Sets the `___SENTRY_METRO_DEV_SERVER___` environment flag.\n * This is used to determine if the SDK is running in Node in Metro Dev Server.\n * For example during static routes generation in `expo-router`.\n */\nfunction setSentryMetroDevServerEnvFlag(): void {\n env.___SENTRY_METRO_DEV_SERVER___ = 'true';\n}\n"]}
|
|
1
|
+
{"version":3,"file":"metroconfig.js","sourceRoot":"","sources":["../../../src/js/tools/metroconfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,uCAAqC;AAGrC,mCAAmC;AACnC,qCAA8B;AAC9B,iDAA8C;AAC9C,uDAAyD;AACzD,+EAGuC;AACvC,mEAAqH;AACrH,mEAAyE;AAGzE,0DAAwC;AAExC,IAAA,2BAAY,GAAE,CAAC;AAuCf;;;;;GAKG;AACH,SAAgB,gBAAgB,CAC9B,MAAmB,EACnB,EACE,uBAAuB,GAAG,KAAK,EAC/B,gBAAgB,GAAG,IAAI,EACvB,gCAAgC,GAAG,IAAI,MACX,EAAE;IAEhC,8BAA8B,EAAE,CAAC;IAEjC,IAAI,SAAS,GAAG,MAAM,CAAC;IAEvB,SAAS,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC;IACzC,SAAS,GAAG,yBAAyB,CAAC,SAAS,CAAC,CAAC;IACjD,IAAI,uBAAuB,EAAE;QAC3B,SAAS,GAAG,0BAA0B,CAAC,SAAS,EAAE,uBAAuB,CAAC,CAAC;KAC5E;IACD,IAAI,gBAAgB,KAAK,KAAK,EAAE;QAC9B,SAAS,GAAG,kBAAkB,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;KAC7D;IACD,IAAI,gCAAgC,EAAE;QACpC,SAAS,GAAG,IAAA,sCAAoB,EAAC,SAAS,CAAC,CAAC;KAC7C;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAzBD,4CAyBC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CACjC,WAAmB,EACnB,UAAqF,EAAE;;IAEvF,8BAA8B,EAAE,CAAC;IAEjC,M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AAM,8BAA8B,GAAG,CACrC,qBAAsD,EACjC,EAAE,CAAC,iCACrB,qBAAqB,KACxB,QAAQ,EAAE,CAAA,qBAAqB,aAArB,qBAAqB,uBAArB,qBAAqB,CAAE,QAAQ,KAAI,4BAA4B,CAAC,KAAK,CAAC,IAChF,CAAC;QAEH,MAAM,yBAAyB,GAAG,CAAA,sBAAsB,aAAtB,sBAAsB,uBAAtB,sBAAsB,CAAG,KAAK,CAAC,KAAI,SAAS,CAAC;QAE/E,IAAI,yBAAyB,KAAK,SAAS,IAAI,MAAM,IAAI,yBAAyB,EAAE;YAClF,OAAO,yBAAyB,CAAC,IAAI,CAAsB,qBAAqB,CAAC,EAAE,CACjF,8BAA8B,CAAC,qBAAqB,CAAC,CACtD,CAAC;SACH;QAED,OAAO,8BAA8B,CAAC,yBAAyB,CAAC,CAAC;IACnE,CAAC,CAAC;IAEF,uCACK,MAAM,KACT,YAAY,kCACP,MAAM,CAAC,YAAY,KACtB,cAAc,OAEhB;AACJ,CAAC;AAjCD,8DAiCC;AAED;;;;GAIG;AACH,SAAS,8BAA8B;IACrC,aAAG,CAAC,6BAA6B,GAAG,MAAM,CAAC;AAC7C,CAAC","sourcesContent":["import { debug } from '@sentry/core';\nimport type { MetroConfig, MixedOutput, Module, ReadOnlyGraph } from 'metro';\nimport type { CustomResolutionContext, CustomResolver, Resolution } from 'metro-resolver';\nimport * as process from 'process';\nimport { env } from 'process';\nimport { enableLogger } from './enableLogger';\nimport { withSentryMiddleware } from './metroMiddleware';\nimport {\n setSentryBabelTransformerOptions,\n setSentryDefaultBabelTransformerPathEnv,\n} from './sentryBabelTransformerUtils';\nimport { createSentryMetroSerializer, unstableBeforeAssetSerializationDebugIdPlugin } from './sentryMetroSerializer';\nimport { unstableReleaseConstantsPlugin } from './sentryReleaseInjector';\nimport type { DefaultConfigOptions } from './vendor/expo/expoconfig';\n\nexport * from './sentryMetroSerializer';\n\nenableLogger();\n\nexport interface SentryMetroConfigOptions {\n /**\n * Annotates React components with Sentry data.\n * @default false\n */\n annotateReactComponents?:\n | boolean\n | {\n ignoredComponents?: string[];\n };\n /**\n * Adds the Sentry replay package for web.\n * @default true\n */\n includeWebReplay?: boolean;\n /**\n * Add Sentry Metro Server Middleware which\n * enables the app to fetch stack frames source context.\n * @default true\n */\n enableSourceContextInDevelopment?: boolean;\n}\n\nexport interface SentryExpoConfigOptions {\n /**\n * Pass a custom `getDefaultConfig` function to override the default Expo configuration getter.\n */\n getDefaultConfig?: (projectRoot: string, options?: Record<string, unknown>) => Record<string, unknown>;\n\n /**\n * For Expo Web, inject `release` and `version` options from `app.json`, the Expo Application Config.\n *\n * @default true\n */\n injectReleaseForWeb?: boolean;\n}\n\n/**\n * Adds Sentry to the Metro config.\n *\n * Adds Debug ID to the output bundle and source maps.\n * Collapses Sentry frames from the stack trace view in LogBox.\n */\nexport function withSentryConfig(\n config: MetroConfig,\n {\n annotateReactComponents = false,\n includeWebReplay = true,\n enableSourceContextInDevelopment = true,\n }: SentryMetroConfigOptions = {},\n): MetroConfig {\n setSentryMetroDevServerEnvFlag();\n\n let newConfig = config;\n\n newConfig = withSentryDebugId(newConfig);\n newConfig = withSentryFramesCollapsed(newConfig);\n if (annotateReactComponents) {\n newConfig = withSentryBabelTransformer(newConfig, annotateReactComponents);\n }\n if (includeWebReplay === false) {\n newConfig = withSentryResolver(newConfig, includeWebReplay);\n }\n if (enableSourceContextInDevelopment) {\n newConfig = withSentryMiddleware(newConfig);\n }\n\n return newConfig;\n}\n\n/**\n * This function returns Default Expo configuration with Sentry plugins.\n */\nexport function getSentryExpoConfig(\n projectRoot: string,\n options: DefaultConfigOptions & SentryExpoConfigOptions & SentryMetroConfigOptions = {},\n): MetroConfig {\n setSentryMetroDevServerEnvFlag();\n\n const getDefaultConfig = options.getDefaultConfig || loadExpoMetroConfigModule().getDefaultConfig;\n const config = getDefaultConfig(projectRoot, {\n ...options,\n unstable_beforeAssetSerializationPlugins: [\n ...(options.unstable_beforeAssetSerializationPlugins || []),\n ...(options.injectReleaseForWeb ?? true ? [unstableReleaseConstantsPlugin(projectRoot)] : []),\n unstableBeforeAssetSerializationDebugIdPlugin,\n ],\n });\n\n let newConfig = withSentryFramesCollapsed(config);\n if (options.annotateReactComponents) {\n newConfig = withSentryBabelTransformer(newConfig, options.annotateReactComponents);\n }\n\n if (options.includeWebReplay === false) {\n newConfig = withSentryResolver(newConfig, options.includeWebReplay);\n }\n\n if (options.enableSourceContextInDevelopment ?? true) {\n newConfig = withSentryMiddleware(newConfig);\n }\n\n return newConfig;\n}\n\nfunction loadExpoMetroConfigModule(): {\n getDefaultConfig: (\n projectRoot: string,\n options: {\n unstable_beforeAssetSerializationPlugins?: ((serializationInput: {\n graph: ReadOnlyGraph<MixedOutput>;\n premodules: Module[];\n debugId?: string;\n }) => Module[])[];\n },\n ) => MetroConfig;\n} {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n return require('expo/metro-config');\n } catch (e) {\n throw new Error('Unable to load `expo/metro-config`. Make sure you have Expo installed.');\n }\n}\n\n/**\n * Adds Sentry Babel transformer to the Metro config.\n */\nexport function withSentryBabelTransformer(\n config: MetroConfig,\n annotateReactComponents: true | { ignoredComponents?: string[] },\n): MetroConfig {\n const defaultBabelTransformerPath = config.transformer?.babelTransformerPath;\n debug.log('Default Babel transformer path from `config.transformer`:', defaultBabelTransformerPath);\n\n if (!defaultBabelTransformerPath) {\n // This has to be console.warn because the options is enabled but won't be used\n // eslint-disable-next-line no-console\n console.warn('`transformer.babelTransformerPath` is undefined.');\n // eslint-disable-next-line no-console\n console.warn('Sentry Babel transformer cannot be used. Not adding it...');\n return config;\n }\n\n if (defaultBabelTransformerPath) {\n setSentryDefaultBabelTransformerPathEnv(defaultBabelTransformerPath);\n }\n\n if (typeof annotateReactComponents === 'object') {\n setSentryBabelTransformerOptions({\n annotateReactComponents,\n });\n }\n\n return {\n ...config,\n transformer: {\n ...config.transformer,\n babelTransformerPath: require.resolve('./sentryBabelTransformer'),\n },\n };\n}\n\ntype MetroCustomSerializer = Required<Required<MetroConfig>['serializer']>['customSerializer'] | undefined;\n\nfunction withSentryDebugId(config: MetroConfig): MetroConfig {\n const customSerializer = createSentryMetroSerializer(\n config.serializer?.customSerializer || undefined,\n ) as MetroCustomSerializer;\n // MetroConfig types customSerializers as async only, but sync returns are also supported\n // The default serializer is sync\n\n return {\n ...config,\n serializer: {\n ...config.serializer,\n customSerializer,\n },\n };\n}\n\n// Based on: https://github.com/facebook/metro/blob/c21daba415ea26511e157f794689caab9abe8236/packages/metro-resolver/src/resolve.js#L86-L91\ntype CustomResolverBeforeMetro068 = (\n context: CustomResolutionContext,\n realModuleName: string,\n platform: string | null,\n moduleName?: string,\n) => Resolution;\n\n/**\n * Includes `@sentry/replay` packages based on the `includeWebReplay` flag and current bundle `platform`.\n */\nexport function withSentryResolver(config: MetroConfig, includeWebReplay: boolean | undefined): MetroConfig {\n const originalResolver = config.resolver?.resolveRequest as CustomResolver | CustomResolverBeforeMetro068 | undefined;\n\n const sentryResolverRequest: CustomResolver = (\n context: CustomResolutionContext,\n moduleName: string,\n platform: string | null,\n oldMetroModuleName?: string,\n ) => {\n if (\n (includeWebReplay === false ||\n (includeWebReplay === undefined && (platform === 'android' || platform === 'ios'))) &&\n !!(oldMetroModuleName ?? moduleName).match(/@sentry(?:-internal)?\\/replay/)\n ) {\n return { type: 'empty' } as Resolution;\n }\n if (originalResolver) {\n return oldMetroModuleName\n ? originalResolver(context, moduleName, platform, oldMetroModuleName)\n : originalResolver(context, moduleName, platform);\n }\n\n // Prior 0.68, resolve context.resolveRequest is sentryResolver itself, where on later version it is the default resolver.\n if (context.resolveRequest === sentryResolverRequest) {\n // eslint-disable-next-line no-console\n console.error(\n `Error: [@sentry/react-native/metro] Can not resolve the defaultResolver on Metro older than 0.68.\nPlease follow one of the following options:\n- Include your resolverRequest on your metroconfig.\n- Update your Metro version to 0.68 or higher.\n- Set includeWebReplay as true on your metro config.\n- If you are still facing issues, report the issue at http://www.github.com/getsentry/sentry-react-native/issues`,\n );\n // Return required for test.\n return process.exit(-1);\n }\n\n return context.resolveRequest(context, moduleName, platform);\n };\n\n return {\n ...config,\n resolver: {\n ...config.resolver,\n resolveRequest: sentryResolverRequest,\n },\n };\n}\n\ntype MetroFrame = Parameters<Required<Required<MetroConfig>['symbolicator']>['customizeFrame']>[0];\ntype MetroCustomizeFrame = { readonly collapse?: boolean };\ntype MetroCustomizeFrameReturnValue =\n | ReturnType<Required<Required<MetroConfig>['symbolicator']>['customizeFrame']>\n | undefined;\n\n/**\n * Collapses Sentry internal frames from the stack trace view in LogBox.\n */\nexport function withSentryFramesCollapsed(config: MetroConfig): MetroConfig {\n const originalCustomizeFrame = config.symbolicator?.customizeFrame;\n const collapseSentryInternalFrames = (frame: MetroFrame): boolean =>\n typeof frame.file === 'string' &&\n (frame.file.includes('node_modules/@sentry/core/cjs/instrument.js') ||\n frame.file.includes('node_modules/@sentry/core/cjs/debug.js'));\n\n const customizeFrame = (frame: MetroFrame): MetroCustomizeFrameReturnValue => {\n const originalOrSentryCustomizeFrame = (\n originalCustomization: MetroCustomizeFrame | undefined,\n ): MetroCustomizeFrame => ({\n ...originalCustomization,\n collapse: originalCustomization?.collapse || collapseSentryInternalFrames(frame),\n });\n\n const maybePromiseCustomization = originalCustomizeFrame?.(frame) || undefined;\n\n if (maybePromiseCustomization !== undefined && 'then' in maybePromiseCustomization) {\n return maybePromiseCustomization.then<MetroCustomizeFrame>(originalCustomization =>\n originalOrSentryCustomizeFrame(originalCustomization),\n );\n }\n\n return originalOrSentryCustomizeFrame(maybePromiseCustomization);\n };\n\n return {\n ...config,\n symbolicator: {\n ...config.symbolicator,\n customizeFrame,\n },\n };\n}\n\n/**\n * Sets the `___SENTRY_METRO_DEV_SERVER___` environment flag.\n * This is used to determine if the SDK is running in Node in Metro Dev Server.\n * For example during static routes generation in `expo-router`.\n */\nfunction setSentryMetroDevServerEnvFlag(): void {\n env.___SENTRY_METRO_DEV_SERVER___ = 'true';\n}\n"]}
|