From 38985d730af1ad18045e21b24632fa534348aa27 Mon Sep 17 00:00:00 2001 From: Brent Vatne Date: Tue, 11 Jul 2023 16:33:10 -0700 Subject: [PATCH] Remove dependency on expo-updates (#356) --- CHANGELOG.md | 1 + build/integrations/Updates.d.ts | 7 +++++++ build/integrations/Updates.d.ts.map | 1 + build/integrations/Updates.js | 15 +++++++++++++++ build/integrations/Updates.js.map | 1 + build/integrations/bare.js | 2 +- build/integrations/bare.js.map | 2 +- build/integrations/managed.js | 4 ++-- build/integrations/managed.js.map | 2 +- build/sentry.js | 2 +- build/sentry.js.map | 2 +- package.json | 3 +-- src/integrations/Updates.ts | 15 +++++++++++++++ src/integrations/bare.ts | 2 +- src/integrations/managed.ts | 4 ++-- src/sentry.ts | 2 +- yarn.lock | 17 ++++++----------- 17 files changed, 58 insertions(+), 24 deletions(-) create mode 100644 build/integrations/Updates.d.ts create mode 100644 build/integrations/Updates.d.ts.map create mode 100644 build/integrations/Updates.js create mode 100644 build/integrations/Updates.js.map create mode 100644 src/integrations/Updates.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 98082a3..febc314 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ ### ๐Ÿ› Bug fixes +- Remove dependency on expo-updates ([#356](https://github.com/expo/sentry-expo/pull/356) by [@brentvatne](https://github.com/brentvatne)) - Create new options object on every init to avoid read only error when initializing multiple times ([#350](https://github.com/expo/sentry-expo/pull/350) by [@krystofwoldrich](https://github.com/krystofwoldrich)) ### ๐Ÿงน Chores diff --git a/build/integrations/Updates.d.ts b/build/integrations/Updates.d.ts new file mode 100644 index 0000000..8535b5d --- /dev/null +++ b/build/integrations/Updates.d.ts @@ -0,0 +1,7 @@ +export declare const isEmbeddedLaunch: boolean; +export declare const releaseChannel: string; +export declare const channel: string | null; +export declare const updateId: string | null; +export declare const runtimeVersion: string | null; +export declare const manifest: any; +//# sourceMappingURL=Updates.d.ts.map \ No newline at end of file diff --git a/build/integrations/Updates.d.ts.map b/build/integrations/Updates.d.ts.map new file mode 100644 index 0000000..d9780c3 --- /dev/null +++ b/build/integrations/Updates.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Updates.d.ts","sourceRoot":"","sources":["../../src/integrations/Updates.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB,EAAE,OAA+C,CAAC;AAC/E,eAAO,MAAM,cAAc,EAAE,MAAgD,CAAC;AAC9E,eAAO,MAAM,OAAO,EAAE,MAAM,GAAG,IAAkC,CAAC;AAClE,eAAO,MAAM,QAAQ,EAAE,MAAM,GAAG,IAGtB,CAAC;AACX,eAAO,MAAM,cAAc,EAAE,MAAM,GAAG,IAAyC,CAAC;AAEhF,eAAO,MAAM,QAAQ,KAEjB,CAAC"} \ No newline at end of file diff --git a/build/integrations/Updates.js b/build/integrations/Updates.js new file mode 100644 index 0000000..c65f0bd --- /dev/null +++ b/build/integrations/Updates.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.manifest = exports.runtimeVersion = exports.updateId = exports.channel = exports.releaseChannel = exports.isEmbeddedLaunch = void 0; +const expo_modules_core_1 = require("expo-modules-core"); +const ExpoUpdates = expo_modules_core_1.NativeModulesProxy.ExpoUpdates ?? {}; +exports.isEmbeddedLaunch = ExpoUpdates.isEmbeddedLaunch || false; +exports.releaseChannel = ExpoUpdates.releaseChannel ?? 'default'; +exports.channel = ExpoUpdates.channel ?? null; +exports.updateId = ExpoUpdates.updateId && typeof ExpoUpdates.updateId === 'string' + ? ExpoUpdates.updateId.toLowerCase() + : null; +exports.runtimeVersion = ExpoUpdates.runtimeVersion ?? null; +exports.manifest = (ExpoUpdates.manifestString ? JSON.parse(ExpoUpdates.manifestString) : ExpoUpdates.manifest) ?? + {}; +//# sourceMappingURL=Updates.js.map \ No newline at end of file diff --git a/build/integrations/Updates.js.map b/build/integrations/Updates.js.map new file mode 100644 index 0000000..6de41c0 --- /dev/null +++ b/build/integrations/Updates.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Updates.js","sourceRoot":"","sources":["../../src/integrations/Updates.ts"],"names":[],"mappings":";;;AAAA,yDAAuD;AACvD,MAAM,WAAW,GAAG,sCAAkB,CAAC,WAAW,IAAK,EAAU,CAAC;AAErD,QAAA,gBAAgB,GAAY,WAAW,CAAC,gBAAgB,IAAI,KAAK,CAAC;AAClE,QAAA,cAAc,GAAW,WAAW,CAAC,cAAc,IAAI,SAAS,CAAC;AACjE,QAAA,OAAO,GAAkB,WAAW,CAAC,OAAO,IAAI,IAAI,CAAC;AACrD,QAAA,QAAQ,GACnB,WAAW,CAAC,QAAQ,IAAI,OAAO,WAAW,CAAC,QAAQ,KAAK,QAAQ;IAC9D,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,WAAW,EAAE;IACpC,CAAC,CAAC,IAAI,CAAC;AACE,QAAA,cAAc,GAAkB,WAAW,CAAC,cAAc,IAAI,IAAI,CAAC;AAEnE,QAAA,QAAQ,GACnB,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC;IAC5F,EAAE,CAAC","sourcesContent":["import { NativeModulesProxy } from 'expo-modules-core';\nconst ExpoUpdates = NativeModulesProxy.ExpoUpdates ?? ({} as any);\n\nexport const isEmbeddedLaunch: boolean = ExpoUpdates.isEmbeddedLaunch || false;\nexport const releaseChannel: string = ExpoUpdates.releaseChannel ?? 'default';\nexport const channel: string | null = ExpoUpdates.channel ?? null;\nexport const updateId: string | null =\n ExpoUpdates.updateId && typeof ExpoUpdates.updateId === 'string'\n ? ExpoUpdates.updateId.toLowerCase()\n : null;\nexport const runtimeVersion: string | null = ExpoUpdates.runtimeVersion ?? null;\n\nexport const manifest =\n (ExpoUpdates.manifestString ? JSON.parse(ExpoUpdates.manifestString) : ExpoUpdates.manifest) ??\n {};"]} \ No newline at end of file diff --git a/build/integrations/bare.js b/build/integrations/bare.js index cc982a5..8719c84 100644 --- a/build/integrations/bare.js +++ b/build/integrations/bare.js @@ -30,7 +30,7 @@ exports.ExpoBareIntegration = void 0; const react_native_1 = require("react-native"); const expo_constants_1 = __importDefault(require("expo-constants")); const Device = __importStar(require("expo-device")); -const Updates = __importStar(require("expo-updates")); +const Updates = __importStar(require("./Updates")); const react_native_2 = require("@sentry/react-native"); const DEFAULT_TAGS = [ { diff --git a/build/integrations/bare.js.map b/build/integrations/bare.js.map index 9b0a846..35cc858 100644 --- a/build/integrations/bare.js.map +++ b/build/integrations/bare.js.map @@ -1 +1 @@ -{"version":3,"file":"bare.js","sourceRoot":"","sources":["../../src/integrations/bare.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAwC;AACxC,oEAAuC;AACvC,oDAAsC;AACtC,sDAAwC;AACxC,uDAM8B;AAG9B,MAAM,YAAY,GAAG;IACnB;QACE,OAAO,EAAE,oBAAoB;QAC7B,YAAY,EAAE,gBAAgB;KAC/B;IACD;QACE,OAAO,EAAE,YAAY;QACrB,YAAY,EAAE,SAAS;KACxB;IACD;QACE,OAAO,EAAE,kBAAkB;QAC3B,YAAY,EAAE,eAAe;KAC9B;IACD;QACE,OAAO,EAAE,gBAAgB;QACzB,YAAY,EAAE,YAAY;KAC3B;CACF,CAAC;AAEF,MAAa,mBAAmB;IAC9B,MAAM,CAAC,EAAE,GAAG,qBAAqB,CAAC;IAClC,IAAI,GAAG,mBAAmB,CAAC,EAAE,CAAC;IAE9B,SAAS;QACP,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAe,CAAC;QAEzC,IAAA,wBAAS,EAAC;YACR,QAAQ;YACR,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,UAAU,EAAE,wBAAS,CAAC,UAAU;SACjC,CAAC,CAAC;QAEH,IAAA,sBAAO,EAAC;YACN,QAAQ,EAAE,wBAAS,CAAC,SAAS;SAC9B,CAAC,CAAC;QAEH,IAAI,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MAAM,CAAC,UAAU,EAAE,CAAC,eAAe,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;oBAClE,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;gBACjC,CAAC,CAAC,CAAC;aACJ;iBAAM;gBACL,mGAAmG;gBACnG,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;aAChC;QACH,CAAC,CAAC,CAAC;QAEH,IAAA,sCAAuB,EAAC,UAAU,KAAK,EAAE,KAAK;YAC5C,MAAM,IAAI,GAAG,IAAA,4BAAa,GAAE,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC;YAEjE,IAAI,IAAI,EAAE;gBACR,KAAK,CAAC,QAAQ,GAAG;oBACf,GAAG,CAAC,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC;oBACzB,MAAM,EAAE;wBACN,SAAS,EAAE,CAAC,MAAM,CAAC,QAAQ;wBAC3B,KAAK,EAAE,MAAM,CAAC,SAAS,IAAI,SAAS;qBACrC;oBACD,EAAE,EAAE;wBACF,IAAI,EAAE,MAAM,CAAC,MAAM,IAAI,SAAS;wBAChC,OAAO,EAAE,MAAM,CAAC,SAAS,IAAI,SAAS;qBACvC;iBACF,CAAC;aACH;YAED,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;IACL,CAAC;;AAlFH,kDAmFC","sourcesContent":["import { Platform } from 'react-native';\nimport Constants from 'expo-constants';\nimport * as Device from 'expo-device';\nimport * as Updates from 'expo-updates';\nimport {\n setExtras,\n setTags,\n getCurrentHub,\n setTag,\n addGlobalEventProcessor,\n} from '@sentry/react-native';\nimport { SeverityLevel } from '@sentry/types';\n\nconst DEFAULT_TAGS = [\n {\n tagName: 'expoReleaseChannel',\n manifestName: 'releaseChannel',\n },\n {\n tagName: 'appVersion',\n manifestName: 'version',\n },\n {\n tagName: 'appPublishedTime',\n manifestName: 'publishedTime',\n },\n {\n tagName: 'expoSdkVersion',\n manifestName: 'sdkVersion',\n },\n];\n\nexport class ExpoBareIntegration {\n static id = 'ExpoBareIntegration';\n name = ExpoBareIntegration.id;\n\n setupOnce() {\n const manifest = Updates.manifest as any;\n\n setExtras({\n manifest,\n deviceYearClass: Device.deviceYearClass,\n linkingUri: Constants.linkingUri,\n });\n\n setTags({\n deviceId: Constants.sessionId,\n });\n\n if (typeof manifest === 'object') {\n DEFAULT_TAGS.forEach((tag) => {\n if (manifest.hasOwnProperty(tag.manifestName)) {\n setTag(tag.tagName, manifest[tag.manifestName]);\n }\n });\n }\n\n const defaultHandler = ErrorUtils.getGlobalHandler();\n\n ErrorUtils.setGlobalHandler((error, isFatal) => {\n // Updates bundle names are not predictable in advance, so we replace them with the names\n // Sentry expects to be in the stacktrace.\n // The name of the sourcemap file in Sentry is different depending on whether it was uploaded\n // by the upload-sourcemaps script in this package (in which case it will have a revisionId)\n // or by the default @sentry/react-native script.\n if (typeof error.stack === 'string') {\n const sentryFilename = Platform.OS === 'android' ? 'index.android.bundle' : 'main.jsbundle';\n error.stack = error.stack.replace(\n /\\/(bundle\\-\\d+|[\\dabcdef]+\\.bundle)/g,\n `/${sentryFilename}`\n );\n }\n\n getCurrentHub().withScope((scope) => {\n if (isFatal) {\n scope.setLevel('fatal' as SeverityLevel);\n }\n getCurrentHub().captureException(error, {\n originalException: error,\n });\n });\n\n const client = getCurrentHub().getClient();\n // If in dev, we call the default handler anyway and hope the error will be sent\n // Just for a better dev experience\n if (client && !__DEV__) {\n client.flush(client.getOptions().shutdownTimeout || 2000).then(() => {\n defaultHandler(error, isFatal);\n });\n } else {\n // If there is no client, something is fishy but we call the default handler anyway. Even if in dev\n defaultHandler(error, isFatal);\n }\n });\n\n addGlobalEventProcessor(function (event, _hint) {\n const that = getCurrentHub().getIntegration(ExpoBareIntegration);\n\n if (that) {\n event.contexts = {\n ...(event.contexts || {}),\n device: {\n simulator: !Device.isDevice,\n model: Device.modelName || undefined,\n },\n os: {\n name: Device.osName || undefined,\n version: Device.osVersion || undefined,\n },\n };\n }\n\n return event;\n });\n }\n}\n"]} \ No newline at end of file +{"version":3,"file":"bare.js","sourceRoot":"","sources":["../../src/integrations/bare.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAwC;AACxC,oEAAuC;AACvC,oDAAsC;AACtC,mDAAqC;AACrC,uDAM8B;AAG9B,MAAM,YAAY,GAAG;IACnB;QACE,OAAO,EAAE,oBAAoB;QAC7B,YAAY,EAAE,gBAAgB;KAC/B;IACD;QACE,OAAO,EAAE,YAAY;QACrB,YAAY,EAAE,SAAS;KACxB;IACD;QACE,OAAO,EAAE,kBAAkB;QAC3B,YAAY,EAAE,eAAe;KAC9B;IACD;QACE,OAAO,EAAE,gBAAgB;QACzB,YAAY,EAAE,YAAY;KAC3B;CACF,CAAC;AAEF,MAAa,mBAAmB;IAC9B,MAAM,CAAC,EAAE,GAAG,qBAAqB,CAAC;IAClC,IAAI,GAAG,mBAAmB,CAAC,EAAE,CAAC;IAE9B,SAAS;QACP,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAe,CAAC;QAEzC,IAAA,wBAAS,EAAC;YACR,QAAQ;YACR,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,UAAU,EAAE,wBAAS,CAAC,UAAU;SACjC,CAAC,CAAC;QAEH,IAAA,sBAAO,EAAC;YACN,QAAQ,EAAE,wBAAS,CAAC,SAAS;SAC9B,CAAC,CAAC;QAEH,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;YAChC,YAAY,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;gBAC3B,IAAI,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;oBAC7C,IAAA,qBAAM,EAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC;iBACjD;YACH,CAAC,CAAC,CAAC;SACJ;QAED,MAAM,cAAc,GAAG,UAAU,CAAC,gBAAgB,EAAE,CAAC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BAAa,GAAE,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC;YAEjE,IAAI,IAAI,EAAE;gBACR,KAAK,CAAC,QAAQ,GAAG;oBACf,GAAG,CAAC,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC;oBACzB,MAAM,EAAE;wBACN,SAAS,EAAE,CAAC,MAAM,CAAC,QAAQ;wBAC3B,KAAK,EAAE,MAAM,CAAC,SAAS,IAAI,SAAS;qBACrC;oBACD,EAAE,EAAE;wBACF,IAAI,EAAE,MAAM,CAAC,MAAM,IAAI,SAAS;wBAChC,OAAO,EAAE,MAAM,CAAC,SAAS,IAAI,SAAS;qBACvC;iBACF,CAAC;aACH;YAED,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;IACL,CAAC;;AAlFH,kDAmFC","sourcesContent":["import { Platform } from 'react-native';\nimport Constants from 'expo-constants';\nimport * as Device from 'expo-device';\nimport * as Updates from './Updates';\nimport {\n setExtras,\n setTags,\n getCurrentHub,\n setTag,\n addGlobalEventProcessor,\n} from '@sentry/react-native';\nimport { SeverityLevel } from '@sentry/types';\n\nconst DEFAULT_TAGS = [\n {\n tagName: 'expoReleaseChannel',\n manifestName: 'releaseChannel',\n },\n {\n tagName: 'appVersion',\n manifestName: 'version',\n },\n {\n tagName: 'appPublishedTime',\n manifestName: 'publishedTime',\n },\n {\n tagName: 'expoSdkVersion',\n manifestName: 'sdkVersion',\n },\n];\n\nexport class ExpoBareIntegration {\n static id = 'ExpoBareIntegration';\n name = ExpoBareIntegration.id;\n\n setupOnce() {\n const manifest = Updates.manifest as any;\n\n setExtras({\n manifest,\n deviceYearClass: Device.deviceYearClass,\n linkingUri: Constants.linkingUri,\n });\n\n setTags({\n deviceId: Constants.sessionId,\n });\n\n if (typeof manifest === 'object') {\n DEFAULT_TAGS.forEach((tag) => {\n if (manifest.hasOwnProperty(tag.manifestName)) {\n setTag(tag.tagName, manifest[tag.manifestName]);\n }\n });\n }\n\n const defaultHandler = ErrorUtils.getGlobalHandler();\n\n ErrorUtils.setGlobalHandler((error, isFatal) => {\n // Updates bundle names are not predictable in advance, so we replace them with the names\n // Sentry expects to be in the stacktrace.\n // The name of the sourcemap file in Sentry is different depending on whether it was uploaded\n // by the upload-sourcemaps script in this package (in which case it will have a revisionId)\n // or by the default @sentry/react-native script.\n if (typeof error.stack === 'string') {\n const sentryFilename = Platform.OS === 'android' ? 'index.android.bundle' : 'main.jsbundle';\n error.stack = error.stack.replace(\n /\\/(bundle\\-\\d+|[\\dabcdef]+\\.bundle)/g,\n `/${sentryFilename}`\n );\n }\n\n getCurrentHub().withScope((scope) => {\n if (isFatal) {\n scope.setLevel('fatal' as SeverityLevel);\n }\n getCurrentHub().captureException(error, {\n originalException: error,\n });\n });\n\n const client = getCurrentHub().getClient();\n // If in dev, we call the default handler anyway and hope the error will be sent\n // Just for a better dev experience\n if (client && !__DEV__) {\n client.flush(client.getOptions().shutdownTimeout || 2000).then(() => {\n defaultHandler(error, isFatal);\n });\n } else {\n // If there is no client, something is fishy but we call the default handler anyway. Even if in dev\n defaultHandler(error, isFatal);\n }\n });\n\n addGlobalEventProcessor(function (event, _hint) {\n const that = getCurrentHub().getIntegration(ExpoBareIntegration);\n\n if (that) {\n event.contexts = {\n ...(event.contexts || {}),\n device: {\n simulator: !Device.isDevice,\n model: Device.modelName || undefined,\n },\n os: {\n name: Device.osName || undefined,\n version: Device.osVersion || undefined,\n },\n };\n }\n\n return event;\n });\n }\n}\n"]} \ No newline at end of file diff --git a/build/integrations/managed.js b/build/integrations/managed.js index 37d2549..9e32fde 100644 --- a/build/integrations/managed.js +++ b/build/integrations/managed.js @@ -27,10 +27,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ExpoManagedIntegration = void 0; +const Updates = __importStar(require("./Updates")); const react_native_1 = require("react-native"); const expo_constants_1 = __importDefault(require("expo-constants")); const Device = __importStar(require("expo-device")); -const Updates = __importStar(require("expo-updates")); const react_native_2 = require("@sentry/react-native"); const DEFAULT_TAGS = [ { @@ -74,7 +74,7 @@ class ExpoManagedIntegration { } }); } - if (Updates?.channel) { + if (Updates.channel) { (0, react_native_2.setTag)('expoChannel', Updates.channel); } const defaultHandler = ErrorUtils.getGlobalHandler(); diff --git a/build/integrations/managed.js.map b/build/integrations/managed.js.map index 767ea5c..a0992eb 100644 --- a/build/integrations/managed.js.map +++ b/build/integrations/managed.js.map @@ -1 +1 @@ -{"version":3,"file":"managed.js","sourceRoot":"","sources":["../../src/integrations/managed.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAwC;AACxC,oEAAuC;AACvC,oDAAsC;AACtC,sDAAwC;AACxC,uDAM8B;AAG9B,MAAM,YAAY,GAAG;IACnB;QACE,OAAO,EAAE,oBAAoB;QAC7B,YAAY,EAAE,gBAAgB;KAC/B;IACD;QACE,OAAO,EAAE,YAAY;QACrB,YAAY,EAAE,SAAS;KACxB;IACD;QACE,OAAO,EAAE,kBAAkB;QAC3B,YAAY,EAAE,eAAe;KAC9B;IACD;QACE,OAAO,EAAE,gBAAgB;QACzB,YAAY,EAAE,YAAY;KAC3B;CACF,CAAC;AAEF,MAAa,sBAAsB;IACjC,MAAM,CAAC,EAAE,GAAG,wBAAwB,CAAC;IACrC,IAAI,GAAG,sBAAsB,CAAC,EAAE,CAAC;IAEjC,SAAS;QACP,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAe,CAAC;QAEzC,IAAA,wBAAS,EAAC;YACR,QAAQ;YACR,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,UAAU,EAAE,wBAAS,CAAC,UAAU;SACjC,CAAC,CAAC;QAEH,IAAA,sBAAO,EAAC;YACN,QAAQ,EAAE,wBAAS,CAAC,SAAS;YAC7B,YAAY,EAAE,wBAAS,CAAC,YAAY,IAAI,KAAK;SAC9C,CAAC,CAAC;QAEH,IAAI,wBAAS,CAAC,YAAY,KAAK,MAAM,IAAI,wBAAS,CAAC,WAA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CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,eAAe,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;oBAClE,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;gBACjC,CAAC,CAAC,CAAC;aACJ;iBAAM;gBACL,mGAAmG;gBACnG,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;aAChC;QACH,CAAC,CAAC,CAAC;QAEH,IAAA,sCAAuB,EAAC,UAAU,KAAK,EAAE,KAAK;YAC5C,MAAM,IAAI,GAAG,IAAA,4BAAa,GAAE,CAAC,cAAc,CAAC,sBAAsB,CAAC,CAAC;YAEpE,IAAI,IAAI,EAAE;gBACR,KAAK,CAAC,QAAQ,GAAG;oBACf,GAAG,CAAC,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC;oBACzB,MAAM,EAAE;wBACN,SAAS,EAAE,CAAC,MAAM,CAAC,QAAQ;wBAC3B,KAAK,EAAE,MAAM,CAAC,SAAS,IAAI,SAAS;qBACrC;oBACD,EAAE,EAAE;wBACF,IAAI,EAAE,MAAM,CAAC,MAAM,IAAI,SAAS;wBAChC,OAAO,EAAE,MAAM,CAAC,SAAS,IAAI,SAAS;qBACvC;iBACF,CAAC;aACH;YAED,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;IACL,CAAC;;AAtFH,wDAuFC","sourcesContent":["import { Platform } from 'react-native';\nimport Constants from 'expo-constants';\nimport * as Device from 'expo-device';\nimport * as Updates from 'expo-updates';\nimport {\n setExtras,\n setTags,\n getCurrentHub,\n setTag,\n addGlobalEventProcessor,\n} from '@sentry/react-native';\nimport { SeverityLevel } from '@sentry/types';\n\nconst DEFAULT_TAGS = [\n {\n tagName: 'expoReleaseChannel',\n manifestName: 'releaseChannel',\n },\n {\n tagName: 'appVersion',\n manifestName: 'version',\n },\n {\n tagName: 'appPublishedTime',\n manifestName: 'publishedTime',\n },\n {\n tagName: 'expoSdkVersion',\n manifestName: 'sdkVersion',\n },\n];\n\nexport class ExpoManagedIntegration {\n static id = 'ExpoManagedIntegration';\n name = ExpoManagedIntegration.id;\n\n setupOnce() {\n const manifest = Updates.manifest as any;\n\n setExtras({\n manifest,\n deviceYearClass: Device.deviceYearClass,\n linkingUri: Constants.linkingUri,\n });\n\n setTags({\n deviceId: Constants.sessionId,\n appOwnership: Constants.appOwnership || 'N/A',\n });\n\n if (Constants.appOwnership === 'expo' && Constants.expoVersion) {\n setTag('expoAppVersion', Constants.expoVersion);\n }\n\n if (typeof manifest === 'object') {\n DEFAULT_TAGS.forEach((tag) => {\n if (manifest.hasOwnProperty(tag.manifestName)) {\n setTag(tag.tagName, manifest[tag.manifestName]);\n }\n });\n }\n\n if (Updates?.channel) {\n setTag('expoChannel', Updates.channel);\n }\n\n const defaultHandler = ErrorUtils.getGlobalHandler();\n\n ErrorUtils.setGlobalHandler((error, isFatal) => {\n // On Android, the Expo bundle filepath cannot be handled by TraceKit,\n // so we normalize it to use the same filepath that we use on Expo iOS.\n if (Platform.OS === 'android') {\n error.stack = error.stack.replace(\n /\\/.*\\/\\d+\\.\\d+.\\d+\\/cached\\-bundle\\-experience\\-/g,\n 'https://classic-assets.eascdn.net:443/'\n );\n }\n\n getCurrentHub().withScope((scope) => {\n if (isFatal) {\n scope.setLevel(\"fatal\" as SeverityLevel);\n }\n getCurrentHub().captureException(error, {\n originalException: error,\n });\n });\n\n const client = getCurrentHub().getClient();\n if (client && !__DEV__) {\n // @ts-ignore PR to add this to types: https://github.com/getsentry/sentry-javascript/pull/2669\n client.flush(client.getOptions().shutdownTimeout || 2000).then(() => {\n defaultHandler(error, isFatal);\n });\n } else {\n // If there is no client, something is fishy but we call the default handler anyway. Even if in dev\n defaultHandler(error, isFatal);\n }\n });\n\n addGlobalEventProcessor(function (event, _hint) {\n const that = getCurrentHub().getIntegration(ExpoManagedIntegration);\n\n if (that) {\n event.contexts = {\n ...(event.contexts || {}),\n device: {\n simulator: !Device.isDevice,\n model: Device.modelName || undefined,\n },\n os: {\n name: Device.osName || undefined,\n version: Device.osVersion || undefined,\n },\n };\n }\n\n return event;\n });\n }\n}\n"]} \ No newline at end of file +{"version":3,"file":"managed.js","sourceRoot":"","sources":["../../src/integrations/managed.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAqC;AACrC,+CAAwC;AACxC,oEAAuC;AACvC,oDAAsC;AACtC,uDAM8B;AAG9B,MAAM,YAAY,GAAG;IACnB;QACE,OAAO,EAAE,oBAAoB;QAC7B,YAAY,EAAE,gBAAgB;KAC/B;IACD;QACE,OAAO,EAAE,YAAY;QACrB,YAAY,EAAE,SAAS;KACxB;IACD;QACE,OAAO,EAAE,kBAAkB;QAC3B,YAAY,EAAE,eAAe;KAC9B;IACD;QACE,OAAO,EAAE,gBAAgB;QACzB,YAAY,EAAE,YAAY;KAC3B;CACF,CAAC;AAEF,MAAa,sBAAsB;IACjC,MAAM,CAAC,EAAE,GAAG,wBAAwB,CAAC;IACrC,IAAI,GAAG,sBAAsB,CAAC,EAAE,CAAC;IAEjC,SAAS;QACP,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAe,CAAC;QAEzC,IAAA,wBAAS,EAAC;YACR,QAAQ;YACR,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,UAAU,EAAE,wBAAS,CAAC,UAAU;SACjC,CAAC,CAAC;QAEH,IAAA,sBAAO,EAAC;YACN,QAAQ,EAAE,wBAAS,CAAC,SAAS;YAC7B,YAAY,EAAE,wBAAS,CAAC,YAAY,IAAI,KAAK;SAC9C,CAAC,CAAC;QAEH,IAAI,wBAAS,CAAC,YAAY,KAAK,MAAM,IAAI,wBAAS,CAAC,WAAW,EAAE;YAC9D,IAAA,qBAAM,EAAC,gBAAgB,EAAE,wBAAS,CAAC,WAAW,CAAC,CAAC;SACjD;QAED,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;YAChC,YAAY,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,E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J;iBAAM;gBACL,mGAAmG;gBACnG,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;aAChC;QACH,CAAC,CAAC,CAAC;QAEH,IAAA,sCAAuB,EAAC,UAAU,KAAK,EAAE,KAAK;YAC5C,MAAM,IAAI,GAAG,IAAA,4BAAa,GAAE,CAAC,cAAc,CAAC,sBAAsB,CAAC,CAAC;YAEpE,IAAI,IAAI,EAAE;gBACR,KAAK,CAAC,QAAQ,GAAG;oBACf,GAAG,CAAC,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC;oBACzB,MAAM,EAAE;wBACN,SAAS,EAAE,CAAC,MAAM,CAAC,QAAQ;wBAC3B,KAAK,EAAE,MAAM,CAAC,SAAS,IAAI,SAAS;qBACrC;oBACD,EAAE,EAAE;wBACF,IAAI,EAAE,MAAM,CAAC,MAAM,IAAI,SAAS;wBAChC,OAAO,EAAE,MAAM,CAAC,SAAS,IAAI,SAAS;qBACvC;iBACF,CAAC;aACH;YAED,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;IACL,CAAC;;AAtFH,wDAuFC","sourcesContent":["import * as Updates from './Updates';\nimport { Platform } from 'react-native';\nimport Constants from 'expo-constants';\nimport * as Device from 'expo-device';\nimport {\n setExtras,\n setTags,\n getCurrentHub,\n setTag,\n addGlobalEventProcessor,\n} from '@sentry/react-native';\nimport { SeverityLevel } from '@sentry/types';\n\nconst DEFAULT_TAGS = [\n {\n tagName: 'expoReleaseChannel',\n manifestName: 'releaseChannel',\n },\n {\n tagName: 'appVersion',\n manifestName: 'version',\n },\n {\n tagName: 'appPublishedTime',\n manifestName: 'publishedTime',\n },\n {\n tagName: 'expoSdkVersion',\n manifestName: 'sdkVersion',\n },\n];\n\nexport class ExpoManagedIntegration {\n static id = 'ExpoManagedIntegration';\n name = ExpoManagedIntegration.id;\n\n setupOnce() {\n const manifest = Updates.manifest as any;\n\n setExtras({\n manifest,\n deviceYearClass: Device.deviceYearClass,\n linkingUri: Constants.linkingUri,\n });\n\n setTags({\n deviceId: Constants.sessionId,\n appOwnership: Constants.appOwnership || 'N/A',\n });\n\n if (Constants.appOwnership === 'expo' && Constants.expoVersion) {\n setTag('expoAppVersion', Constants.expoVersion);\n }\n\n if (typeof manifest === 'object') {\n DEFAULT_TAGS.forEach((tag) => {\n if (manifest.hasOwnProperty(tag.manifestName)) {\n setTag(tag.tagName, manifest[tag.manifestName]);\n }\n });\n }\n\n if (Updates.channel) {\n setTag('expoChannel', Updates.channel);\n }\n\n const defaultHandler = ErrorUtils.getGlobalHandler();\n\n ErrorUtils.setGlobalHandler((error, isFatal) => {\n // On Android, the Expo bundle filepath cannot be handled by TraceKit,\n // so we normalize it to use the same filepath that we use on Expo iOS.\n if (Platform.OS === 'android') {\n error.stack = error.stack.replace(\n /\\/.*\\/\\d+\\.\\d+.\\d+\\/cached\\-bundle\\-experience\\-/g,\n 'https://classic-assets.eascdn.net:443/'\n );\n }\n\n getCurrentHub().withScope((scope) => {\n if (isFatal) {\n scope.setLevel(\"fatal\" as SeverityLevel);\n }\n getCurrentHub().captureException(error, {\n originalException: error,\n });\n });\n\n const client = getCurrentHub().getClient();\n if (client && !__DEV__) {\n // @ts-ignore PR to add this to types: https://github.com/getsentry/sentry-javascript/pull/2669\n client.flush(client.getOptions().shutdownTimeout || 2000).then(() => {\n defaultHandler(error, isFatal);\n });\n } else {\n // If there is no client, something is fishy but we call the default handler anyway. Even if in dev\n defaultHandler(error, isFatal);\n }\n });\n\n addGlobalEventProcessor(function (event, _hint) {\n const that = getCurrentHub().getIntegration(ExpoManagedIntegration);\n\n if (that) {\n event.contexts = {\n ...(event.contexts || {}),\n device: {\n simulator: !Device.isDevice,\n model: Device.modelName || undefined,\n },\n os: {\n name: Device.osName || undefined,\n version: Device.osVersion || undefined,\n },\n };\n }\n\n return event;\n });\n }\n}\n"]} \ No newline at end of file diff --git a/build/sentry.js b/build/sentry.js index 191a2bc..ea14e3c 100644 --- a/build/sentry.js +++ b/build/sentry.js @@ -25,12 +25,12 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); exports.init = exports.Native = void 0; const react_native_1 = require("react-native"); -const Updates = __importStar(require("expo-updates")); const expo_constants_1 = __importStar(require("expo-constants")); const Application = __importStar(require("expo-application")); const integrations_1 = require("@sentry/integrations"); const bare_1 = require("./integrations/bare"); const managed_1 = require("./integrations/managed"); +const Updates = __importStar(require("./integrations/Updates")); const utils_1 = require("./utils"); const version_1 = require("./version"); const react_native_2 = require("@sentry/react-native"); diff --git a/build/sentry.js.map b/build/sentry.js.map index 5918b1d..723f07e 100644 --- a/build/sentry.js.map +++ b/build/sentry.js.map @@ -1 +1 @@ -{"version":3,"file":"sentry.js","sourceRoot":"","sources":["../src/sentry.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAwC;AACxC,sDAAwC;AACxC,iEAAiE;AACjE,8DAAgD;AAChD,uDAAqD;AAGrD,8CAA0D;AAC1D,oDAAgE;AAChE,mCAA+E;AAC/E,uCAImB;AAEnB,uDAI8B;AAG9B,+DAA+C;AAE/C,MAAM,cAAc,GAAY;IAC9B,IAAI,EAAE,qCAAqC;IAC3C,QAAQ,EAAE;QACR;YACE,IAAI,EAAE,6BAAmB;YACzB,OAAO,EAAE,6BAAmB;SAC7B;QACD;YACE,IAAI,EAAE,qCAA2B;YACjC,OAAO,EAAE,0BAA2B;SACrC;KACF;IACD,OAAO,EAAE,6BAAmB;CAC7B,CAAC;AAEF,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAuB,CAAC;AACjD,MAAM,gBAAgB,GAAG,wBAAS,CAAC,oBAAoB,KAAK,qCAAoB,CAAC,IAAI,CAAC;AAEtF,MAAM,iBAAiB,GAAG,GAAG,EAAE,CAAC,CAAC;IAC/B,kBAAkB,EAAE,KAAK;IACzB,OAAO,EAAE,iBAAiB,EAAE;IAC5B,IAAI,EAAE,OAAO,EAAE;IACf,GAAG,CAAC,gBAAgB,CAAC,CAA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C;gBAChB,GAAG,aAAa;gBAChB,YAAY,EAAE,KAAK;gBACnB,yBAAyB,EAAE,KAAK;aACjC,CAAC,CAAC;SACJ;aAAM;YACL,MAAM,CAAC,CAAC;SACT;KACF;AACH,CAAC,CAAC;AAjEW,QAAA,IAAI,QAiEf","sourcesContent":["import { Platform } from 'react-native';\nimport * as Updates from 'expo-updates';\nimport Constants, { ExecutionEnvironment } from 'expo-constants';\nimport * as Application from 'expo-application';\nimport { RewriteFrames } from '@sentry/integrations';\nimport { Integration, SdkInfo } from '@sentry/types';\n\nimport { ExpoBareIntegration } from './integrations/bare';\nimport { ExpoManagedIntegration } from './integrations/managed';\nimport { SentryExpoNativeOptions, overrideDefaultIntegrations } from './utils';\nimport {\n SENTRY_EXPO_PACKAGE,\n SENTRY_EXPO_VERSION,\n SENTRY_REACT_NATIVE_PACKAGE,\n} from './version';\n\nimport {\n init as initNative,\n Integrations,\n SDK_VERSION as SENTRY_REACT_NATIVE_VERSION,\n} from '@sentry/react-native';\nimport { AppManifest } from 'expo-constants/build/Constants.types';\n\nexport * as Native from '@sentry/react-native';\n\nconst defaultSdkInfo: SdkInfo = {\n name: 'sentry.javascript.react-native.expo',\n packages: [\n {\n name: SENTRY_EXPO_PACKAGE,\n version: SENTRY_EXPO_VERSION,\n },\n {\n name: SENTRY_REACT_NATIVE_PACKAGE,\n version: SENTRY_REACT_NATIVE_VERSION,\n }\n ],\n version: SENTRY_EXPO_VERSION,\n};\n\nconst MANIFEST = Updates.manifest as AppManifest;\nconst IS_BARE_WORKFLOW = Constants.executionEnvironment === ExecutionEnvironment.Bare;\n\nconst getDefaultOptions = () => ({\n enableNativeNagger: false, // Otherwise this will trigger an Alert(), let's rely on the logs instead\n release: getDefaultRelease(),\n dist: getDist(),\n ...(IS_BARE_WORKFLOW ? {} : { enableNative: false, enableNativeCrashHandling: false }),\n _metadata: {\n sdk: defaultSdkInfo,\n },\n});\n\n/**\n * For embedded updates, the dist version needs to match what is set by the Sentry build script.\n * For modern manifest OTA updates, the updateId is used.\n */\nfunction getDist(): string | null | undefined {\n if (Updates.isEmbeddedLaunch) {\n return MANIFEST.revisionId ? MANIFEST.version : `${Application.nativeBuildVersion}`;\n } else {\n return Updates.updateId;\n }\n}\n\n/**\n * We assign the appropriate release based on if the app is running in development,\n * on an Classic OTA Update, or on a no-publish build.\n */\nfunction getDefaultRelease(): string {\n if (__DEV__) {\n return 'DEVELOPMENT';\n } else if (MANIFEST.revisionId) {\n // Want to make sure this still exists in EAS update: equal on iOS & Android\n return MANIFEST.revisionId;\n } else {\n // This is the default set by Sentry's native Xcode & Gradle scripts\n return `${Application.applicationId}@${Application.nativeApplicationVersion}+${Application.nativeBuildVersion}`;\n }\n}\n\nexport const init = (options: SentryExpoNativeOptions = {}) => {\n const defaultExpoIntegrations = [\n new Integrations.ReactNativeErrorHandlers({\n onerror: false,\n onunhandledrejection: true,\n }),\n IS_BARE_WORKFLOW ? new ExpoBareIntegration() : new ExpoManagedIntegration(),\n new RewriteFrames({\n iteratee: (frame) => {\n if (frame.filename && frame.filename !== '[native code]') {\n frame.filename =\n Platform.OS === 'android' ? 'app:///index.android.bundle' : 'app:///main.jsbundle';\n }\n return frame;\n },\n }),\n ];\n\n let nativeOptions = { ...getDefaultOptions(), ...options } as SentryExpoNativeOptions;\n\n if (Array.isArray(nativeOptions.integrations)) {\n // Allow users to override Expo defaults...ymmv\n nativeOptions.integrations = overrideDefaultIntegrations(\n defaultExpoIntegrations,\n nativeOptions.integrations\n );\n } else if (typeof nativeOptions.integrations === 'function') {\n // Need to rewrite the function to take Expo's default integrations\n let functionWithoutExpoIntegrations = nativeOptions.integrations;\n const functionWithExpoIntegrations = (integrations: Integration[]) => {\n return functionWithoutExpoIntegrations(\n overrideDefaultIntegrations(integrations, defaultExpoIntegrations)\n );\n };\n nativeOptions.integrations = functionWithExpoIntegrations;\n } else {\n nativeOptions.integrations = [...defaultExpoIntegrations];\n }\n\n if (__DEV__ && !nativeOptions.enableInExpoDevelopment) {\n nativeOptions.enabled = false;\n if (!nativeOptions.hasOwnProperty('enableInExpoDevelopment')) {\n console.log(\n '[sentry-expo] Disabled Sentry in development. Note you can set Sentry.init({ enableInExpoDevelopment: true });'\n );\n }\n }\n\n try {\n return initNative({ ...nativeOptions });\n } catch (e) {\n if (IS_BARE_WORKFLOW) {\n // Native projects have not been linked, try to continue with no native capability\n console.warn(\n `[sentry-expo] Disabling the Sentry Native SDK (all JS errors will still be reported).\\nTo enable it, run 'yarn add @sentry/react-native' or 'npm install @sentry/react-native' in your project directory. To silence this warning, pass 'enableNative: false' to Sentry.init().`\n );\n return initNative({\n ...nativeOptions,\n enableNative: false,\n enableNativeCrashHandling: false,\n });\n } else {\n throw e;\n }\n }\n};\n"]} \ No newline at end of file +{"version":3,"file":"sentry.js","sourceRoot":"","sources":["../src/sentry.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAwC;AACxC,iEAAiE;AACjE,8DAAgD;AAChD,uDAAqD;AAGrD,8CAA0D;AAC1D,oDAAgE;AAChE,gEAAiD;AACjD,mCAA+E;AAC/E,uCAImB;AAEnB,uDAI8B;AAG9B,+DAA+C;AAE/C,MAAM,cAAc,GAAY;IAC9B,IAAI,EAAE,qCAAqC;IAC3C,QAAQ,EAAE;QACR;YACE,IAAI,EAAE,6BAAmB;YACzB,OAAO,EAAE,6BAAmB;SAC7B;QACD;YACE,IAAI,EAAE,qCAA2B;YACjC,OAAO,EAAE,0BAA2B;SACrC;KACF;IACD,OAAO,EAAE,6BAAmB;CAC7B,CAAC;AAEF,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAuB,CAAC;AACjD,MAAM,gBAAgB,GAAG,wBAAS,CAAC,oBAAoB,KAAK,qCAAoB,CAAC,IAAI,CAAC;AAEtF,MAAM,iBAAiB,GAAG,GAAG,EAAE,CAAC,CAAC;IAC/B,kBAAkB,EAAE,KAAK;IACzB,OAAO,EAAE,iBAAiB,EAAE;IAC5B,IAAI,EAAE,OAAO,EA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AClR,CAAC;YACF,OAAO,IAAA,mBAAU,EAAC;gBAChB,GAAG,aAAa;gBAChB,YAAY,EAAE,KAAK;gBACnB,yBAAyB,EAAE,KAAK;aACjC,CAAC,CAAC;SACJ;aAAM;YACL,MAAM,CAAC,CAAC;SACT;KACF;AACH,CAAC,CAAC;AAjEW,QAAA,IAAI,QAiEf","sourcesContent":["import { Platform } from 'react-native';\nimport Constants, { ExecutionEnvironment } from 'expo-constants';\nimport * as Application from 'expo-application';\nimport { RewriteFrames } from '@sentry/integrations';\nimport { Integration, SdkInfo } from '@sentry/types';\n\nimport { ExpoBareIntegration } from './integrations/bare';\nimport { ExpoManagedIntegration } from './integrations/managed';\nimport * as Updates from './integrations/Updates'\nimport { SentryExpoNativeOptions, overrideDefaultIntegrations } from './utils';\nimport {\n SENTRY_EXPO_PACKAGE,\n SENTRY_EXPO_VERSION,\n SENTRY_REACT_NATIVE_PACKAGE,\n} from './version';\n\nimport {\n init as initNative,\n Integrations,\n SDK_VERSION as SENTRY_REACT_NATIVE_VERSION,\n} from '@sentry/react-native';\nimport { AppManifest } from 'expo-constants/build/Constants.types';\n\nexport * as Native from '@sentry/react-native';\n\nconst defaultSdkInfo: SdkInfo = {\n name: 'sentry.javascript.react-native.expo',\n packages: [\n {\n name: SENTRY_EXPO_PACKAGE,\n version: SENTRY_EXPO_VERSION,\n },\n {\n name: SENTRY_REACT_NATIVE_PACKAGE,\n version: SENTRY_REACT_NATIVE_VERSION,\n }\n ],\n version: SENTRY_EXPO_VERSION,\n};\n\nconst MANIFEST = Updates.manifest as AppManifest;\nconst IS_BARE_WORKFLOW = Constants.executionEnvironment === ExecutionEnvironment.Bare;\n\nconst getDefaultOptions = () => ({\n enableNativeNagger: false, // Otherwise this will trigger an Alert(), let's rely on the logs instead\n release: getDefaultRelease(),\n dist: getDist(),\n ...(IS_BARE_WORKFLOW ? {} : { enableNative: false, enableNativeCrashHandling: false }),\n _metadata: {\n sdk: defaultSdkInfo,\n },\n});\n\n/**\n * For embedded updates, the dist version needs to match what is set by the Sentry build script.\n * For modern manifest OTA updates, the updateId is used.\n */\nfunction getDist(): string | null | undefined {\n if (Updates.isEmbeddedLaunch) {\n return MANIFEST.revisionId ? MANIFEST.version : `${Application.nativeBuildVersion}`;\n } else {\n return Updates.updateId;\n }\n}\n\n/**\n * We assign the appropriate release based on if the app is running in development,\n * on an Classic OTA Update, or on a no-publish build.\n */\nfunction getDefaultRelease(): string {\n if (__DEV__) {\n return 'DEVELOPMENT';\n } else if (MANIFEST.revisionId) {\n // Want to make sure this still exists in EAS update: equal on iOS & Android\n return MANIFEST.revisionId;\n } else {\n // This is the default set by Sentry's native Xcode & Gradle scripts\n return `${Application.applicationId}@${Application.nativeApplicationVersion}+${Application.nativeBuildVersion}`;\n }\n}\n\nexport const init = (options: SentryExpoNativeOptions = {}) => {\n const defaultExpoIntegrations = [\n new Integrations.ReactNativeErrorHandlers({\n onerror: false,\n onunhandledrejection: true,\n }),\n IS_BARE_WORKFLOW ? new ExpoBareIntegration() : new ExpoManagedIntegration(),\n new RewriteFrames({\n iteratee: (frame) => {\n if (frame.filename && frame.filename !== '[native code]') {\n frame.filename =\n Platform.OS === 'android' ? 'app:///index.android.bundle' : 'app:///main.jsbundle';\n }\n return frame;\n },\n }),\n ];\n\n let nativeOptions = { ...getDefaultOptions(), ...options } as SentryExpoNativeOptions;\n\n if (Array.isArray(nativeOptions.integrations)) {\n // Allow users to override Expo defaults...ymmv\n nativeOptions.integrations = overrideDefaultIntegrations(\n defaultExpoIntegrations,\n nativeOptions.integrations\n );\n } else if (typeof nativeOptions.integrations === 'function') {\n // Need to rewrite the function to take Expo's default integrations\n let functionWithoutExpoIntegrations = nativeOptions.integrations;\n const functionWithExpoIntegrations = (integrations: Integration[]) => {\n return functionWithoutExpoIntegrations(\n overrideDefaultIntegrations(integrations, defaultExpoIntegrations)\n );\n };\n nativeOptions.integrations = functionWithExpoIntegrations;\n } else {\n nativeOptions.integrations = [...defaultExpoIntegrations];\n }\n\n if (__DEV__ && !nativeOptions.enableInExpoDevelopment) {\n nativeOptions.enabled = false;\n if (!nativeOptions.hasOwnProperty('enableInExpoDevelopment')) {\n console.log(\n '[sentry-expo] Disabled Sentry in development. Note you can set Sentry.init({ enableInExpoDevelopment: true });'\n );\n }\n }\n\n try {\n return initNative({ ...nativeOptions });\n } catch (e) {\n if (IS_BARE_WORKFLOW) {\n // Native projects have not been linked, try to continue with no native capability\n console.warn(\n `[sentry-expo] Disabling the Sentry Native SDK (all JS errors will still be reported).\\nTo enable it, run 'yarn add @sentry/react-native' or 'npm install @sentry/react-native' in your project directory. To silence this warning, pass 'enableNative: false' to Sentry.init().`\n );\n return initNative({\n ...nativeOptions,\n enableNative: false,\n enableNativeCrashHandling: false,\n });\n } else {\n throw e;\n }\n }\n};\n"]} \ No newline at end of file diff --git a/package.json b/package.json index 833cafe..0a10c96 100644 --- a/package.json +++ b/package.json @@ -50,8 +50,7 @@ "expo": ">=47.0.0", "expo-application": "*", "expo-constants": "*", - "expo-device": "*", - "expo-updates": "*" + "expo-device": "*" }, "devDependencies": { "@expo/config-types": "^47.0.0", diff --git a/src/integrations/Updates.ts b/src/integrations/Updates.ts new file mode 100644 index 0000000..44b5d0f --- /dev/null +++ b/src/integrations/Updates.ts @@ -0,0 +1,15 @@ +import { NativeModulesProxy } from 'expo-modules-core'; +const ExpoUpdates = NativeModulesProxy.ExpoUpdates ?? ({} as any); + +export const isEmbeddedLaunch: boolean = ExpoUpdates.isEmbeddedLaunch || false; +export const releaseChannel: string = ExpoUpdates.releaseChannel ?? 'default'; +export const channel: string | null = ExpoUpdates.channel ?? null; +export const updateId: string | null = + ExpoUpdates.updateId && typeof ExpoUpdates.updateId === 'string' + ? ExpoUpdates.updateId.toLowerCase() + : null; +export const runtimeVersion: string | null = ExpoUpdates.runtimeVersion ?? null; + +export const manifest = + (ExpoUpdates.manifestString ? JSON.parse(ExpoUpdates.manifestString) : ExpoUpdates.manifest) ?? + {}; \ No newline at end of file diff --git a/src/integrations/bare.ts b/src/integrations/bare.ts index d711a86..69544ce 100644 --- a/src/integrations/bare.ts +++ b/src/integrations/bare.ts @@ -1,7 +1,7 @@ import { Platform } from 'react-native'; import Constants from 'expo-constants'; import * as Device from 'expo-device'; -import * as Updates from 'expo-updates'; +import * as Updates from './Updates'; import { setExtras, setTags, diff --git a/src/integrations/managed.ts b/src/integrations/managed.ts index 57a1c81..8a35ee2 100644 --- a/src/integrations/managed.ts +++ b/src/integrations/managed.ts @@ -1,7 +1,7 @@ +import * as Updates from './Updates'; import { Platform } from 'react-native'; import Constants from 'expo-constants'; import * as Device from 'expo-device'; -import * as Updates from 'expo-updates'; import { setExtras, setTags, @@ -60,7 +60,7 @@ export class ExpoManagedIntegration { }); } - if (Updates?.channel) { + if (Updates.channel) { setTag('expoChannel', Updates.channel); } diff --git a/src/sentry.ts b/src/sentry.ts index 92e5865..0ecee38 100644 --- a/src/sentry.ts +++ b/src/sentry.ts @@ -1,5 +1,4 @@ import { Platform } from 'react-native'; -import * as Updates from 'expo-updates'; import Constants, { ExecutionEnvironment } from 'expo-constants'; import * as Application from 'expo-application'; import { RewriteFrames } from '@sentry/integrations'; @@ -7,6 +6,7 @@ import { Integration, SdkInfo } from '@sentry/types'; import { ExpoBareIntegration } from './integrations/bare'; import { ExpoManagedIntegration } from './integrations/managed'; +import * as Updates from './integrations/Updates' import { SentryExpoNativeOptions, overrideDefaultIntegrations } from './utils'; import { SENTRY_EXPO_PACKAGE, diff --git a/yarn.lock b/yarn.lock index cd5ec52..50088fa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -347,16 +347,16 @@ dependencies: "@babel/types" "^7.22.5" +"@babel/helper-string-parser@^7.19.4", "@babel/helper-string-parser@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz#533f36457a25814cf1df6488523ad547d784a99f" + integrity sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw== + "@babel/helper-string-parser@^7.21.5": version "7.21.5" resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.21.5.tgz#2b3eea65443c6bdc31c22d037c65f6d323b6b2bd" integrity sha512-5pTUx3hAJaZIdW99sJ6ZUUgWq/Y+Hja7TowEnLNMm1VivRgZQL3vpBY3qUACVsvw+yQU6+YgfBVmcbLaZtrA1w== -"@babel/helper-string-parser@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz#533f36457a25814cf1df6488523ad547d784a99f" - integrity sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw== - "@babel/helper-validator-identifier@^7.19.1": version "7.19.1" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz#7eea834cf32901ffdc1a7ee555e2f9c27e249ca2" @@ -405,7 +405,7 @@ "@babel/traverse" "^7.22.5" "@babel/types" "^7.22.5" -"@babel/highlight@^7.10.4", "@babel/highlight@^7.22.5": +"@babel/highlight@^7.10.4", "@babel/highlight@^7.18.6", "@babel/highlight@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.22.5.tgz#aa6c05c5407a67ebce408162b7ede789b4d22031" integrity sha512-BSKlD1hgnedS5XRnGOljZawtag7H1yPfQp0tdNJCHoH6AZ+Pcm9VvkrK59/Yy593Ypg0zMxH2BxD1VPYUQ7UIw== @@ -6419,11 +6419,6 @@ jsc-android@^250231.0.0: resolved "https://registry.yarnpkg.com/jsc-android/-/jsc-android-250231.0.0.tgz#91720f8df382a108872fa4b3f558f33ba5e95262" integrity sha512-rS46PvsjYmdmuz1OAWXY/1kCYG7pnf1TBqeTiOJr1iDz7s5DLxxC9n/ZMknLDxzYzNVfI7R95MH10emSSG1Wuw== -jsc-safe-url@^0.2.2: - version "0.2.4" - resolved "https://registry.yarnpkg.com/jsc-safe-url/-/jsc-safe-url-0.2.4.tgz#141c14fbb43791e88d5dc64e85a374575a83477a" - integrity sha512-0wM3YBWtYePOjfyXQH5MWQ8H7sdk5EXSwZvmSLKk2RboVQ2Bu239jycHDz5J/8Blf3K0Qnoy2b6xD+z10MFB+Q== - jscodeshift@^0.13.1: version "0.13.1" resolved "https://registry.yarnpkg.com/jscodeshift/-/jscodeshift-0.13.1.tgz#69bfe51e54c831296380585c6d9e733512aecdef"