@sentry/react-native 8.1.0 → 8.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/RNSentry.podspec +1 -1
- package/android/AGENTS.md +51 -0
- package/android/build.gradle +2 -2
- package/android/libs/replay-stubs.jar +0 -0
- package/android/replay-stubs/build.gradle +1 -1
- package/android/src/main/java/io/sentry/react/RNSentryLogger.java +96 -0
- package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +14 -4
- package/android/src/main/java/io/sentry/react/RNSentryStart.java +11 -9
- package/android/src/main/java/io/sentry/react/RNSentryVersion.java +1 -1
- package/dist/js/NativeLogListener.d.ts +16 -0
- package/dist/js/NativeLogListener.d.ts.map +1 -0
- package/dist/js/NativeLogListener.js +72 -0
- package/dist/js/NativeLogListener.js.map +1 -0
- package/dist/js/client.d.ts +1 -0
- package/dist/js/client.d.ts.map +1 -1
- package/dist/js/client.js +14 -3
- package/dist/js/client.js.map +1 -1
- package/dist/js/index.d.ts +2 -2
- package/dist/js/index.d.ts.map +1 -1
- package/dist/js/index.js +1 -1
- package/dist/js/index.js.map +1 -1
- package/dist/js/integrations/default.d.ts.map +1 -1
- package/dist/js/integrations/default.js +2 -1
- package/dist/js/integrations/default.js.map +1 -1
- package/dist/js/integrations/expoconstants.d.ts +24 -0
- package/dist/js/integrations/expoconstants.d.ts.map +1 -0
- package/dist/js/integrations/expoconstants.js +77 -0
- package/dist/js/integrations/expoconstants.js.map +1 -0
- package/dist/js/integrations/exports.d.ts +1 -0
- package/dist/js/integrations/exports.d.ts.map +1 -1
- package/dist/js/integrations/exports.js +1 -0
- package/dist/js/integrations/exports.js.map +1 -1
- package/dist/js/options.d.ts +26 -0
- package/dist/js/options.d.ts.map +1 -1
- package/dist/js/options.js.map +1 -1
- package/dist/js/tools/easBuildHooks.d.ts +48 -0
- package/dist/js/tools/easBuildHooks.d.ts.map +1 -0
- package/dist/js/tools/easBuildHooks.js +228 -0
- package/dist/js/tools/easBuildHooks.js.map +1 -0
- package/dist/js/tracing/integrations/appStart.d.ts.map +1 -1
- package/dist/js/tracing/integrations/appStart.js +4 -1
- package/dist/js/tracing/integrations/appStart.js.map +1 -1
- package/dist/js/tracing/onSpanEndUtils.d.ts +7 -0
- package/dist/js/tracing/onSpanEndUtils.d.ts.map +1 -1
- package/dist/js/tracing/onSpanEndUtils.js +45 -6
- package/dist/js/tracing/onSpanEndUtils.js.map +1 -1
- package/dist/js/tracing/reactnavigation.d.ts +15 -0
- package/dist/js/tracing/reactnavigation.d.ts.map +1 -1
- package/dist/js/tracing/reactnavigation.js +41 -13
- package/dist/js/tracing/reactnavigation.js.map +1 -1
- package/dist/js/tracing/span.d.ts +6 -6
- package/dist/js/tracing/span.d.ts.map +1 -1
- package/dist/js/tracing/span.js +3 -3
- package/dist/js/tracing/span.js.map +1 -1
- package/dist/js/utils/expoglobalobject.d.ts +47 -7
- package/dist/js/utils/expoglobalobject.d.ts.map +1 -1
- package/dist/js/utils/expoglobalobject.js.map +1 -1
- package/dist/js/version.d.ts +1 -1
- package/dist/js/version.js +6 -3
- package/dist/js/version.js.map +1 -1
- package/dist/js/wrapper.d.ts.map +1 -1
- package/dist/js/wrapper.js +1 -1
- package/dist/js/wrapper.js.map +1 -1
- package/ios/AGENTS.md +60 -0
- package/ios/RNSentry.mm +4 -1
- package/ios/RNSentryEvents.h +1 -0
- package/ios/RNSentryEvents.m +1 -0
- package/ios/RNSentryNativeLogsForwarder.h +20 -0
- package/ios/RNSentryNativeLogsForwarder.m +145 -0
- package/ios/RNSentryVersion.m +1 -1
- package/package.json +14 -11
- package/plugin/build/withSentryAndroidGradlePlugin.d.ts +1 -1
- package/plugin/build/withSentryAndroidGradlePlugin.js +1 -1
- package/scripts/eas-build-hook.js +234 -0
- package/scripts/sentry-xcode.sh +9 -2
- package/sentry.gradle +13 -5
- package/ts3.8/dist/js/NativeLogListener.d.ts +16 -0
- package/ts3.8/dist/js/client.d.ts +1 -0
- package/ts3.8/dist/js/index.d.ts +2 -2
- package/ts3.8/dist/js/integrations/expoconstants.d.ts +24 -0
- package/ts3.8/dist/js/integrations/exports.d.ts +1 -0
- package/ts3.8/dist/js/options.d.ts +26 -0
- package/ts3.8/dist/js/tracing/onSpanEndUtils.d.ts +7 -0
- package/ts3.8/dist/js/tracing/reactnavigation.d.ts +15 -0
- package/ts3.8/dist/js/tracing/span.d.ts +6 -6
- package/ts3.8/dist/js/utils/expoglobalobject.d.ts +47 -7
- package/ts3.8/dist/js/version.d.ts +1 -1
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* EAS Build Hook
|
|
4
|
+
*
|
|
5
|
+
* Unified entry point for all EAS build hooks (on-complete, on-error, on-success).
|
|
6
|
+
* The hook name is determined from the bin command name in process.argv[1]
|
|
7
|
+
* (e.g. sentry-eas-build-on-error → on-error) or can be passed as a CLI argument.
|
|
8
|
+
*
|
|
9
|
+
* Required environment variables:
|
|
10
|
+
* - SENTRY_DSN: Your Sentry DSN
|
|
11
|
+
*
|
|
12
|
+
* Optional environment variables:
|
|
13
|
+
* - SENTRY_EAS_BUILD_CAPTURE_SUCCESS: Set to 'true' to also capture successful builds
|
|
14
|
+
* - SENTRY_EAS_BUILD_TAGS: JSON string of additional tags
|
|
15
|
+
* - SENTRY_EAS_BUILD_ERROR_MESSAGE: Custom error message for failed builds
|
|
16
|
+
* - SENTRY_EAS_BUILD_SUCCESS_MESSAGE: Custom success message for successful builds
|
|
17
|
+
*
|
|
18
|
+
* @see https://docs.expo.dev/build-reference/npm-hooks/
|
|
19
|
+
* @see https://docs.sentry.io/platforms/react-native/
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/* eslint-disable no-console */
|
|
23
|
+
|
|
24
|
+
const path = require('path');
|
|
25
|
+
const fs = require('fs');
|
|
26
|
+
|
|
27
|
+
// ─── Environment loading ─────────────────────────────────────────────────────
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Merges parsed env vars into process.env without overwriting existing values.
|
|
31
|
+
* This preserves EAS secrets and other pre-set environment variables.
|
|
32
|
+
* @param {object} parsed - Parsed environment variables from dotenv
|
|
33
|
+
*/
|
|
34
|
+
function mergeEnvWithoutOverwrite(parsed) {
|
|
35
|
+
for (const key of Object.keys(parsed)) {
|
|
36
|
+
if (process.env[key] === undefined) {
|
|
37
|
+
process.env[key] = parsed[key];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Loads environment variables from various sources:
|
|
44
|
+
* - @expo/env (if available)
|
|
45
|
+
* - .env file (via dotenv, if available)
|
|
46
|
+
* - .env.sentry-build-plugin file
|
|
47
|
+
*
|
|
48
|
+
* NOTE: Existing environment variables (like EAS secrets) are NOT overwritten.
|
|
49
|
+
*/
|
|
50
|
+
function loadEnv() {
|
|
51
|
+
// Try @expo/env first
|
|
52
|
+
try {
|
|
53
|
+
require('@expo/env').load('.');
|
|
54
|
+
} catch (_e) {
|
|
55
|
+
// Fallback to dotenv if available
|
|
56
|
+
try {
|
|
57
|
+
const dotenvPath = path.join(process.cwd(), '.env');
|
|
58
|
+
if (fs.existsSync(dotenvPath)) {
|
|
59
|
+
const dotenvFile = fs.readFileSync(dotenvPath, 'utf-8');
|
|
60
|
+
const dotenv = require('dotenv');
|
|
61
|
+
mergeEnvWithoutOverwrite(dotenv.parse(dotenvFile));
|
|
62
|
+
}
|
|
63
|
+
} catch (_e2) {
|
|
64
|
+
// No dotenv available, continue with existing env vars
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Also load .env.sentry-build-plugin if it exists
|
|
69
|
+
try {
|
|
70
|
+
const sentryEnvPath = path.join(process.cwd(), '.env.sentry-build-plugin');
|
|
71
|
+
if (fs.existsSync(sentryEnvPath)) {
|
|
72
|
+
const dotenvFile = fs.readFileSync(sentryEnvPath, 'utf-8');
|
|
73
|
+
const dotenv = require('dotenv');
|
|
74
|
+
mergeEnvWithoutOverwrite(dotenv.parse(dotenvFile));
|
|
75
|
+
}
|
|
76
|
+
} catch (_e) {
|
|
77
|
+
// Continue without .env.sentry-build-plugin
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// ─── Hooks module & options ──────────────────────────────────────────────────
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Loads the EAS build hooks module from the compiled output.
|
|
85
|
+
* @returns {object} The hooks module exports
|
|
86
|
+
* @throws {Error} If the module cannot be loaded
|
|
87
|
+
*/
|
|
88
|
+
function loadHooksModule() {
|
|
89
|
+
try {
|
|
90
|
+
return require('../dist/js/tools/easBuildHooks.js');
|
|
91
|
+
} catch (_e) {
|
|
92
|
+
console.error('[Sentry] Could not load EAS build hooks module. Make sure @sentry/react-native is properly installed.');
|
|
93
|
+
process.exit(1);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Parses common options from environment variables.
|
|
99
|
+
* @returns {object} Parsed options object
|
|
100
|
+
*/
|
|
101
|
+
function parseBaseOptions() {
|
|
102
|
+
const options = {
|
|
103
|
+
dsn: process.env.SENTRY_DSN,
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// Parse additional tags if provided
|
|
107
|
+
if (process.env.SENTRY_EAS_BUILD_TAGS) {
|
|
108
|
+
try {
|
|
109
|
+
const parsed = JSON.parse(process.env.SENTRY_EAS_BUILD_TAGS);
|
|
110
|
+
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
|
|
111
|
+
options.tags = parsed;
|
|
112
|
+
} else {
|
|
113
|
+
console.warn('[Sentry] SENTRY_EAS_BUILD_TAGS must be a JSON object (e.g., {"key":"value"}). Ignoring.');
|
|
114
|
+
}
|
|
115
|
+
} catch (_e) {
|
|
116
|
+
console.warn('[Sentry] Could not parse SENTRY_EAS_BUILD_TAGS as JSON. Ignoring.');
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return options;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// ─── Hook configuration & execution ─────────────────────────────────────────
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Hook configuration keyed by hook name.
|
|
127
|
+
*
|
|
128
|
+
* Each entry defines which extra env vars to read and which hooks module
|
|
129
|
+
* method to call.
|
|
130
|
+
*/
|
|
131
|
+
const HOOK_CONFIGS = {
|
|
132
|
+
'on-complete': {
|
|
133
|
+
envKeys: {
|
|
134
|
+
errorMessage: 'SENTRY_EAS_BUILD_ERROR_MESSAGE',
|
|
135
|
+
successMessage: 'SENTRY_EAS_BUILD_SUCCESS_MESSAGE',
|
|
136
|
+
captureSuccessfulBuilds: 'SENTRY_EAS_BUILD_CAPTURE_SUCCESS',
|
|
137
|
+
},
|
|
138
|
+
method: 'captureEASBuildComplete',
|
|
139
|
+
},
|
|
140
|
+
'on-error': {
|
|
141
|
+
envKeys: {
|
|
142
|
+
errorMessage: 'SENTRY_EAS_BUILD_ERROR_MESSAGE',
|
|
143
|
+
},
|
|
144
|
+
method: 'captureEASBuildError',
|
|
145
|
+
},
|
|
146
|
+
'on-success': {
|
|
147
|
+
envKeys: {
|
|
148
|
+
successMessage: 'SENTRY_EAS_BUILD_SUCCESS_MESSAGE',
|
|
149
|
+
captureSuccessfulBuilds: 'SENTRY_EAS_BUILD_CAPTURE_SUCCESS',
|
|
150
|
+
},
|
|
151
|
+
// When a user explicitly configures the on-success hook, they intend to
|
|
152
|
+
// capture successful builds, so default captureSuccessfulBuilds to true.
|
|
153
|
+
defaults: { captureSuccessfulBuilds: true },
|
|
154
|
+
method: 'captureEASBuildSuccess',
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Runs an EAS build hook by name.
|
|
160
|
+
*
|
|
161
|
+
* Loads the environment, resolves hook-specific options from env vars,
|
|
162
|
+
* and calls the corresponding hooks module method.
|
|
163
|
+
*
|
|
164
|
+
* @param {'on-complete' | 'on-error' | 'on-success'} hookName
|
|
165
|
+
*/
|
|
166
|
+
async function runEASBuildHook(hookName) {
|
|
167
|
+
const config = HOOK_CONFIGS[hookName];
|
|
168
|
+
if (!config) {
|
|
169
|
+
throw new Error(`Unknown EAS build hook: ${hookName}`);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
loadEnv();
|
|
173
|
+
|
|
174
|
+
const hooks = loadHooksModule();
|
|
175
|
+
const options = {
|
|
176
|
+
...parseBaseOptions(),
|
|
177
|
+
...config.defaults,
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
for (const [optionKey, envKey] of Object.entries(config.envKeys)) {
|
|
181
|
+
if (optionKey === 'captureSuccessfulBuilds') {
|
|
182
|
+
// Only override the default when the env var is explicitly set
|
|
183
|
+
if (process.env[envKey] !== undefined) {
|
|
184
|
+
options[optionKey] = process.env[envKey] === 'true';
|
|
185
|
+
}
|
|
186
|
+
} else if (process.env[envKey] !== undefined) {
|
|
187
|
+
options[optionKey] = process.env[envKey];
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
try {
|
|
192
|
+
await hooks[config.method](options);
|
|
193
|
+
console.log(`[Sentry] EAS build ${hookName} hook completed.`);
|
|
194
|
+
} catch (error) {
|
|
195
|
+
console.error(`[Sentry] Error in eas-build-${hookName} hook:`, error);
|
|
196
|
+
// Don't fail the build hook itself
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// ─── Hook name resolution & entry point ─────────────────────────────────────
|
|
201
|
+
|
|
202
|
+
const HOOK_NAME_RE = /(?:sentry-eas-build-|build-)(on-(?:complete|error|success))/;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Resolves which hook to run.
|
|
206
|
+
*
|
|
207
|
+
* 1. Explicit CLI argument: `node build-hook.js on-error`
|
|
208
|
+
* 2. Derived from the script path in process.argv[1]
|
|
209
|
+
*/
|
|
210
|
+
function resolveHookName() {
|
|
211
|
+
const arg = process.argv[2];
|
|
212
|
+
if (arg && /^on-(complete|error|success)$/.test(arg)) {
|
|
213
|
+
return arg;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
const caller = path.basename(process.argv[1] || '', '.js');
|
|
217
|
+
const match = caller.match(HOOK_NAME_RE);
|
|
218
|
+
if (match) {
|
|
219
|
+
return match[1];
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
console.error(
|
|
223
|
+
'[Sentry] Could not determine EAS build hook name. ' +
|
|
224
|
+
'Pass one of: on-complete, on-error, on-success',
|
|
225
|
+
);
|
|
226
|
+
process.exit(1);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const hookName = resolveHookName();
|
|
230
|
+
|
|
231
|
+
runEASBuildHook(hookName).catch(error => {
|
|
232
|
+
console.error(`[Sentry] Unexpected error in eas-build-${hookName} hook:`, error);
|
|
233
|
+
process.exit(1);
|
|
234
|
+
});
|
package/scripts/sentry-xcode.sh
CHANGED
|
@@ -15,6 +15,13 @@ RN_PROJECT_ROOT="${PROJECT_DIR}/.."
|
|
|
15
15
|
[ -z "$SENTRY_PROPERTIES" ] && export SENTRY_PROPERTIES=sentry.properties
|
|
16
16
|
[ -z "$SENTRY_DOTENV_PATH" ] && [ -f "$RN_PROJECT_ROOT/.env.sentry-build-plugin" ] && export SENTRY_DOTENV_PATH="$RN_PROJECT_ROOT/.env.sentry-build-plugin"
|
|
17
17
|
[ -z "$SOURCEMAP_FILE" ] && export SOURCEMAP_FILE="$DERIVED_FILE_DIR/main.jsbundle.map"
|
|
18
|
+
# Resolve relative SOURCEMAP_FILE to absolute. The script runs from `ios/` (Xcode's PWD),
|
|
19
|
+
# but users typically specify paths relative to the project root. Without this, sentry-cli
|
|
20
|
+
# would resolve relative paths against `ios/` and fail to find the file.
|
|
21
|
+
# See: https://github.com/getsentry/sentry-react-native/issues/3889
|
|
22
|
+
if [[ "$SOURCEMAP_FILE" != /* ]]; then
|
|
23
|
+
export SOURCEMAP_FILE="$(cd "$RN_PROJECT_ROOT" && pwd)/${SOURCEMAP_FILE#./}"
|
|
24
|
+
fi
|
|
18
25
|
|
|
19
26
|
if [ -z "$SENTRY_CLI_EXECUTABLE" ]; then
|
|
20
27
|
# Try standard resolution safely
|
|
@@ -57,11 +64,11 @@ if [ "$SENTRY_DISABLE_AUTO_UPLOAD" != true ]; then
|
|
|
57
64
|
echo "$SENTRY_XCODE_COMMAND_OUTPUT" | awk '{print "output: sentry-cli - " $0}'
|
|
58
65
|
else
|
|
59
66
|
if [ "$SENTRY_ALLOW_FAILURE" == true ]; then
|
|
67
|
+
echo "$SENTRY_XCODE_COMMAND_OUTPUT" | awk '{print "warning: sentry-cli - " $0}'
|
|
60
68
|
echo "warning: sentry-cli - Source maps upload failed, but continuing build because SENTRY_ALLOW_FAILURE=true"
|
|
61
|
-
echo "warning: sentry-cli - $SENTRY_XCODE_COMMAND_OUTPUT"
|
|
62
69
|
else
|
|
70
|
+
echo "$SENTRY_XCODE_COMMAND_OUTPUT" | awk '{print "error: sentry-cli - " $0}'
|
|
63
71
|
echo "error: sentry-cli - To disable source maps auto upload, set SENTRY_DISABLE_AUTO_UPLOAD=true in your environment variables. Or to allow failing upload, set SENTRY_ALLOW_FAILURE=true"
|
|
64
|
-
echo "error: sentry-cli - $SENTRY_XCODE_COMMAND_OUTPUT"
|
|
65
72
|
exitCode=1
|
|
66
73
|
fi
|
|
67
74
|
fi
|
package/sentry.gradle
CHANGED
|
@@ -67,11 +67,19 @@ plugins.withId('com.android.application') {
|
|
|
67
67
|
|
|
68
68
|
androidComponents.onVariants(androidComponents.selector().all()) { v ->
|
|
69
69
|
if (!v.name.toLowerCase().contains("debug")) {
|
|
70
|
-
//
|
|
71
|
-
//
|
|
72
|
-
//
|
|
73
|
-
def
|
|
74
|
-
|
|
70
|
+
// Hook into the bundle task of react native to inject sourcemap generation parameters.
|
|
71
|
+
// tasks.names.contains() checks task existence without iterating the container, avoiding
|
|
72
|
+
// eager realization of unrelated tasks (fixes #5698, Fullstory AGP Artifacts API).
|
|
73
|
+
def variantCapitalized = v.name.capitalize()
|
|
74
|
+
def sentryBundleTaskName = ["createBundle${variantCapitalized}JsAndAssets", "bundle${variantCapitalized}JsAndAssets"].find { tasks.names.contains(it) }
|
|
75
|
+
if (sentryBundleTaskName == null) {
|
|
76
|
+
project.logger.warn("[sentry] No bundle task found for variant '${v.name}'. " +
|
|
77
|
+
"Expected 'createBundle${variantCapitalized}JsAndAssets' or " +
|
|
78
|
+
"'bundle${variantCapitalized}JsAndAssets'. Source maps will not be uploaded.")
|
|
79
|
+
return
|
|
80
|
+
}
|
|
81
|
+
def bundleTask = tasks.named(sentryBundleTaskName).get()
|
|
82
|
+
if (bundleTask.enabled) {
|
|
75
83
|
def shouldCleanUp
|
|
76
84
|
def sourcemapOutput
|
|
77
85
|
def bundleOutput
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { NativeLogEntry } from './options';
|
|
2
|
+
/**
|
|
3
|
+
* Sets up the native log listener that forwards logs from the native SDK to JS.
|
|
4
|
+
* This only works when `debug: true` is set in Sentry options.
|
|
5
|
+
*
|
|
6
|
+
* @param callback - The callback to invoke when a native log is received.
|
|
7
|
+
* @returns A function to remove the listener, or undefined if setup failed.
|
|
8
|
+
*/
|
|
9
|
+
export declare function setupNativeLogListener(callback: (log: NativeLogEntry) => void): (() => void) | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Default handler for native logs that uses Sentry's debug logger.
|
|
12
|
+
* This avoids interference with captureConsoleIntegration which would
|
|
13
|
+
* otherwise capture these logs as breadcrumbs or events.
|
|
14
|
+
*/
|
|
15
|
+
export declare function defaultNativeLogHandler(log: NativeLogEntry): void;
|
|
16
|
+
//# sourceMappingURL=NativeLogListener.d.ts.map
|
|
@@ -10,6 +10,7 @@ import type { ReactNativeClientOptions } from './options';
|
|
|
10
10
|
export declare class ReactNativeClient extends Client<ReactNativeClientOptions> {
|
|
11
11
|
private _outcomesBuffer;
|
|
12
12
|
private _logFlushIdleTimeout;
|
|
13
|
+
private _removeNativeLogListener;
|
|
13
14
|
/**
|
|
14
15
|
* Creates a new React Native SDK instance.
|
|
15
16
|
* @param options Configuration options for this SDK.
|
package/ts3.8/dist/js/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export type { Breadcrumb, SdkInfo, Event, Exception, SendFeedbackParams, SeverityLevel, Span, StackFrame, Stacktrace, Thread, User, UserFeedback, ErrorEvent, TransactionEvent, Metric, } from '@sentry/core';
|
|
2
|
-
export { addBreadcrumb, addIntegration, captureException, captureEvent, captureFeedback, captureMessage, Scope, setContext, setExtra, setExtras, setTag, setTags, setUser, startInactiveSpan, startSpan, startSpanManual, getActiveSpan, getRootSpan, withActiveSpan, suppressTracing, spanToJSON, spanIsSampled, setMeasurement, getCurrentScope, getGlobalScope, getIsolationScope, getClient, setCurrentClient, addEventProcessor, lastEventId, } from '@sentry/core';
|
|
2
|
+
export { addBreadcrumb, addIntegration, captureException, captureEvent, captureFeedback, captureMessage, Scope, setContext, setExtra, setExtras, setTag, setTags, setUser, startInactiveSpan, startSpan, startSpanManual, getActiveSpan, getRootSpan, withActiveSpan, suppressTracing, spanToJSON, spanIsSampled, setMeasurement, getCurrentScope, getGlobalScope, getIsolationScope, getClient, setCurrentClient, addEventProcessor, lastEventId, consoleSandbox, } from '@sentry/core';
|
|
3
3
|
export { ErrorBoundary, withErrorBoundary, createReduxEnhancer, Profiler, useProfiler, withProfiler, } from '@sentry/react';
|
|
4
4
|
export type { FeatureFlagsIntegration } from '@sentry/browser';
|
|
5
5
|
export { logger, consoleLoggingIntegration, featureFlagsIntegration, metrics } from '@sentry/browser';
|
|
6
6
|
export * from './integrations/exports';
|
|
7
7
|
export { SDK_NAME, SDK_VERSION } from './version';
|
|
8
|
-
export type { ReactNativeOptions } from './options';
|
|
8
|
+
export type { ReactNativeOptions, NativeLogEntry } from './options';
|
|
9
9
|
export { ReactNativeClient } from './client';
|
|
10
10
|
export { init, wrap, nativeCrash, flush, close, withScope, crashedLastRun } from './sdk';
|
|
11
11
|
export { TouchEventBoundary, withTouchEventBoundary } from './touchevents';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Integration } from '@sentry/core';
|
|
2
|
+
export declare const EXPO_CONSTANTS_CONTEXT_KEY = "expo_constants";
|
|
3
|
+
/** Load Expo Constants as event context. */
|
|
4
|
+
export declare const expoConstantsIntegration: () => Integration;
|
|
5
|
+
/**
|
|
6
|
+
* @internal Exposed for testing purposes
|
|
7
|
+
*/
|
|
8
|
+
export declare function getExpoConstantsContext(): ExpoConstantsContext;
|
|
9
|
+
type ExpoConstantsContext = Partial<{
|
|
10
|
+
execution_environment: string;
|
|
11
|
+
app_ownership: string;
|
|
12
|
+
debug_mode: boolean;
|
|
13
|
+
expo_version: string;
|
|
14
|
+
expo_runtime_version: string;
|
|
15
|
+
session_id: string;
|
|
16
|
+
status_bar_height: number;
|
|
17
|
+
app_name: string;
|
|
18
|
+
app_slug: string;
|
|
19
|
+
app_version: string;
|
|
20
|
+
expo_sdk_version?: string;
|
|
21
|
+
eas_project_id: string;
|
|
22
|
+
}>;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=expoconstants.d.ts.map
|
|
@@ -11,6 +11,7 @@ export { hermesProfilingIntegration } from '../profiling/integration';
|
|
|
11
11
|
export { screenshotIntegration } from './screenshot';
|
|
12
12
|
export { viewHierarchyIntegration } from './viewhierarchy';
|
|
13
13
|
export { expoContextIntegration } from './expocontext';
|
|
14
|
+
export { expoConstantsIntegration } from './expoconstants';
|
|
14
15
|
export { spotlightIntegration } from './spotlight';
|
|
15
16
|
export { mobileReplayIntegration } from '../replay/mobilereplay';
|
|
16
17
|
export { feedbackIntegration } from '../feedback/integration';
|
|
@@ -313,6 +313,32 @@ export interface BaseReactNativeOptions {
|
|
|
313
313
|
* @default 'all'
|
|
314
314
|
*/
|
|
315
315
|
logsOrigin?: 'all' | 'js' | 'native';
|
|
316
|
+
/**
|
|
317
|
+
* A callback that is invoked when the native SDK emits a log message.
|
|
318
|
+
* This is useful for surfacing native SDK logs (e.g., transport errors like HTTP 413)
|
|
319
|
+
* in the JavaScript console.
|
|
320
|
+
*
|
|
321
|
+
* Only works when `debug: true` is set.
|
|
322
|
+
*
|
|
323
|
+
* @example
|
|
324
|
+
* ```typescript
|
|
325
|
+
* Sentry.init({
|
|
326
|
+
* debug: true,
|
|
327
|
+
* onNativeLog: ({ level, component, message }) => {
|
|
328
|
+
* console.log(`[Sentry Native] [${level}] [${component}] ${message}`);
|
|
329
|
+
* },
|
|
330
|
+
* });
|
|
331
|
+
* ```
|
|
332
|
+
*/
|
|
333
|
+
onNativeLog?: (log: NativeLogEntry) => void;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Represents a log entry from the native SDK.
|
|
337
|
+
*/
|
|
338
|
+
export interface NativeLogEntry {
|
|
339
|
+
level: string;
|
|
340
|
+
component: string;
|
|
341
|
+
message: string;
|
|
316
342
|
}
|
|
317
343
|
export type SentryReplayQuality = 'low' | 'medium' | 'high';
|
|
318
344
|
/**
|
|
@@ -21,6 +21,13 @@ export declare const ignoreEmptyRouteChangeTransactions: (client: Client | undef
|
|
|
21
21
|
export declare const onlySampleIfChildSpans: (client: Client, span: Span) => void;
|
|
22
22
|
/**
|
|
23
23
|
* Hooks on AppState change to cancel the span if the app goes background.
|
|
24
|
+
*
|
|
25
|
+
* On iOS the JS thread can be suspended between the `inactive` and
|
|
26
|
+
* `background` transitions, which means the `background` event may never
|
|
27
|
+
* reach JS in time. To handle this we schedule a deferred cancellation when
|
|
28
|
+
* the app becomes `inactive`. If the app returns to `active` before the
|
|
29
|
+
* timeout fires, the cancellation is cleared. If it transitions to
|
|
30
|
+
* `background` first, we cancel immediately and clear the timeout.
|
|
24
31
|
*/
|
|
25
32
|
export declare const cancelInBackground: (client: Client, span: Span) => void;
|
|
26
33
|
//# sourceMappingURL=onSpanEndUtils.d.ts.map
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
import type { Client, Integration } from '@sentry/core';
|
|
2
2
|
export declare const INTEGRATION_NAME = "ReactNavigation";
|
|
3
|
+
/**
|
|
4
|
+
* Extracts dynamic route parameters from a route name and its params.
|
|
5
|
+
* Matches Expo Router style dynamic segments like `[id]` and `[...slug]`.
|
|
6
|
+
*
|
|
7
|
+
* Only params whose keys appear as dynamic segments in the route name are returned,
|
|
8
|
+
* filtering out non-structural params (query params, etc.) that may contain PII.
|
|
9
|
+
*
|
|
10
|
+
* Note: dynamic segment values (e.g. the `123` in `profile/[id]`) may be user-identifiable.
|
|
11
|
+
* This function only extracts params — callers are responsible for checking `sendDefaultPii`
|
|
12
|
+
* before including the result in span attributes.
|
|
13
|
+
*
|
|
14
|
+
* Previous route params are intentionally not captured — only the current route's
|
|
15
|
+
* structural params are needed for trace attribution.
|
|
16
|
+
*/
|
|
17
|
+
export declare function extractDynamicRouteParams(routeName: string, params?: Record<string, unknown>): Record<string, string> | undefined;
|
|
3
18
|
interface ReactNavigationIntegrationOptions {
|
|
4
19
|
/**
|
|
5
20
|
* How long the instrumentation will wait for the route to mount after a change has been initiated,
|
|
@@ -7,14 +7,14 @@ export declare const defaultIdleOptions: {
|
|
|
7
7
|
*
|
|
8
8
|
* @default 1_000 (ms)
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
idleTimeout: number;
|
|
11
11
|
/**
|
|
12
12
|
* The max. time an idle span may run.
|
|
13
13
|
* If this time is exceeded, the idle span will finish no matter what.
|
|
14
14
|
*
|
|
15
|
-
* @default
|
|
15
|
+
* @default 600_000 (ms)
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
finalTimeout: number;
|
|
18
18
|
};
|
|
19
19
|
export declare const startIdleNavigationSpan: (startSpanOption: StartSpanOptions, { finalTimeout, idleTimeout, isAppRestart, }?: Partial<{
|
|
20
20
|
/**
|
|
@@ -23,14 +23,14 @@ export declare const startIdleNavigationSpan: (startSpanOption: StartSpanOptions
|
|
|
23
23
|
*
|
|
24
24
|
* @default 1_000 (ms)
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
idleTimeout: number;
|
|
27
27
|
/**
|
|
28
28
|
* The max. time an idle span may run.
|
|
29
29
|
* If this time is exceeded, the idle span will finish no matter what.
|
|
30
30
|
*
|
|
31
|
-
* @default
|
|
31
|
+
* @default 600_000 (ms)
|
|
32
32
|
*/
|
|
33
|
-
|
|
33
|
+
finalTimeout: number;
|
|
34
34
|
}> & {
|
|
35
35
|
isAppRestart?: boolean | undefined;
|
|
36
36
|
}) => Span | undefined;
|
|
@@ -5,15 +5,9 @@
|
|
|
5
5
|
*
|
|
6
6
|
* https://github.com/expo/expo/blob/b51b5139f2caa2a9495e4132437d7ca612276158/packages/expo-constants/src/Constants.ts
|
|
7
7
|
* https://github.com/expo/expo/blob/b51b5139f2caa2a9495e4132437d7ca612276158/packages/expo-manifests/src/Manifests.ts
|
|
8
|
+
* https://github.com/expo/expo/blob/fce7f6eb2ea2611cb30e9cb20baaeee2ac0a18b6/packages/expo-constants/src/Constants.types.ts
|
|
8
9
|
*/
|
|
9
10
|
export interface ExpoConstants {
|
|
10
|
-
/**
|
|
11
|
-
* Deprecated. But until removed we can use it as user ID to match the native SDKs.
|
|
12
|
-
*/
|
|
13
|
-
installationId?: string;
|
|
14
|
-
/**
|
|
15
|
-
* Version of the Expo Go app
|
|
16
|
-
*/
|
|
17
11
|
expoVersion?: string | null;
|
|
18
12
|
manifest?: null | {
|
|
19
13
|
[key: string]: unknown;
|
|
@@ -23,6 +17,52 @@ export interface ExpoConstants {
|
|
|
23
17
|
*/
|
|
24
18
|
runtimeVersion?: string;
|
|
25
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* Returns the current execution environment.
|
|
22
|
+
* Values: 'bare', 'standalone', 'storeClient'
|
|
23
|
+
*/
|
|
24
|
+
executionEnvironment?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Deprecated. Returns 'expo' when running in Expo Go, otherwise null.
|
|
27
|
+
*/
|
|
28
|
+
appOwnership?: string | null;
|
|
29
|
+
/**
|
|
30
|
+
* Identifies debug vs. production builds.
|
|
31
|
+
*/
|
|
32
|
+
debugMode?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Unique identifier per app session.
|
|
35
|
+
*/
|
|
36
|
+
sessionId?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Runtime version info.
|
|
39
|
+
*/
|
|
40
|
+
expoRuntimeVersion?: string | null;
|
|
41
|
+
/**
|
|
42
|
+
* Device status bar height.
|
|
43
|
+
*/
|
|
44
|
+
statusBarHeight?: number;
|
|
45
|
+
/**
|
|
46
|
+
* Available system fonts.
|
|
47
|
+
*/
|
|
48
|
+
systemFonts?: string[];
|
|
49
|
+
/**
|
|
50
|
+
* The standard Expo config object defined in app.json and app.config.js files.
|
|
51
|
+
*/
|
|
52
|
+
expoConfig?: null | {
|
|
53
|
+
[key: string]: unknown;
|
|
54
|
+
name?: string;
|
|
55
|
+
slug?: string;
|
|
56
|
+
version?: string;
|
|
57
|
+
sdkVersion?: string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* EAS configuration when applicable.
|
|
61
|
+
*/
|
|
62
|
+
easConfig?: null | {
|
|
63
|
+
[key: string]: unknown;
|
|
64
|
+
projectId?: string;
|
|
65
|
+
};
|
|
26
66
|
}
|
|
27
67
|
/**
|
|
28
68
|
* Interface from the Expo SDK defined here
|