@sentry/react-native 5.0.0-alpha.7 → 5.0.0-alpha.9
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/CHANGELOG.md +63 -0
- package/RNSentry.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +28 -0
- package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +5 -0
- package/android/src/oldarch/java/io/sentry/react/RNSentryModule.java +5 -0
- package/dist/js/NativeRNSentry.d.ts +1 -0
- package/dist/js/NativeRNSentry.d.ts.map +1 -1
- package/dist/js/NativeRNSentry.js.map +1 -1
- package/dist/js/client.d.ts.map +1 -1
- package/dist/js/client.js +3 -2
- package/dist/js/client.js.map +1 -1
- package/dist/js/integrations/index.d.ts +1 -0
- package/dist/js/integrations/index.d.ts.map +1 -1
- package/dist/js/integrations/index.js +1 -0
- package/dist/js/integrations/index.js.map +1 -1
- package/dist/js/integrations/modulesloader.d.ts +17 -0
- package/dist/js/integrations/modulesloader.d.ts.map +1 -0
- package/dist/js/integrations/modulesloader.js +33 -0
- package/dist/js/integrations/modulesloader.js.map +1 -0
- package/dist/js/options.d.ts +12 -2
- package/dist/js/options.d.ts.map +1 -1
- package/dist/js/options.js.map +1 -1
- package/dist/js/sdk.d.ts +2 -2
- package/dist/js/sdk.d.ts.map +1 -1
- package/dist/js/sdk.js +7 -4
- package/dist/js/sdk.js.map +1 -1
- package/dist/js/tools/ModulesCollector.d.ts +8 -0
- package/dist/js/tools/ModulesCollector.d.ts.map +1 -0
- package/dist/js/tools/ModulesCollector.js +60 -0
- package/dist/js/tools/ModulesCollector.js.map +1 -0
- package/dist/js/tools/collectModules.d.ts +2 -0
- package/dist/js/tools/collectModules.d.ts.map +1 -0
- package/dist/js/tools/collectModules.js +32 -0
- package/dist/js/tools/collectModules.js.map +1 -0
- package/dist/js/tracing/reactnativetracing.d.ts.map +1 -1
- package/dist/js/tracing/reactnativetracing.js +5 -2
- package/dist/js/tracing/reactnativetracing.js.map +1 -1
- package/dist/js/transports/native.d.ts +6 -1
- package/dist/js/transports/native.d.ts.map +1 -1
- package/dist/js/transports/native.js +6 -4
- package/dist/js/transports/native.js.map +1 -1
- package/dist/js/version.d.ts +1 -1
- package/dist/js/version.js +1 -1
- package/dist/js/version.js.map +1 -1
- package/dist/js/wrapper.d.ts +1 -0
- package/dist/js/wrapper.d.ts.map +1 -1
- package/dist/js/wrapper.js +13 -1
- package/dist/js/wrapper.js.map +1 -1
- package/ios/RNSentry.mm +16 -10
- package/package.json +19 -17
- package/scripts/collect-modules.sh +43 -0
- package/sentry.gradle +48 -1
- package/src/js/NativeRNSentry.ts +59 -0
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": "5.0.0-alpha.
|
|
5
|
+
"version": "5.0.0-alpha.9",
|
|
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",
|
|
@@ -11,8 +11,10 @@
|
|
|
11
11
|
},
|
|
12
12
|
"main": "dist/js/index.js",
|
|
13
13
|
"scripts": {
|
|
14
|
-
"build": "
|
|
15
|
-
"build:
|
|
14
|
+
"build": "yarn build:sdk && yarn build:tools",
|
|
15
|
+
"build:sdk": "tsc -p tsconfig.build.json",
|
|
16
|
+
"build:sdk:watch": "tsc -p tsconfig.build.json -w --preserveWatchOutput",
|
|
17
|
+
"build:tools": "tsc -p tsconfig.build.tools.json",
|
|
16
18
|
"clean": "rimraf dist coverage",
|
|
17
19
|
"test": "jest",
|
|
18
20
|
"lint": "eslint .",
|
|
@@ -40,32 +42,32 @@
|
|
|
40
42
|
"react-native": ">=0.70.0"
|
|
41
43
|
},
|
|
42
44
|
"dependencies": {
|
|
43
|
-
"@sentry/browser": "7.
|
|
45
|
+
"@sentry/browser": "7.21.1",
|
|
44
46
|
"@sentry/cli": "2.7.0",
|
|
45
|
-
"@sentry/core": "7.
|
|
46
|
-
"@sentry/hub": "7.
|
|
47
|
-
"@sentry/integrations": "7.
|
|
48
|
-
"@sentry/react": "7.
|
|
49
|
-
"@sentry/tracing": "7.
|
|
50
|
-
"@sentry/types": "7.
|
|
51
|
-
"@sentry/utils": "7.
|
|
47
|
+
"@sentry/core": "7.21.1",
|
|
48
|
+
"@sentry/hub": "7.21.1",
|
|
49
|
+
"@sentry/integrations": "7.21.1",
|
|
50
|
+
"@sentry/react": "7.21.1",
|
|
51
|
+
"@sentry/tracing": "7.21.1",
|
|
52
|
+
"@sentry/types": "7.21.1",
|
|
53
|
+
"@sentry/utils": "7.21.1"
|
|
52
54
|
},
|
|
53
55
|
"devDependencies": {
|
|
54
|
-
"@sentry-internal/eslint-config-sdk": "7.
|
|
55
|
-
"@sentry-internal/eslint-plugin-sdk": "7.
|
|
56
|
+
"@sentry-internal/eslint-config-sdk": "7.21.1",
|
|
57
|
+
"@sentry-internal/eslint-plugin-sdk": "7.21.1",
|
|
56
58
|
"@sentry/typescript": "^5.20.1",
|
|
57
59
|
"@sentry/wizard": "2.2.0",
|
|
58
60
|
"@types/jest": "^26.0.15",
|
|
59
|
-
"@types/react": "^18",
|
|
60
|
-
"@types/react-native": "^0.70.
|
|
61
|
+
"@types/react": "^18.0.25",
|
|
62
|
+
"@types/react-native": "^0.70.6",
|
|
61
63
|
"babel-jest": "^26.1.0",
|
|
62
64
|
"eslint": "^7.6.0",
|
|
63
65
|
"eslint-plugin-react": "^7.20.6",
|
|
64
66
|
"eslint-plugin-react-native": "^3.8.1",
|
|
65
67
|
"jest": "^24.9.0",
|
|
66
68
|
"prettier": "^2.0.5",
|
|
67
|
-
"react": "^18",
|
|
68
|
-
"react-native": "^0.70.
|
|
69
|
+
"react": "^18.2.0",
|
|
70
|
+
"react-native": "^0.70.5",
|
|
69
71
|
"replace-in-file": "^6.0.0",
|
|
70
72
|
"rimraf": "^3.0.0",
|
|
71
73
|
"ts-jest": "^24.3.0",
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Print commands before executing them (useful for troubleshooting)
|
|
4
|
+
set -x
|
|
5
|
+
|
|
6
|
+
if [[ "$CONFIGURATION" = *Debug* ]]; then
|
|
7
|
+
echo "Debug build. Modules are not collected."
|
|
8
|
+
exit 0
|
|
9
|
+
fi
|
|
10
|
+
|
|
11
|
+
if [[ -z "$CONFIGURATION_BUILD_DIR" ]]; then
|
|
12
|
+
echo "Missing env CONFIGURATION_BUILD_DIR" 1>&2
|
|
13
|
+
exit 1
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
if [[ -z "$UNLOCALIZED_RESOURCES_FOLDER_PATH" ]]; then
|
|
17
|
+
echo "Missing env UNLOCALIZED_RESOURCES_FOLDER_PATH" 1>&2
|
|
18
|
+
exit 1
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
if [[ -z "$DERIVED_FILE_DIR" ]]; then
|
|
22
|
+
echo "Missing env DERIVED_FILE_DIR" 1>&2
|
|
23
|
+
exit 1
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
nodePath="node"
|
|
27
|
+
thisFilePath=$(dirname $0)
|
|
28
|
+
collectModulesScript="$thisFilePath/../dist/js/tools/collectModules.js"
|
|
29
|
+
|
|
30
|
+
destination="$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH"
|
|
31
|
+
modulesOutput="$destination/modules.json"
|
|
32
|
+
if [[ -z "$SOURCE_MAP_PATH" ]]; then
|
|
33
|
+
sourceMap="$DERIVED_FILE_DIR/main.jsbundle.map"
|
|
34
|
+
else
|
|
35
|
+
sourceMap="$SOURCE_MAP_PATH"
|
|
36
|
+
fi
|
|
37
|
+
if [[ -z "$MODULES_PATHS" ]]; then
|
|
38
|
+
modulesPaths="$PWD/../node_modules"
|
|
39
|
+
else
|
|
40
|
+
modulesPaths="$MODULES_PATHS"
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
$nodePath $collectModulesScript $sourceMap $modulesOutput $modulesPaths
|
package/sentry.gradle
CHANGED
|
@@ -41,6 +41,8 @@ gradle.projectsEvaluated {
|
|
|
41
41
|
def bundleOutput
|
|
42
42
|
def props = bundleTask.getProperties()
|
|
43
43
|
def reactRoot = props.get("workingDir")
|
|
44
|
+
def modulesOutput = "$reactRoot/android/app/src/main/assets/modules.json"
|
|
45
|
+
def modulesTask = null
|
|
44
46
|
|
|
45
47
|
(shouldCleanUp, bundleOutput, sourcemapOutput) = forceSourceMapOutputFromBundleTask(bundleTask)
|
|
46
48
|
|
|
@@ -60,6 +62,7 @@ gradle.projectsEvaluated {
|
|
|
60
62
|
def previousCliTask = null
|
|
61
63
|
|
|
62
64
|
def nameCleanup = "${bundleTask.name}_SentryUploadCleanUp"
|
|
65
|
+
def nameModulesCleanup = "${bundleTask.name}_SentryCollectModulesCleanUp"
|
|
63
66
|
// Upload the source map several times if necessary: once for each release and versionCode.
|
|
64
67
|
currentVariants.each { key, currentVariant ->
|
|
65
68
|
variant = currentVariant[0]
|
|
@@ -79,6 +82,7 @@ gradle.projectsEvaluated {
|
|
|
79
82
|
// below) and distribution identifier (`--dist` below). Give the task a unique name
|
|
80
83
|
// based on where we're uploading to.
|
|
81
84
|
def nameCliTask = "${bundleTask.name}_SentryUpload_${releaseName}_${versionCode}"
|
|
85
|
+
def nameModulesTask = "${bundleTask.name}_SentryCollectModules_${releaseName}_${versionCode}"
|
|
82
86
|
|
|
83
87
|
// If several outputs have the same releaseName and versionCode, we'd do the exact same
|
|
84
88
|
// upload for each of them. No need to repeat.
|
|
@@ -153,6 +157,34 @@ gradle.projectsEvaluated {
|
|
|
153
157
|
enabled true
|
|
154
158
|
}
|
|
155
159
|
|
|
160
|
+
modulesTask = tasks.create(nameModulesTask, Exec) {
|
|
161
|
+
description = "collect javascript modules from bundle source map"
|
|
162
|
+
group = 'sentry.io'
|
|
163
|
+
|
|
164
|
+
workingDir reactRoot
|
|
165
|
+
|
|
166
|
+
def collectModulesScript = config.collectModulesScript
|
|
167
|
+
? file(config.collectModulesScript).getAbsolutePath()
|
|
168
|
+
: "$reactRoot/node_modules/@sentry/react-native/dist/js/tools/collectModules.js"
|
|
169
|
+
def modulesPaths = config.modulesPaths
|
|
170
|
+
? config.modulesPaths.join(',')
|
|
171
|
+
: "$reactRoot/node_modules"
|
|
172
|
+
def args = ["node",
|
|
173
|
+
collectModulesScript,
|
|
174
|
+
sourcemapOutput,
|
|
175
|
+
modulesOutput,
|
|
176
|
+
modulesPaths
|
|
177
|
+
]
|
|
178
|
+
|
|
179
|
+
project.logger.info("Sentry-CollectModules arguments: ${args}")
|
|
180
|
+
commandLine(*args)
|
|
181
|
+
|
|
182
|
+
def skip = config.skipCollectModules
|
|
183
|
+
? config.skipCollectModules == true
|
|
184
|
+
: false
|
|
185
|
+
enabled !skip
|
|
186
|
+
}
|
|
187
|
+
|
|
156
188
|
// chain the upload tasks so they run sequentially in order to run
|
|
157
189
|
// the cliCleanUpTask after the final upload task is run
|
|
158
190
|
if (previousCliTask != null) {
|
|
@@ -161,6 +193,20 @@ gradle.projectsEvaluated {
|
|
|
161
193
|
bundleTask.finalizedBy cliTask
|
|
162
194
|
}
|
|
163
195
|
previousCliTask = cliTask
|
|
196
|
+
cliTask.finalizedBy modulesTask
|
|
197
|
+
|
|
198
|
+
def modulesCleanUpTask = tasks.create(name: nameModulesCleanup, type: Delete) {
|
|
199
|
+
description = "clean up collected modules generated file"
|
|
200
|
+
group = 'sentry.io'
|
|
201
|
+
|
|
202
|
+
delete modulesOutput
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
def packageTasks = tasks.findAll { task -> "package${variant}".equalsIgnoreCase(task.name) && task.enabled }
|
|
206
|
+
packageTasks.each { packageTask ->
|
|
207
|
+
packageTask.dependsOn modulesTask
|
|
208
|
+
packageTask.finalizedBy modulesCleanUpTask
|
|
209
|
+
}
|
|
164
210
|
}
|
|
165
211
|
|
|
166
212
|
/** Delete sourcemap files */
|
|
@@ -169,7 +215,8 @@ gradle.projectsEvaluated {
|
|
|
169
215
|
group = 'sentry.io'
|
|
170
216
|
|
|
171
217
|
delete sourcemapOutput
|
|
172
|
-
delete "$buildDir/intermediates/assets/release/index.android.bundle.map"
|
|
218
|
+
delete "$buildDir/intermediates/assets/release/index.android.bundle.map"
|
|
219
|
+
// react native default bundle dir
|
|
173
220
|
}
|
|
174
221
|
|
|
175
222
|
// register clean task extension
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Package } from '@sentry/types';
|
|
2
|
+
import { TurboModule, TurboModuleRegistry } from 'react-native';
|
|
3
|
+
import type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';
|
|
4
|
+
|
|
5
|
+
// There has to be only one interface and it has to be named `Spec`
|
|
6
|
+
// Only extra allowed definitions are types (probably codegen bug)
|
|
7
|
+
export interface Spec extends TurboModule {
|
|
8
|
+
addBreadcrumb(breadcrumb: UnsafeObject): void;
|
|
9
|
+
captureEnvelope(
|
|
10
|
+
bytes: number[],
|
|
11
|
+
options: {
|
|
12
|
+
store: boolean,
|
|
13
|
+
},
|
|
14
|
+
): Promise<boolean>;
|
|
15
|
+
clearBreadcrumbs(): void;
|
|
16
|
+
crash(): void;
|
|
17
|
+
closeNativeSdk(): Promise<void>;
|
|
18
|
+
disableNativeFramesTracking(): void;
|
|
19
|
+
fetchNativeRelease(): Promise<NativeReleaseResponse>;
|
|
20
|
+
fetchNativeSdkInfo(): Promise<Package>;
|
|
21
|
+
fetchNativeDeviceContexts(): Promise<NativeDeviceContextsResponse>;
|
|
22
|
+
fetchNativeAppStart(): Promise<NativeAppStartResponse | null>;
|
|
23
|
+
fetchNativeFrames(): Promise<NativeFramesResponse | null>;
|
|
24
|
+
initNativeSdk(options: UnsafeObject): Promise<boolean>;
|
|
25
|
+
setUser(
|
|
26
|
+
defaultUserKeys: UnsafeObject | null,
|
|
27
|
+
otherUserKeys: UnsafeObject | null
|
|
28
|
+
): void;
|
|
29
|
+
setContext(key: string, value: UnsafeObject | null): void;
|
|
30
|
+
setExtra(key: string, value: string): void;
|
|
31
|
+
setTag(key: string, value: string): void;
|
|
32
|
+
enableNativeFramesTracking(): void;
|
|
33
|
+
fetchModules(): Promise<string | undefined | null>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type NativeAppStartResponse = {
|
|
37
|
+
isColdStart: boolean;
|
|
38
|
+
appStartTime: number;
|
|
39
|
+
didFetchAppStart: boolean;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export type NativeFramesResponse = {
|
|
43
|
+
totalFrames: number;
|
|
44
|
+
slowFrames: number;
|
|
45
|
+
frozenFrames: number;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type NativeReleaseResponse = {
|
|
49
|
+
build: string;
|
|
50
|
+
id: string;
|
|
51
|
+
version: string;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export type NativeDeviceContextsResponse = {
|
|
55
|
+
[key: string]: Record<string, unknown>;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// The export must be here to pass codegen even if not used
|
|
59
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('RNSentry');
|