@sentry/react-native 7.1.0 → 7.2.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/libs/replay-stubs.jar +0 -0
- package/android/src/main/java/io/sentry/react/RNSentryVersion.java +1 -1
- package/dist/js/integrations/logEnricherIntegration.js +28 -9
- package/dist/js/integrations/logEnricherIntegration.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 +5 -0
- package/dist/js/replay/mobilereplay.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/version.d.ts +1 -1
- package/dist/js/version.js +1 -1
- package/dist/js/version.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 +2 -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.1'
|
|
50
50
|
|
|
51
51
|
if defined? install_modules_dependencies
|
|
52
52
|
# Default React Native dependencies for 0.71 and above (new and legacy architecture)
|
|
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.2.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";
|
|
@@ -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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,OAAO,CAAC,MAAM,CAAC,2DAA2D,CAAC,EAAE,CAAC,CAAC;SACvF;QACD,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;;CAC1B;AAED,SAAS,UAAU,CAAC,GAAQ,EAAE,MAAyB;;IACrD,IAAI,WAAW,KAAK,SAAS,EAAE;QAC7B,OAAO;KACR;IAED,wCAAwC;IACxC,MAAM,aAAa,GAAG,MAAA,GAAG,CAAC,UAAU,mCAAI,EAAE,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"]}
|
|
@@ -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":"AAAA,OAAO,KAAK,EAAyC,WAAW,EAAE,MAAM,cAAc,CAAC;AAQvF,eAAO,MAAM,8BAA8B,iBAAiB,CAAC;AAE7D,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;;;;;;;OASG;IACH,8BAA8B,CAAC,EAAE,OAAO,CAAC;IAEzC;;;;;;;;;;;OAWG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B;;;;;;;;;;OAUG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAwBD,KAAK,uBAAuB,GAAG,WAAW,GAAG;IAC3C,OAAO,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"mobilereplay.d.ts","sourceRoot":"","sources":["../../../src/js/replay/mobilereplay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyC,WAAW,EAAE,MAAM,cAAc,CAAC;AAQvF,eAAO,MAAM,8BAA8B,iBAAiB,CAAC;AAE7D,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;;;;;;;OASG;IACH,8BAA8B,CAAC,EAAE,OAAO,CAAC;IAEzC;;;;;;;;;;;OAWG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B;;;;;;;;;;OAUG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAwBD,KAAK,uBAAuB,GAAG,WAAW,GAAG;IAC3C,OAAO,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAAC;IACvC,WAAW,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;CAClC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,uBAAuB,iBAAiB,mBAAmB,KAAoB,uBAyE3F,CAAC"}
|
|
@@ -93,6 +93,9 @@ export const mobileReplayIntegration = (initOptions = defaultOptions) => {
|
|
|
93
93
|
});
|
|
94
94
|
client.on('beforeAddBreadcrumb', enrichXhrBreadcrumbsForMobileReplay);
|
|
95
95
|
}
|
|
96
|
+
function getReplayId() {
|
|
97
|
+
return NATIVE.getCurrentReplayId();
|
|
98
|
+
}
|
|
96
99
|
// TODO: When adding manual API, ensure overlap with the web replay so users can use the same API interchangeably
|
|
97
100
|
// https://github.com/getsentry/sentry-javascript/blob/develop/packages/replay-internal/src/integration.ts#L45
|
|
98
101
|
return {
|
|
@@ -100,12 +103,14 @@ export const mobileReplayIntegration = (initOptions = defaultOptions) => {
|
|
|
100
103
|
setup,
|
|
101
104
|
processEvent,
|
|
102
105
|
options: options,
|
|
106
|
+
getReplayId: getReplayId,
|
|
103
107
|
};
|
|
104
108
|
};
|
|
105
109
|
const mobileReplayIntegrationNoop = () => {
|
|
106
110
|
return {
|
|
107
111
|
name: MOBILE_REPLAY_INTEGRATION_NAME,
|
|
108
112
|
options: defaultOptions,
|
|
113
|
+
getReplayId: () => null, // Mock implementation for noop version
|
|
109
114
|
};
|
|
110
115
|
};
|
|
111
116
|
//# 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,WAAyC;IAC7D,MAAM,MAAM,mCACP,cAAc,GACd,WAAW,CACf,CAAC;IAEF,IAAI,WAAW,CAAC,oBAAoB,KAAK,SAAS,IAAI,WAAW,CAAC,8BAA8B,KAAK,SAAS,EAAE;QAC9G,MAAM,CAAC,oBAAoB,GAAG,WAAW,CAAC,8BAA8B,CAAC;KAC1E;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;
|
|
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,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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 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 return event;\n }\n\n const replayId = await NATIVE.captureReplay(isHardCrash(event));\n if (!replayId) {\n debug.log(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} not sampled for event ${event.event_id}.`);\n return event;\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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/js/tools/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/js/tools/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AACnF,OAAO,KAAK,WAAW,MAAM,2BAA2B,CAAC;AAKzD,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,mBAAmB,CAAC;IAC1B,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,GAAG,EAAE,EAAE,CAAC;KACT,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG;IACnB,OAAO,EAAE,KAAK,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG;IAC/C,oBAAoB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;CACnD,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7D,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,gBAAgB,GAAG,OAAO,CAAC,MAAM,GAAG,gBAAgB,CAAC,CAAC;AAEnG,MAAM,MAAM,eAAe,GAAG,CAC5B,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC,EACjC,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,iBAAiB,GAAG,kCAAkC,KAC5D,qBAAqB,CAAC;AAE3B;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAahD;AAED;;;;;;;GAOG;AACH,wBAAgB,gCAAgC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKjF;AAiDD,eAAO,MAAM,SAAS,QA1Cc,YAAY,MAAM,CA0CV,CAAC;AAI7C;;GAEG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,SAAS,MAAM,CAAC,WAAW,CAAC,EAAE,EACvC,MAAM,EAAE,MAAM,CAAC,eAAe,CAAC,GAC9B,MAAM,CAAC,WAAW,CAAC,EAAE,CAcvB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GACjB,MAAM,CAAC,eAAe,CAAC,GAAG;IAAE,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,CAsBjE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC,CAkBD"}
|
package/dist/js/tools/utils.js
CHANGED
|
@@ -2,13 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getExpoConfig = exports.createVirtualJSModule = exports.prependModule = exports.createSet = exports.determineDebugIdFromBundleSource = exports.stringToUUID = exports.createDebugIdSnippet = void 0;
|
|
4
4
|
const crypto = require("crypto");
|
|
5
|
-
|
|
6
|
-
try {
|
|
7
|
-
countLines = require('metro/private/lib/countLines');
|
|
8
|
-
}
|
|
9
|
-
catch (e) {
|
|
10
|
-
countLines = require('metro/src/lib/countLines');
|
|
11
|
-
}
|
|
5
|
+
const countLines_1 = require("./vendor/metro/countLines");
|
|
12
6
|
/**
|
|
13
7
|
* Returns minified Debug ID code snippet.
|
|
14
8
|
*/
|
|
@@ -126,7 +120,7 @@ function createVirtualJSModule(modulePath, moduleCode) {
|
|
|
126
120
|
type: 'js/script/virtual',
|
|
127
121
|
data: {
|
|
128
122
|
code: sourceCode,
|
|
129
|
-
lineCount:
|
|
123
|
+
lineCount: (0, countLines_1.default)(sourceCode),
|
|
130
124
|
map: [],
|
|
131
125
|
},
|
|
132
126
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/js/tools/utils.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AAOjC,IAAI,UAAiC,CAAC;AACtC,IAAI;IACF,UAAU,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;CACtD;AAAC,OAAO,CAAC,EAAE;IACV,UAAU,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;CAClD;AAkCD;;GAEG;AACH,SAAgB,oBAAoB,CAAC,OAAe;IAClD,OAAO,+JAA+J,OAAO,2CAA2C,OAAO,eAAe,CAAC;AACjP,CAAC;AAFD,oDAEC;AAED;;;;GAIG;AACH,SAAgB,YAAY,CAAC,GAAW;IACtC,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACxC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACnB,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAErC,oFAAoF;IACpF,uBAAuB;IACvB,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAW,CAAC;IAE9F,OAAO,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AC;AACJ,CAAC;AAzBD,sDAyBC;AAED;;GAEG;AACH,SAAgB,aAAa,CAAC,WAAmB;IAI/C,IAAI;QACF,iGAAiG;QACjG,MAAM,UAAU,GAAG,OAAO,CAAC,cAAc,CAExC,CAAC;QACF,IAAI,UAAU,CAAC,SAAS,EAAE;YACxB,MAAM,EAAE,GAAG,EAAE,GAAG,UAAU,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;YAClD,OAAO;gBACL,IAAI,EAAE,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;gBACrE,OAAO,EAAE,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;aAClF,CAAC;SACH;KACF;IAAC,WAAM;QACN,yCAAyC;KAC1C;IAED,OAAO,EAAE,CAAC;AACZ,CAAC;AArBD,sCAqBC","sourcesContent":["import * as crypto from 'crypto';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport type { MixedOutput, Module, ReadOnlyGraph, SerializerOptions } from 'metro';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport type * as countLinesType from 'metro/private/lib/countLines';\nimport type CountingSet from 'metro/src/lib/CountingSet'; // types are in src but exports are in private\n\nlet countLines: typeof countLinesType;\ntry {\n countLines = require('metro/private/lib/countLines');\n} catch (e) {\n countLines = require('metro/src/lib/countLines');\n}\n\n// Variant of MixedOutput\n// https://github.com/facebook/metro/blob/9b85f83c9cc837d8cd897aa7723be7da5b296067/packages/metro/src/DeltaBundler/types.flow.js#L21\nexport type VirtualJSOutput = {\n type: 'js/script/virtual';\n data: {\n code: string;\n lineCount: number;\n map: [];\n };\n};\n\nexport type Bundle = {\n modules: Array<[id: number, code: string]>;\n post: string;\n pre: string;\n};\n\nexport type SentryMetroSerializerOptionsExtras = {\n sentryBundleCallback?: (bundle: Bundle) => Bundle;\n};\n\nexport type SerializedBundle = { code: string; map: string };\n\nexport type MetroSerializerOutput = string | SerializedBundle | Promise<string | SerializedBundle>;\n\nexport type MetroSerializer = (\n entryPoint: string,\n preModules: ReadonlyArray<Module>,\n graph: ReadOnlyGraph,\n options: SerializerOptions & SentryMetroSerializerOptionsExtras,\n) => MetroSerializerOutput;\n\n/**\n * Returns minified Debug ID code snippet.\n */\nexport function createDebugIdSnippet(debugId: string): string {\n return `var _sentryDebugIds,_sentryDebugIdIdentifier;void 0===_sentryDebugIds&&(_sentryDebugIds={});try{var stack=(new Error).stack;stack&&(_sentryDebugIds[stack]=\"${debugId}\",_sentryDebugIdIdentifier=\"sentry-dbid-${debugId}\")}catch(e){}`;\n}\n\n/**\n * Deterministically hashes a string and turns the hash into a uuid.\n *\n * https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/58271f1af2ade6b3e64d393d70376ae53bc5bd2f/packages/bundler-plugin-core/src/utils.ts#L174\n */\nexport function stringToUUID(str: string): string {\n const md5sum = crypto.createHash('md5');\n md5sum.update(str);\n const md5Hash = md5sum.digest('hex');\n\n // Position 16 is fixed to either 8, 9, a, or b in the uuid v4 spec (10xx in binary)\n // RFC 4122 section 4.4\n const v4variant = ['8', '9', 'a', 'b'][md5Hash.substring(16, 17).charCodeAt(0) % 4] as string;\n\n return `${md5Hash.substring(0, 8)}-${md5Hash.substring(8, 12)}-4${md5Hash.substring(\n 13,\n 16,\n )}-${v4variant}${md5Hash.substring(17, 20)}-${md5Hash.substring(20)}`.toLowerCase();\n}\n\n/**\n * Looks for a particular string pattern (`sdbid-[debug ID]`) in the bundle\n * source and extracts the bundle's debug ID from it.\n *\n * The string pattern is injected via the debug ID injection snipped.\n *\n * https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/40f918458ed449d8b3eabaf64d13c08218213f65/packages/bundler-plugin-core/src/debug-id-upload.ts#L293-L294\n */\nexport function determineDebugIdFromBundleSource(code: string): string | undefined {\n const match = code.match(\n /sentry-dbid-([0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12})/,\n );\n return match ? match[1] : undefined;\n}\n\n/**\n * CountingSet was added in Metro 0.72.0 before that NodeJS Set was used.\n *\n * https://github.com/facebook/metro/blob/fc29a1177f883144674cf85a813b58567f69d545/packages/metro/src/lib/CountingSet.js\n */\nfunction resolveSetCreator(): () => CountingSet<string> {\n const CountingSetFromPrivate = safeRequireCountingSetFromPrivate();\n if (CountingSetFromPrivate) {\n return () => new CountingSetFromPrivate.default();\n }\n\n const CountingSetFromSrc = safeRequireCountingSetFromSrc();\n if (CountingSetFromSrc) {\n return () => new CountingSetFromSrc.default();\n }\n\n return () => new Set() as unknown as CountingSet<string>;\n}\n\n/**\n * CountingSet was added in Metro 0.72.0 before that NodeJS Set was used.\n *\n * https://github.com/facebook/metro/blob/fc29a1177f883144674cf85a813b58567f69d545/packages/metro/src/lib/CountingSet.js\n */\nfunction safeRequireCountingSetFromSrc(): { default: new <T>() => CountingSet<T> } | undefined {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires, import/no-extraneous-dependencies\n return require('metro/src/lib/CountingSet');\n } catch (e) {\n return undefined;\n }\n}\n\n/**\n * CountingSet was moved to private in Metro 0.83.0. (all src exports were moved to private)\n *\n * https://github.com/facebook/metro/commit/ae6f42372ed361611b5672705f22081c2022cf28\n */\nfunction safeRequireCountingSetFromPrivate(): { default: new <T>() => CountingSet<T> } | undefined {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires, import/no-extraneous-dependencies\n return require('metro/private/lib/CountingSet');\n } catch (e) {\n return undefined;\n }\n}\n\nexport const createSet = resolveSetCreator();\n\nconst PRELUDE_MODULE_PATH = '__prelude__';\n\n/**\n * Prepends the module after default required prelude modules.\n */\nexport function prependModule(\n modules: readonly Module<MixedOutput>[],\n module: Module<VirtualJSOutput>,\n): Module<MixedOutput>[] {\n const modifiedPreModules = [...modules];\n if (\n modifiedPreModules.length > 0 &&\n modifiedPreModules[0] !== undefined &&\n modifiedPreModules[0].path === PRELUDE_MODULE_PATH\n ) {\n // prelude module must be first as it measures the bundle startup time\n modifiedPreModules.unshift(modules[0] as Module<VirtualJSOutput>);\n modifiedPreModules[1] = module;\n } else {\n modifiedPreModules.unshift(module);\n }\n return modifiedPreModules;\n}\n\n/**\n * Creates a virtual JS module with the given path and code.\n */\nexport function createVirtualJSModule(\n modulePath: string,\n moduleCode: string,\n): Module<VirtualJSOutput> & { setSource: (code: string) => void } {\n let sourceCode = moduleCode;\n\n return {\n setSource: (code: string) => {\n sourceCode = code;\n },\n dependencies: new Map(),\n getSource: () => Buffer.from(sourceCode),\n inverseDependencies: createSet(),\n path: modulePath,\n output: [\n {\n type: 'js/script/virtual',\n data: {\n code: sourceCode,\n lineCount: countLines(sourceCode),\n map: [],\n },\n },\n ],\n };\n}\n\n/**\n * Tries to load Expo config using `@expo/config` package.\n */\nexport function getExpoConfig(projectRoot: string): Partial<{\n name: string;\n version: string;\n}> {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires, import/no-extraneous-dependencies\n const expoConfig = require('@expo/config') as {\n getConfig?: (projectRoot: string) => { exp: Record<string, unknown> };\n };\n if (expoConfig.getConfig) {\n const { exp } = expoConfig.getConfig(projectRoot);\n return {\n name: typeof exp.name === 'string' && exp.name ? exp.name : undefined,\n version: typeof exp.version === 'string' && exp.version ? exp.version : undefined,\n };\n }\n } catch {\n // @expo/config not available, do nothing\n }\n\n return {};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/js/tools/utils.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AAIjC,0DAAmD;AAkCnD;;GAEG;AACH,SAAgB,oBAAoB,CAAC,OAAe;IAClD,OAAO,+JAA+J,OAAO,2CAA2C,OAAO,eAAe,CAAC;AACjP,CAAC;AAFD,oDAEC;AAED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5B,OAAO;QACL,SAAS,EAAE,CAAC,IAAY,EAAE,EAAE;YAC1B,UAAU,GAAG,IAAI,CAAC;QACpB,CAAC;QACD,YAAY,EAAE,IAAI,GAAG,EAAE;QACvB,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;QACxC,mBAAmB,EAAE,IAAA,iBAAS,GAAE;QAChC,IAAI,EAAE,UAAU;QAChB,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,mBAAmB;gBACzB,IAAI,EAAE;oBACJ,IAAI,EAAE,UAAU;oBAChB,SAAS,EAAE,IAAA,oBAAU,EAAC,UAAU,CAAC;oBACjC,GAAG,EAAE,EAAE;iBACR;aACF;SACF;KACF,CAAC;AACJ,CAAC;AAzBD,sDAyBC;AAED;;GAEG;AACH,SAAgB,aAAa,CAAC,WAAmB;IAI/C,IAAI;QACF,iGAAiG;QACjG,MAAM,UAAU,GAAG,OAAO,CAAC,cAAc,CAExC,CAAC;QACF,IAAI,UAAU,CAAC,SAAS,EAAE;YACxB,MAAM,EAAE,GAAG,EAAE,GAAG,UAAU,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;YAClD,OAAO;gBACL,IAAI,EAAE,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;gBACrE,OAAO,EAAE,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;aAClF,CAAC;SACH;KACF;IAAC,WAAM;QACN,yCAAyC;KAC1C;IAED,OAAO,EAAE,CAAC;AACZ,CAAC;AArBD,sCAqBC","sourcesContent":["import * as crypto from 'crypto';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport type { MixedOutput, Module, ReadOnlyGraph, SerializerOptions } from 'metro';\nimport type CountingSet from 'metro/src/lib/CountingSet'; // types are in src but exports are in private\nimport countLines from './vendor/metro/countLines';\n\n// Variant of MixedOutput\n// https://github.com/facebook/metro/blob/9b85f83c9cc837d8cd897aa7723be7da5b296067/packages/metro/src/DeltaBundler/types.flow.js#L21\nexport type VirtualJSOutput = {\n type: 'js/script/virtual';\n data: {\n code: string;\n lineCount: number;\n map: [];\n };\n};\n\nexport type Bundle = {\n modules: Array<[id: number, code: string]>;\n post: string;\n pre: string;\n};\n\nexport type SentryMetroSerializerOptionsExtras = {\n sentryBundleCallback?: (bundle: Bundle) => Bundle;\n};\n\nexport type SerializedBundle = { code: string; map: string };\n\nexport type MetroSerializerOutput = string | SerializedBundle | Promise<string | SerializedBundle>;\n\nexport type MetroSerializer = (\n entryPoint: string,\n preModules: ReadonlyArray<Module>,\n graph: ReadOnlyGraph,\n options: SerializerOptions & SentryMetroSerializerOptionsExtras,\n) => MetroSerializerOutput;\n\n/**\n * Returns minified Debug ID code snippet.\n */\nexport function createDebugIdSnippet(debugId: string): string {\n return `var _sentryDebugIds,_sentryDebugIdIdentifier;void 0===_sentryDebugIds&&(_sentryDebugIds={});try{var stack=(new Error).stack;stack&&(_sentryDebugIds[stack]=\"${debugId}\",_sentryDebugIdIdentifier=\"sentry-dbid-${debugId}\")}catch(e){}`;\n}\n\n/**\n * Deterministically hashes a string and turns the hash into a uuid.\n *\n * https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/58271f1af2ade6b3e64d393d70376ae53bc5bd2f/packages/bundler-plugin-core/src/utils.ts#L174\n */\nexport function stringToUUID(str: string): string {\n const md5sum = crypto.createHash('md5');\n md5sum.update(str);\n const md5Hash = md5sum.digest('hex');\n\n // Position 16 is fixed to either 8, 9, a, or b in the uuid v4 spec (10xx in binary)\n // RFC 4122 section 4.4\n const v4variant = ['8', '9', 'a', 'b'][md5Hash.substring(16, 17).charCodeAt(0) % 4] as string;\n\n return `${md5Hash.substring(0, 8)}-${md5Hash.substring(8, 12)}-4${md5Hash.substring(\n 13,\n 16,\n )}-${v4variant}${md5Hash.substring(17, 20)}-${md5Hash.substring(20)}`.toLowerCase();\n}\n\n/**\n * Looks for a particular string pattern (`sdbid-[debug ID]`) in the bundle\n * source and extracts the bundle's debug ID from it.\n *\n * The string pattern is injected via the debug ID injection snipped.\n *\n * https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/40f918458ed449d8b3eabaf64d13c08218213f65/packages/bundler-plugin-core/src/debug-id-upload.ts#L293-L294\n */\nexport function determineDebugIdFromBundleSource(code: string): string | undefined {\n const match = code.match(\n /sentry-dbid-([0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12})/,\n );\n return match ? match[1] : undefined;\n}\n\n/**\n * CountingSet was added in Metro 0.72.0 before that NodeJS Set was used.\n *\n * https://github.com/facebook/metro/blob/fc29a1177f883144674cf85a813b58567f69d545/packages/metro/src/lib/CountingSet.js\n */\nfunction resolveSetCreator(): () => CountingSet<string> {\n const CountingSetFromPrivate = safeRequireCountingSetFromPrivate();\n if (CountingSetFromPrivate) {\n return () => new CountingSetFromPrivate.default();\n }\n\n const CountingSetFromSrc = safeRequireCountingSetFromSrc();\n if (CountingSetFromSrc) {\n return () => new CountingSetFromSrc.default();\n }\n\n return () => new Set() as unknown as CountingSet<string>;\n}\n\n/**\n * CountingSet was added in Metro 0.72.0 before that NodeJS Set was used.\n *\n * https://github.com/facebook/metro/blob/fc29a1177f883144674cf85a813b58567f69d545/packages/metro/src/lib/CountingSet.js\n */\nfunction safeRequireCountingSetFromSrc(): { default: new <T>() => CountingSet<T> } | undefined {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires, import/no-extraneous-dependencies\n return require('metro/src/lib/CountingSet');\n } catch (e) {\n return undefined;\n }\n}\n\n/**\n * CountingSet was moved to private in Metro 0.83.0. (all src exports were moved to private)\n *\n * https://github.com/facebook/metro/commit/ae6f42372ed361611b5672705f22081c2022cf28\n */\nfunction safeRequireCountingSetFromPrivate(): { default: new <T>() => CountingSet<T> } | undefined {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires, import/no-extraneous-dependencies\n return require('metro/private/lib/CountingSet');\n } catch (e) {\n return undefined;\n }\n}\n\nexport const createSet = resolveSetCreator();\n\nconst PRELUDE_MODULE_PATH = '__prelude__';\n\n/**\n * Prepends the module after default required prelude modules.\n */\nexport function prependModule(\n modules: readonly Module<MixedOutput>[],\n module: Module<VirtualJSOutput>,\n): Module<MixedOutput>[] {\n const modifiedPreModules = [...modules];\n if (\n modifiedPreModules.length > 0 &&\n modifiedPreModules[0] !== undefined &&\n modifiedPreModules[0].path === PRELUDE_MODULE_PATH\n ) {\n // prelude module must be first as it measures the bundle startup time\n modifiedPreModules.unshift(modules[0] as Module<VirtualJSOutput>);\n modifiedPreModules[1] = module;\n } else {\n modifiedPreModules.unshift(module);\n }\n return modifiedPreModules;\n}\n\n/**\n * Creates a virtual JS module with the given path and code.\n */\nexport function createVirtualJSModule(\n modulePath: string,\n moduleCode: string,\n): Module<VirtualJSOutput> & { setSource: (code: string) => void } {\n let sourceCode = moduleCode;\n\n return {\n setSource: (code: string) => {\n sourceCode = code;\n },\n dependencies: new Map(),\n getSource: () => Buffer.from(sourceCode),\n inverseDependencies: createSet(),\n path: modulePath,\n output: [\n {\n type: 'js/script/virtual',\n data: {\n code: sourceCode,\n lineCount: countLines(sourceCode),\n map: [],\n },\n },\n ],\n };\n}\n\n/**\n * Tries to load Expo config using `@expo/config` package.\n */\nexport function getExpoConfig(projectRoot: string): Partial<{\n name: string;\n version: string;\n}> {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires, import/no-extraneous-dependencies\n const expoConfig = require('@expo/config') as {\n getConfig?: (projectRoot: string) => { exp: Record<string, unknown> };\n };\n if (expoConfig.getConfig) {\n const { exp } = expoConfig.getConfig(projectRoot);\n return {\n name: typeof exp.name === 'string' && exp.name ? exp.name : undefined,\n version: typeof exp.version === 'string' && exp.version ? exp.version : undefined,\n };\n }\n } catch {\n // @expo/config not available, do nothing\n }\n\n return {};\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"countLines.d.ts","sourceRoot":"","sources":["../../../../../src/js/tools/vendor/metro/countLines.ts"],"names":[],"mappings":"iCAgCwB,MAAM,KAAG,MAAM;AAAvC,wBAAoF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Vendored from @facebook/metro
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
// https://github.com/facebook/metro/blob/93d68cca249202fd3eb52672217e725d90e44eb4/packages/metro/src/lib/countLines.js
|
|
5
|
+
// MIT License
|
|
6
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
// of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
// in the Software without restriction, including without limitation the rights
|
|
10
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
// copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
// furnished to do so, subject to the following conditions:
|
|
13
|
+
// The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
// copies or substantial portions of the Software.
|
|
15
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
// SOFTWARE.
|
|
22
|
+
// This is exported as private from `metro` and as such breaking changes can appear anytime.
|
|
23
|
+
// In the past these were related to the way the function is exported. Never to the function itself.
|
|
24
|
+
// Thus it should be more stable to vendor it.
|
|
25
|
+
const newline = /\r\n?|\n|\u2028|\u2029/g;
|
|
26
|
+
exports.default = (string) => (string.match(newline) || []).length + 1;
|
|
27
|
+
//# sourceMappingURL=countLines.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"countLines.js","sourceRoot":"","sources":["../../../../../src/js/tools/vendor/metro/countLines.ts"],"names":[],"mappings":";AAAA,gCAAgC;;AAEhC,uHAAuH;AAEvH,cAAc;AAEd,qDAAqD;AAErD,+EAA+E;AAC/E,gFAAgF;AAChF,+EAA+E;AAC/E,4EAA4E;AAC5E,wEAAwE;AACxE,2DAA2D;AAE3D,iFAAiF;AACjF,kDAAkD;AAElD,6EAA6E;AAC7E,2EAA2E;AAC3E,8EAA8E;AAC9E,yEAAyE;AACzE,gFAAgF;AAChF,gFAAgF;AAChF,YAAY;AAEZ,4FAA4F;AAC5F,oGAAoG;AACpG,8CAA8C;AAE9C,MAAM,OAAO,GAAG,yBAAyB,CAAC;AAE1C,kBAAe,CAAC,MAAc,EAAU,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC","sourcesContent":["// Vendored from @facebook/metro\n\n// https://github.com/facebook/metro/blob/93d68cca249202fd3eb52672217e725d90e44eb4/packages/metro/src/lib/countLines.js\n\n// MIT License\n\n// Copyright (c) Meta Platforms, Inc. and affiliates.\n\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\n// This is exported as private from `metro` and as such breaking changes can appear anytime.\n// In the past these were related to the way the function is exported. Never to the function itself.\n// Thus it should be more stable to vendor it.\n\nconst newline = /\\r\\n?|\\n|\\u2028|\\u2029/g;\n\nexport default (string: string): number => (string.match(newline) || []).length + 1;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/js/tools/vendor/metro/utils.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAe,MAAM,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAIhE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/js/tools/vendor/metro/utils.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAe,MAAM,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAIhE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AA+CnD;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,UACpB,aAAa;2BAIK,MAAM,KAAK,MAAM;MAEzC,SAAS,MAAM,EAMjB,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,4BAA4B,QAAO,eAqC/C,CAAC"}
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Vendored / modified from @facebook/metro
|
|
3
|
+
var _a, _b;
|
|
3
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
5
|
exports.createDefaultMetroSerializer = exports.getSortedModules = void 0;
|
|
5
|
-
let
|
|
6
|
+
let baseJSBundleModule;
|
|
6
7
|
try {
|
|
7
|
-
|
|
8
|
+
baseJSBundleModule = require('metro/private/DeltaBundler/Serializers/baseJSBundle');
|
|
8
9
|
}
|
|
9
|
-
catch (
|
|
10
|
-
|
|
10
|
+
catch (_c) {
|
|
11
|
+
baseJSBundleModule = require('metro/src/DeltaBundler/Serializers/baseJSBundle');
|
|
11
12
|
}
|
|
13
|
+
const baseJSBundle = typeof baseJSBundleModule === 'function'
|
|
14
|
+
? baseJSBundleModule
|
|
15
|
+
: // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
16
|
+
(_a = baseJSBundleModule === null || baseJSBundleModule === void 0 ? void 0 : baseJSBundleModule.baseJSBundle) !== null && _a !== void 0 ? _a : baseJSBundleModule === null || baseJSBundleModule === void 0 ? void 0 : baseJSBundleModule.default;
|
|
12
17
|
let sourceMapString;
|
|
13
18
|
try {
|
|
14
19
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
@@ -23,13 +28,17 @@ catch (e) {
|
|
|
23
28
|
sourceMapString = sourceMapString.sourceMapString;
|
|
24
29
|
}
|
|
25
30
|
}
|
|
26
|
-
let
|
|
31
|
+
let bundleToStringModule;
|
|
27
32
|
try {
|
|
28
|
-
|
|
33
|
+
bundleToStringModule = require('metro/private/lib/bundleToString');
|
|
29
34
|
}
|
|
30
|
-
catch (
|
|
31
|
-
|
|
35
|
+
catch (_d) {
|
|
36
|
+
bundleToStringModule = require('metro/src/lib/bundleToString');
|
|
32
37
|
}
|
|
38
|
+
const bundleToString = typeof bundleToStringModule === 'function'
|
|
39
|
+
? bundleToStringModule
|
|
40
|
+
: // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
41
|
+
(_b = bundleToStringModule === null || bundleToStringModule === void 0 ? void 0 : bundleToStringModule.bundleToString) !== null && _b !== void 0 ? _b : bundleToStringModule === null || bundleToStringModule === void 0 ? void 0 : bundleToStringModule.default;
|
|
33
42
|
/**
|
|
34
43
|
* This function ensures that modules in source maps are sorted in the same
|
|
35
44
|
* order as in a plain JS bundle.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/js/tools/vendor/metro/utils.ts"],"names":[],"mappings":";AAAA,2CAA2C
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/js/tools/vendor/metro/utils.ts"],"names":[],"mappings":";AAAA,2CAA2C;;;;AAiC3C,IAAI,kBAAuB,CAAC;AAC5B,IAAI;IACF,kBAAkB,GAAG,OAAO,CAAC,qDAAqD,CAAC,CAAC;CACrF;AAAC,WAAM;IACN,kBAAkB,GAAG,OAAO,CAAC,iDAAiD,CAAC,CAAC;CACjF;AAED,MAAM,YAAY,GAChB,OAAO,kBAAkB,KAAK,UAAU;IACtC,CAAC,CAAC,kBAAkB;IACpB,CAAC,CAAC,sEAAsE;QACtE,MAAA,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAE,YAAY,mCAAI,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAE,OAAO,CAAC;AAEtE,IAAI,eAA2C,CAAC;AAChD,IAAI;IACF,8DAA8D;IAC9D,MAAM,qBAAqB,GAAG,OAAO,CAAC,wDAAwD,CAAC,CAAC;IAChG,eAAe,GAAI,qBAAyE,CAAC,eAAe,CAAC;CAC9G;AAAC,OAAO,CAAC,EAAE;IACV,eAAe,GAAG,OAAO,CAAC,oDAAoD,CAAC,CAAC;IAChF,IAAI,iBAAiB,IAAI,eAAe,EAAE;QACxC,+G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oB,CAAC,MAAM,CAAC,CAAC;SAC/C;QACD,MAAM,EAAE,IAAI,EAAE,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;QACxC,IAAI,KAAK,CAAC,gBAAgB,CAAC,GAAG,EAAE;YAC9B,sEAAsE;YACtE,OAAO,IAAI,CAAC;SACb;QAED,IAAI,uBAA2D,CAAC;QAChE,IAAI,OAAO,eAAe,KAAK,UAAU,EAAE;YACzC,uBAAuB,GAAG,eAAe,CAAC;SAC3C;aAAM,IACL,OAAO,eAAe,KAAK,QAAQ;YACnC,eAAe,IAAI,IAAI;YACvB,iBAAiB,IAAI,eAAe;YACpC,OAAO,eAAe,CAAC,iBAAiB,CAAC,KAAK,UAAU,EACxD;YACA,uBAAuB,GAAI,eAA4C,CAAC,eAAe,CAAC;SACzF;aAAM;YACL,MAAM,IAAI,KAAK,CAAC;;;CAGrB,CAAC,CAAC;SACE;QAED,oEAAoE;QACpE,MAAM,GAAG,GAAG,uBAAuB,CAAC,CAAC,GAAG,UAAU,EAAE,GAAG,IAAA,wBAAgB,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC,EAAE;YACxF,mBAAmB,EAAE,OAAO,CAAC,mBAAmB;YAChD,qBAAqB,EAAE,OAAO,CAAC,qBAAqB;SACrD,CAAC,CAAC;QACH,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;IACvB,CAAC,CAAC;AACJ,CAAC,CAAC;AArCW,QAAA,4BAA4B,gCAqCvC","sourcesContent":["// Vendored / modified from @facebook/metro\n\n// https://github.com/facebook/metro/commit/9b85f83c9cc837d8cd897aa7723be7da5b296067\n\n// MIT License\n\n// Copyright (c) Meta Platforms, Inc. and affiliates.\n\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport type { MixedOutput, Module, ReadOnlyGraph } from 'metro';\nimport type * as baseJSBundleType from 'metro/private/DeltaBundler/Serializers/baseJSBundle';\nimport type * as sourceMapStringType from 'metro/private/DeltaBundler/Serializers/sourceMapString';\nimport type * as bundleToStringType from 'metro/private/lib/bundleToString';\nimport type { MetroSerializer } from '../../utils';\n\nlet baseJSBundleModule: any;\ntry {\n baseJSBundleModule = require('metro/private/DeltaBundler/Serializers/baseJSBundle');\n} catch {\n baseJSBundleModule = require('metro/src/DeltaBundler/Serializers/baseJSBundle');\n}\n\nconst baseJSBundle: typeof baseJSBundleType =\n typeof baseJSBundleModule === 'function'\n ? baseJSBundleModule\n : // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n baseJSBundleModule?.baseJSBundle ?? baseJSBundleModule?.default;\n\nlet sourceMapString: typeof sourceMapStringType;\ntry {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const sourceMapStringModule = require('metro/private/DeltaBundler/Serializers/sourceMapString');\n sourceMapString = (sourceMapStringModule as { sourceMapString: typeof sourceMapStringType }).sourceMapString;\n} catch (e) {\n sourceMapString = require('metro/src/DeltaBundler/Serializers/sourceMapString');\n if ('sourceMapString' in sourceMapString) {\n // Changed to named export in https://github.com/facebook/metro/commit/34148e61200a508923315fbe387b26d1da27bf4b\n // Metro 0.81.0 and 0.80.10 patch\n sourceMapString = (sourceMapString as { sourceMapString: typeof sourceMapStringType }).sourceMapString;\n }\n}\n\nlet bundleToStringModule: any;\ntry {\n bundleToStringModule = require('metro/private/lib/bundleToString');\n} catch {\n bundleToStringModule = require('metro/src/lib/bundleToString');\n}\n\nconst bundleToString: typeof bundleToStringType =\n typeof bundleToStringModule === 'function'\n ? bundleToStringModule\n : // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n bundleToStringModule?.bundleToString ?? bundleToStringModule?.default;\n\ntype NewSourceMapStringExport = {\n // Since Metro v0.80.10 https://github.com/facebook/metro/compare/v0.80.9...v0.80.10#diff-1b836d1729e527a725305eef0cec22e44605af2700fa413f4c2489ea1a03aebcL28\n sourceMapString: typeof sourceMapString;\n};\n\n/**\n * This function ensures that modules in source maps are sorted in the same\n * order as in a plain JS bundle.\n *\n * https://github.com/facebook/metro/blob/9b85f83c9cc837d8cd897aa7723be7da5b296067/packages/metro/src/Server.js#L984\n */\nexport const getSortedModules = (\n graph: ReadOnlyGraph,\n {\n createModuleId,\n }: {\n createModuleId: (file: string) => number;\n },\n): readonly Module[] => {\n const modules = [...graph.dependencies.values()];\n // Sort by IDs\n return modules.sort(\n (a: Module<MixedOutput>, b: Module<MixedOutput>) => createModuleId(a.path) - createModuleId(b.path),\n );\n};\n\n/**\n * Creates the default Metro plain bundle serializer.\n * Because Metro exports only the intermediate serializer functions, we need to\n * assemble the final serializer ourselves. We have to work with the modules the same as Metro does\n * to avoid unexpected changes in the final bundle.\n *\n * This is used when the user does not provide a custom serializer.\n *\n * https://github.com/facebook/metro/blob/9b85f83c9cc837d8cd897aa7723be7da5b296067/packages/metro/src/Server.js#L244-L277\n */\nexport const createDefaultMetroSerializer = (): MetroSerializer => {\n return (entryPoint, preModules, graph, options) => {\n // baseJSBundle assigns IDs to modules in a consistent order\n let bundle = baseJSBundle(entryPoint, preModules, graph, options);\n if (options.sentryBundleCallback && !graph.transformOptions.hot) {\n bundle = options.sentryBundleCallback(bundle);\n }\n const { code } = bundleToString(bundle);\n if (graph.transformOptions.hot) {\n // Hot means running in dev server, sourcemaps are generated on demand\n return code;\n }\n\n let sourceMapStringFunction: typeof sourceMapString | undefined;\n if (typeof sourceMapString === 'function') {\n sourceMapStringFunction = sourceMapString;\n } else if (\n typeof sourceMapString === 'object' &&\n sourceMapString != null &&\n 'sourceMapString' in sourceMapString &&\n typeof sourceMapString['sourceMapString'] === 'function'\n ) {\n sourceMapStringFunction = (sourceMapString as NewSourceMapStringExport).sourceMapString;\n } else {\n throw new Error(`\n[@sentry/react-native/metro] Cannot find sourceMapString function in 'metro/src/DeltaBundler/Serializers/sourceMapString'.\nPlease check the version of Metro you are using and report the issue at http://www.github.com/getsentry/sentry-react-native/issues\n`);\n }\n\n // Always generate source maps, can't use Sentry without source maps\n const map = sourceMapStringFunction([...preModules, ...getSortedModules(graph, options)], {\n processModuleFilter: options.processModuleFilter,\n shouldAddToIgnoreList: options.shouldAddToIgnoreList,\n });\n return { code, map };\n };\n};\n"]}
|
package/dist/js/version.d.ts
CHANGED
package/dist/js/version.js
CHANGED
package/dist/js/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAC3D,MAAM,CAAC,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC","sourcesContent":["export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';\nexport const SDK_NAME = 'sentry.javascript.react-native';\nexport const SDK_VERSION = '7.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAC3D,MAAM,CAAC,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC","sourcesContent":["export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';\nexport const SDK_NAME = 'sentry.javascript.react-native';\nexport const SDK_VERSION = '7.2.0';\n"]}
|
|
@@ -16,8 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
// This method was moved to a new category so we can use `@import Sentry` to use Sentry's Swift
|
|
18
18
|
// classes
|
|
19
|
-
@implementation
|
|
20
|
-
RNSentry (fetchNativeStack)
|
|
19
|
+
@implementation RNSentry (fetchNativeStack)
|
|
21
20
|
|
|
22
21
|
- (NSDictionary *)fetchNativeStackFramesBy:(NSArray<NSNumber *> *)instructionsAddr
|
|
23
22
|
symbolicate:(SymbolicateCallbackType)symbolicate
|
package/ios/RNSentry.h
CHANGED
|
@@ -28,8 +28,7 @@ typedef int (*SymbolicateCallbackType)(const void *, Dl_info *);
|
|
|
28
28
|
|
|
29
29
|
@end
|
|
30
30
|
|
|
31
|
-
@interface
|
|
32
|
-
RNSentry (fetchNativeStack)
|
|
31
|
+
@interface RNSentry (fetchNativeStack)
|
|
33
32
|
|
|
34
33
|
- (NSDictionary *_Nonnull)fetchNativeStackFramesBy:(NSArray<NSNumber *> *)instructionsAddr
|
|
35
34
|
symbolicate:(SymbolicateCallbackType)symbolicate;
|
package/ios/RNSentry.mm
CHANGED
|
@@ -87,10 +87,8 @@ static bool hasFetchedAppStart;
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
RCT_EXPORT_MODULE()
|
|
90
|
-
RCT_EXPORT_METHOD(initNativeSdk
|
|
91
|
-
|
|
92
|
-
: (RCTPromiseResolveBlock)resolve rejecter
|
|
93
|
-
: (RCTPromiseRejectBlock)reject)
|
|
90
|
+
RCT_EXPORT_METHOD(initNativeSdk : (NSDictionary *_Nonnull)options resolve : (
|
|
91
|
+
RCTPromiseResolveBlock)resolve rejecter : (RCTPromiseRejectBlock)reject)
|
|
94
92
|
{
|
|
95
93
|
NSError *error = nil;
|
|
96
94
|
SentryOptions *sentryOptions = [self createOptionsWithDictionary:options error:&error];
|
|
@@ -200,8 +198,7 @@ RCT_EXPORT_METHOD(initNativeSdk
|
|
|
200
198
|
- (SentryOptions *_Nullable)createOptionsWithDictionary:(NSDictionary *_Nonnull)options
|
|
201
199
|
error:(NSError *_Nonnull *_Nonnull)errorPointer
|
|
202
200
|
{
|
|
203
|
-
SentryBeforeSendEventCallback beforeSend = ^SentryEvent *(SentryEvent *event)
|
|
204
|
-
{
|
|
201
|
+
SentryBeforeSendEventCallback beforeSend = ^SentryEvent *(SentryEvent *event) {
|
|
205
202
|
// We don't want to send an event after startup that came from a Unhandled JS Exception of
|
|
206
203
|
// React Native because we sent it already before the app crashed.
|
|
207
204
|
if (nil != event.exceptions.firstObject.type &&
|
|
@@ -288,6 +285,13 @@ RCT_EXPORT_METHOD(initNativeSdk
|
|
|
288
285
|
}
|
|
289
286
|
}
|
|
290
287
|
|
|
288
|
+
if ([mutableOptions valueForKey:@"enableLogs"] != nil) {
|
|
289
|
+
id enableLogsValue = [mutableOptions valueForKey:@"enableLogs"];
|
|
290
|
+
if ([enableLogsValue isKindOfClass:[NSNumber class]]) {
|
|
291
|
+
[RNSentryExperimentalOptions setEnableLogs:[enableLogsValue boolValue]
|
|
292
|
+
sentryOptions:sentryOptions];
|
|
293
|
+
}
|
|
294
|
+
}
|
|
291
295
|
[self trySetIgnoreErrors:mutableOptions];
|
|
292
296
|
|
|
293
297
|
// Enable the App start and Frames tracking measurements
|
|
@@ -355,9 +359,8 @@ RCT_EXPORT_METHOD(initNativeSdk
|
|
|
355
359
|
event.tags = newTags;
|
|
356
360
|
}
|
|
357
361
|
|
|
358
|
-
RCT_EXPORT_METHOD(initNativeReactNavigationNewFrameTracking
|
|
359
|
-
|
|
360
|
-
: (RCTPromiseRejectBlock)reject)
|
|
362
|
+
RCT_EXPORT_METHOD(initNativeReactNavigationNewFrameTracking : (
|
|
363
|
+
RCTPromiseResolveBlock)resolve rejecter : (RCTPromiseRejectBlock)reject)
|
|
361
364
|
{
|
|
362
365
|
#if SENTRY_HAS_UIKIT
|
|
363
366
|
if ([[NSThread currentThread] isMainThread]) {
|
|
@@ -399,9 +402,8 @@ RCT_EXPORT_METHOD(initNativeReactNavigationNewFrameTracking
|
|
|
399
402
|
return @[ RNSentryNewFrameEvent ];
|
|
400
403
|
}
|
|
401
404
|
|
|
402
|
-
RCT_EXPORT_METHOD(
|
|
403
|
-
|
|
404
|
-
: (RCTPromiseRejectBlock)reject)
|
|
405
|
+
RCT_EXPORT_METHOD(
|
|
406
|
+
fetchNativeSdkInfo : (RCTPromiseResolveBlock)resolve rejecter : (RCTPromiseRejectBlock)reject)
|
|
405
407
|
{
|
|
406
408
|
resolve(@ {
|
|
407
409
|
@"name" : PrivateSentrySDKOnly.getSdkName,
|
|
@@ -409,9 +411,8 @@ RCT_EXPORT_METHOD(fetchNativeSdkInfo
|
|
|
409
411
|
});
|
|
410
412
|
}
|
|
411
413
|
|
|
412
|
-
RCT_EXPORT_METHOD(
|
|
413
|
-
|
|
414
|
-
: (RCTPromiseRejectBlock)reject)
|
|
414
|
+
RCT_EXPORT_METHOD(
|
|
415
|
+
fetchModules : (RCTPromiseResolveBlock)resolve rejecter : (RCTPromiseRejectBlock)reject)
|
|
415
416
|
{
|
|
416
417
|
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"modules" ofType:@"json"];
|
|
417
418
|
NSString *modulesString = [NSString stringWithContentsOfFile:filePath
|
|
@@ -426,15 +427,14 @@ RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSString *, fetchNativePackageName)
|
|
|
426
427
|
return packageName;
|
|
427
428
|
}
|
|
428
429
|
|
|
429
|
-
RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(
|
|
430
|
-
|
|
430
|
+
RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(
|
|
431
|
+
NSDictionary *, fetchNativeStackFramesBy : (NSArray *)instructionsAddr)
|
|
431
432
|
{
|
|
432
433
|
return [self fetchNativeStackFramesBy:instructionsAddr symbolicate:dladdr];
|
|
433
434
|
}
|
|
434
435
|
|
|
435
|
-
RCT_EXPORT_METHOD(fetchNativeLogAttributes
|
|
436
|
-
|
|
437
|
-
: (RCTPromiseRejectBlock)reject)
|
|
436
|
+
RCT_EXPORT_METHOD(fetchNativeLogAttributes : (RCTPromiseResolveBlock)resolve rejecter : (
|
|
437
|
+
RCTPromiseRejectBlock)reject)
|
|
438
438
|
{
|
|
439
439
|
__block NSMutableDictionary<NSString *, id> *result = [NSMutableDictionary new];
|
|
440
440
|
|
|
@@ -484,9 +484,8 @@ RCT_EXPORT_METHOD(fetchNativeLogAttributes
|
|
|
484
484
|
resolve(result);
|
|
485
485
|
}
|
|
486
486
|
|
|
487
|
-
RCT_EXPORT_METHOD(fetchNativeDeviceContexts
|
|
488
|
-
|
|
489
|
-
: (RCTPromiseRejectBlock)reject)
|
|
487
|
+
RCT_EXPORT_METHOD(fetchNativeDeviceContexts : (RCTPromiseResolveBlock)resolve rejecter : (
|
|
488
|
+
RCTPromiseRejectBlock)reject)
|
|
490
489
|
{
|
|
491
490
|
if (PrivateSentrySDKOnly.options.debug) {
|
|
492
491
|
NSLog(@"Bridge call to: deviceContexts");
|
|
@@ -546,9 +545,8 @@ RCT_EXPORT_METHOD(fetchNativeDeviceContexts
|
|
|
546
545
|
resolve(serializedScope);
|
|
547
546
|
}
|
|
548
547
|
|
|
549
|
-
RCT_EXPORT_METHOD(
|
|
550
|
-
|
|
551
|
-
: (RCTPromiseRejectBlock)reject)
|
|
548
|
+
RCT_EXPORT_METHOD(
|
|
549
|
+
fetchNativeAppStart : (RCTPromiseResolveBlock)resolve rejecter : (RCTPromiseRejectBlock)reject)
|
|
552
550
|
{
|
|
553
551
|
#if SENTRY_HAS_UIKIT
|
|
554
552
|
NSDictionary<NSString *, id> *measurements =
|
|
@@ -573,9 +571,8 @@ RCT_EXPORT_METHOD(fetchNativeAppStart
|
|
|
573
571
|
#endif
|
|
574
572
|
}
|
|
575
573
|
|
|
576
|
-
RCT_EXPORT_METHOD(
|
|
577
|
-
|
|
578
|
-
: (RCTPromiseRejectBlock)reject)
|
|
574
|
+
RCT_EXPORT_METHOD(
|
|
575
|
+
fetchNativeFrames : (RCTPromiseResolveBlock)resolve rejecter : (RCTPromiseRejectBlock)reject)
|
|
579
576
|
{
|
|
580
577
|
|
|
581
578
|
#if TARGET_OS_IPHONE || TARGET_OS_MACCATALYST
|
|
@@ -604,9 +601,8 @@ RCT_EXPORT_METHOD(fetchNativeFrames
|
|
|
604
601
|
#endif
|
|
605
602
|
}
|
|
606
603
|
|
|
607
|
-
RCT_EXPORT_METHOD(
|
|
608
|
-
|
|
609
|
-
: (RCTPromiseRejectBlock)reject)
|
|
604
|
+
RCT_EXPORT_METHOD(
|
|
605
|
+
fetchNativeRelease : (RCTPromiseResolveBlock)resolve rejecter : (RCTPromiseRejectBlock)reject)
|
|
610
606
|
{
|
|
611
607
|
NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary];
|
|
612
608
|
resolve(@ {
|
|
@@ -616,11 +612,8 @@ RCT_EXPORT_METHOD(fetchNativeRelease
|
|
|
616
612
|
});
|
|
617
613
|
}
|
|
618
614
|
|
|
619
|
-
RCT_EXPORT_METHOD(captureEnvelope
|
|
620
|
-
|
|
621
|
-
: (NSDictionary *_Nonnull)options resolve
|
|
622
|
-
: (RCTPromiseResolveBlock)resolve rejecter
|
|
623
|
-
: (RCTPromiseRejectBlock)reject)
|
|
615
|
+
RCT_EXPORT_METHOD(captureEnvelope : (NSString *_Nonnull)rawBytes options : (NSDictionary *_Nonnull)
|
|
616
|
+
options resolve : (RCTPromiseResolveBlock)resolve rejecter : (RCTPromiseRejectBlock)reject)
|
|
624
617
|
{
|
|
625
618
|
NSData *data = [[NSData alloc] initWithBase64EncodedString:rawBytes options:0];
|
|
626
619
|
|
|
@@ -643,9 +636,8 @@ RCT_EXPORT_METHOD(captureEnvelope
|
|
|
643
636
|
resolve(@YES);
|
|
644
637
|
}
|
|
645
638
|
|
|
646
|
-
RCT_EXPORT_METHOD(
|
|
647
|
-
|
|
648
|
-
: (RCTPromiseRejectBlock)reject)
|
|
639
|
+
RCT_EXPORT_METHOD(
|
|
640
|
+
captureScreenshot : (RCTPromiseResolveBlock)resolve rejecter : (RCTPromiseRejectBlock)reject)
|
|
649
641
|
{
|
|
650
642
|
#if TARGET_OS_IPHONE || TARGET_OS_MACCATALYST
|
|
651
643
|
NSArray<NSData *> *rawScreenshots = [PrivateSentrySDKOnly captureScreenshots];
|
|
@@ -677,9 +669,8 @@ RCT_EXPORT_METHOD(captureScreenshot
|
|
|
677
669
|
#endif
|
|
678
670
|
}
|
|
679
671
|
|
|
680
|
-
RCT_EXPORT_METHOD(
|
|
681
|
-
|
|
682
|
-
: (RCTPromiseRejectBlock)reject)
|
|
672
|
+
RCT_EXPORT_METHOD(
|
|
673
|
+
fetchViewHierarchy : (RCTPromiseResolveBlock)resolve rejecter : (RCTPromiseRejectBlock)reject)
|
|
683
674
|
{
|
|
684
675
|
#if TARGET_OS_IPHONE || TARGET_OS_MACCATALYST
|
|
685
676
|
NSData *rawViewHierarchy = [PrivateSentrySDKOnly captureViewHierarchy];
|
|
@@ -793,9 +784,8 @@ RCT_EXPORT_METHOD(setTag : (NSString *)key value : (NSString *)value)
|
|
|
793
784
|
|
|
794
785
|
RCT_EXPORT_METHOD(crash) { [SentrySDKWrapper crash]; }
|
|
795
786
|
|
|
796
|
-
RCT_EXPORT_METHOD(
|
|
797
|
-
|
|
798
|
-
: (RCTPromiseRejectBlock)reject)
|
|
787
|
+
RCT_EXPORT_METHOD(
|
|
788
|
+
closeNativeSdk : (RCTPromiseResolveBlock)resolve rejecter : (RCTPromiseRejectBlock)reject)
|
|
799
789
|
{
|
|
800
790
|
[SentrySDKWrapper close];
|
|
801
791
|
resolve(@YES);
|
|
@@ -814,10 +804,8 @@ RCT_EXPORT_METHOD(enableNativeFramesTracking)
|
|
|
814
804
|
// the 'tracesSampleRate' or 'tracesSampler' option.
|
|
815
805
|
}
|
|
816
806
|
|
|
817
|
-
RCT_EXPORT_METHOD(captureReplay
|
|
818
|
-
|
|
819
|
-
: (RCTPromiseResolveBlock)resolve rejecter
|
|
820
|
-
: (RCTPromiseRejectBlock)reject)
|
|
807
|
+
RCT_EXPORT_METHOD(captureReplay : (BOOL)isHardCrash resolver : (
|
|
808
|
+
RCTPromiseResolveBlock)resolve rejecter : (RCTPromiseRejectBlock)reject)
|
|
821
809
|
{
|
|
822
810
|
#if SENTRY_TARGET_REPLAY_SUPPORTED
|
|
823
811
|
[PrivateSentrySDKOnly captureReplay];
|
|
@@ -827,10 +815,8 @@ RCT_EXPORT_METHOD(captureReplay
|
|
|
827
815
|
#endif
|
|
828
816
|
}
|
|
829
817
|
|
|
830
|
-
RCT_EXPORT_METHOD(getDataFromUri
|
|
831
|
-
|
|
832
|
-
: (RCTPromiseResolveBlock)resolve rejecter
|
|
833
|
-
: (RCTPromiseRejectBlock)reject)
|
|
818
|
+
RCT_EXPORT_METHOD(getDataFromUri : (NSString *_Nonnull)uri resolve : (
|
|
819
|
+
RCTPromiseResolveBlock)resolve rejecter : (RCTPromiseRejectBlock)reject)
|
|
834
820
|
{
|
|
835
821
|
#if TARGET_OS_IPHONE || TARGET_OS_MACCATALYST
|
|
836
822
|
NSURL *fileURL = [NSURL URLWithString:uri];
|
|
@@ -1013,9 +999,8 @@ RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSDictionary *, stopProfiling)
|
|
|
1013
999
|
#endif
|
|
1014
1000
|
}
|
|
1015
1001
|
|
|
1016
|
-
RCT_EXPORT_METHOD(
|
|
1017
|
-
|
|
1018
|
-
: (RCTPromiseRejectBlock)reject)
|
|
1002
|
+
RCT_EXPORT_METHOD(
|
|
1003
|
+
crashedLastRun : (RCTPromiseResolveBlock)resolve rejecter : (RCTPromiseRejectBlock)reject)
|
|
1019
1004
|
{
|
|
1020
1005
|
resolve(@([SentrySDKWrapper crashedLastRun]));
|
|
1021
1006
|
}
|
|
@@ -1029,17 +1014,14 @@ RCT_EXPORT_METHOD(crashedLastRun
|
|
|
1029
1014
|
}
|
|
1030
1015
|
#endif
|
|
1031
1016
|
|
|
1032
|
-
RCT_EXPORT_METHOD(getNewScreenTimeToDisplay
|
|
1033
|
-
|
|
1034
|
-
: (RCTPromiseRejectBlock)reject)
|
|
1017
|
+
RCT_EXPORT_METHOD(getNewScreenTimeToDisplay : (RCTPromiseResolveBlock)resolve rejecter : (
|
|
1018
|
+
RCTPromiseRejectBlock)reject)
|
|
1035
1019
|
{
|
|
1036
1020
|
[_timeToDisplay getTimeToDisplay:resolve];
|
|
1037
1021
|
}
|
|
1038
1022
|
|
|
1039
|
-
RCT_EXPORT_METHOD(popTimeToDisplayFor
|
|
1040
|
-
|
|
1041
|
-
: (RCTPromiseResolveBlock)resolve rejecter
|
|
1042
|
-
: (RCTPromiseRejectBlock)reject)
|
|
1023
|
+
RCT_EXPORT_METHOD(popTimeToDisplayFor : (NSString *)key resolver : (
|
|
1024
|
+
RCTPromiseResolveBlock)resolve rejecter : (RCTPromiseRejectBlock)reject)
|
|
1043
1025
|
{
|
|
1044
1026
|
resolve([RNSentryTimeToDisplay popTimeToDisplayFor:key]);
|
|
1045
1027
|
}
|
|
@@ -1050,10 +1032,8 @@ RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSNumber *, setActiveSpanId : (NSString *)sp
|
|
|
1050
1032
|
return @YES; // The return ensures that the method is synchronous
|
|
1051
1033
|
}
|
|
1052
1034
|
|
|
1053
|
-
RCT_EXPORT_METHOD(encodeToBase64
|
|
1054
|
-
|
|
1055
|
-
: (RCTPromiseResolveBlock)resolve rejecter
|
|
1056
|
-
: (RCTPromiseRejectBlock)reject)
|
|
1035
|
+
RCT_EXPORT_METHOD(encodeToBase64 : (NSArray *)array resolver : (
|
|
1036
|
+
RCTPromiseResolveBlock)resolve rejecter : (RCTPromiseRejectBlock)reject)
|
|
1057
1037
|
{
|
|
1058
1038
|
NSUInteger count = array.count;
|
|
1059
1039
|
uint8_t *bytes = (uint8_t *)malloc(count);
|
|
@@ -21,6 +21,13 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
21
21
|
*/
|
|
22
22
|
+ (BOOL)getEnableUnhandledCPPExceptionsV2:(SentryOptions *)sentryOptions;
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Sets the enableLogs experimental option on SentryOptions
|
|
26
|
+
* @param sentryOptions The SentryOptions instance to configure
|
|
27
|
+
* @param enabled Whether logs from sentry Cocoa should be enabled
|
|
28
|
+
*/
|
|
29
|
+
+ (void)setEnableLogs:(BOOL)enabled sentryOptions:(SentryOptions *)sentryOptions;
|
|
30
|
+
|
|
24
31
|
@end
|
|
25
32
|
|
|
26
33
|
NS_ASSUME_NONNULL_END
|
|
@@ -19,4 +19,12 @@
|
|
|
19
19
|
return sentryOptions.experimental.enableUnhandledCPPExceptionsV2;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
+ (void)setEnableLogs:(BOOL)enabled sentryOptions:(SentryOptions *)sentryOptions
|
|
23
|
+
{
|
|
24
|
+
if (sentryOptions == nil) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
sentryOptions.experimental.enableLogs = enabled;
|
|
28
|
+
}
|
|
29
|
+
|
|
22
30
|
@end
|
package/ios/RNSentryVersion.m
CHANGED
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
NSString *const NATIVE_SDK_NAME = @"sentry.cocoa.react-native";
|
|
4
4
|
NSString *const REACT_NATIVE_SDK_NAME = @"sentry.javascript.react-native";
|
|
5
5
|
NSString *const REACT_NATIVE_SDK_PACKAGE_NAME = @"npm:@sentry/react-native";
|
|
6
|
-
NSString *const REACT_NATIVE_SDK_PACKAGE_VERSION = @"7.
|
|
6
|
+
NSString *const REACT_NATIVE_SDK_PACKAGE_VERSION = @"7.2.0";
|
|
@@ -23,8 +23,7 @@ RCT_EXPORT_MODULE(RNSentryReplayUnmask)
|
|
|
23
23
|
@end
|
|
24
24
|
|
|
25
25
|
# ifdef RCT_NEW_ARCH_ENABLED
|
|
26
|
-
@interface
|
|
27
|
-
RNSentryReplayUnmask () <RCTRNSentryReplayUnmaskViewProtocol>
|
|
26
|
+
@interface RNSentryReplayUnmask () <RCTRNSentryReplayUnmaskViewProtocol>
|
|
28
27
|
@end
|
|
29
28
|
# endif
|
|
30
29
|
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@sentry/react-native",
|
|
3
3
|
"homepage": "https://github.com/getsentry/sentry-react-native",
|
|
4
4
|
"repository": "https://github.com/getsentry/sentry-react-native",
|
|
5
|
-
"version": "7.
|
|
5
|
+
"version": "7.2.0",
|
|
6
6
|
"description": "Official Sentry SDK for react-native",
|
|
7
7
|
"typings": "dist/js/index.d.ts",
|
|
8
8
|
"types": "dist/js/index.d.ts",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"@sentry/babel-plugin-component-annotate": "4.3.0",
|
|
72
72
|
"@sentry/browser": "10.12.0",
|
|
73
|
-
"@sentry/cli": "2.
|
|
73
|
+
"@sentry/cli": "2.55.0",
|
|
74
74
|
"@sentry/core": "10.12.0",
|
|
75
75
|
"@sentry/react": "10.12.0",
|
|
76
76
|
"@sentry/types": "10.12.0"
|
|
@@ -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.
|