@sentry/react-native 5.15.1 → 5.16.0-alpha.2

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.
Files changed (95) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/app.plugin.js +1 -0
  3. package/dist/js/NativeRNSentry.d.ts +1 -1
  4. package/dist/js/NativeRNSentry.d.ts.map +1 -1
  5. package/dist/js/NativeRNSentry.js.map +1 -1
  6. package/dist/js/index.js +1 -1
  7. package/dist/js/index.js.map +1 -1
  8. package/dist/js/integrations/debugsymbolicator.d.ts.map +1 -1
  9. package/dist/js/integrations/debugsymbolicator.js +12 -10
  10. package/dist/js/integrations/debugsymbolicator.js.map +1 -1
  11. package/dist/js/integrations/reactnativeerrorhandlers.d.ts.map +1 -1
  12. package/dist/js/integrations/reactnativeerrorhandlers.js +9 -6
  13. package/dist/js/integrations/reactnativeerrorhandlers.js.map +1 -1
  14. package/dist/js/integrations/reactnativeinfo.d.ts +1 -1
  15. package/dist/js/integrations/reactnativeinfo.d.ts.map +1 -1
  16. package/dist/js/integrations/reactnativeinfo.js.map +1 -1
  17. package/dist/js/measurements.d.ts +0 -7
  18. package/dist/js/measurements.d.ts.map +1 -1
  19. package/dist/js/measurements.js +0 -56
  20. package/dist/js/measurements.js.map +1 -1
  21. package/dist/js/profiling/constants.d.ts +2 -0
  22. package/dist/js/profiling/constants.d.ts.map +1 -0
  23. package/dist/js/profiling/constants.js +2 -0
  24. package/dist/js/profiling/constants.js.map +1 -0
  25. package/dist/js/profiling/convertHermesProfile.d.ts.map +1 -1
  26. package/dist/js/profiling/convertHermesProfile.js +1 -1
  27. package/dist/js/profiling/convertHermesProfile.js.map +1 -1
  28. package/dist/js/profiling/integration.d.ts +0 -1
  29. package/dist/js/profiling/integration.d.ts.map +1 -1
  30. package/dist/js/profiling/integration.js +1 -1
  31. package/dist/js/profiling/integration.js.map +1 -1
  32. package/dist/js/sdk.d.ts.map +1 -1
  33. package/dist/js/sdk.js +9 -8
  34. package/dist/js/sdk.js.map +1 -1
  35. package/dist/js/tools/sentryMetroSerializer.d.ts +7 -0
  36. package/dist/js/tools/sentryMetroSerializer.d.ts.map +1 -1
  37. package/dist/js/tools/sentryMetroSerializer.js +27 -1
  38. package/dist/js/tools/sentryMetroSerializer.js.map +1 -1
  39. package/dist/js/touchevents.js +5 -8
  40. package/dist/js/touchevents.js.map +1 -1
  41. package/dist/js/tracing/addTracingExtensions.d.ts +8 -0
  42. package/dist/js/tracing/addTracingExtensions.d.ts.map +1 -0
  43. package/dist/js/tracing/addTracingExtensions.js +58 -0
  44. package/dist/js/tracing/addTracingExtensions.js.map +1 -0
  45. package/dist/js/tracing/reactnativenavigation.d.ts +1 -1
  46. package/dist/js/tracing/reactnativenavigation.d.ts.map +1 -1
  47. package/dist/js/tracing/reactnativenavigation.js.map +1 -1
  48. package/dist/js/utils/environment.d.ts +1 -1
  49. package/dist/js/utils/environment.d.ts.map +1 -1
  50. package/dist/js/utils/environment.js +5 -1
  51. package/dist/js/utils/environment.js.map +1 -1
  52. package/dist/js/utils/rnlibraries.d.ts +3 -0
  53. package/dist/js/utils/rnlibraries.d.ts.map +1 -0
  54. package/dist/js/utils/rnlibraries.js +29 -0
  55. package/dist/js/utils/rnlibraries.js.map +1 -0
  56. package/dist/js/utils/rnlibraries.web.d.ts +3 -0
  57. package/dist/js/utils/rnlibraries.web.d.ts.map +1 -0
  58. package/dist/js/utils/rnlibraries.web.js +2 -0
  59. package/dist/js/utils/rnlibraries.web.js.map +1 -0
  60. package/dist/js/utils/rnlibrariesinterface.d.ts +19 -0
  61. package/dist/js/utils/rnlibrariesinterface.d.ts.map +1 -0
  62. package/dist/js/utils/rnlibrariesinterface.js +8 -0
  63. package/dist/js/utils/rnlibrariesinterface.js.map +1 -0
  64. package/dist/js/version.d.ts +1 -1
  65. package/dist/js/version.d.ts.map +1 -1
  66. package/dist/js/version.js +1 -1
  67. package/dist/js/version.js.map +1 -1
  68. package/expo.d.ts +1 -0
  69. package/expo.js +1 -0
  70. package/package.json +20 -6
  71. package/plugin/build/index.d.ts +3 -0
  72. package/plugin/build/index.js +6 -0
  73. package/plugin/build/utils.d.ts +7 -0
  74. package/plugin/build/utils.js +39 -0
  75. package/plugin/build/withSentry.d.ts +10 -0
  76. package/plugin/build/withSentry.js +50 -0
  77. package/plugin/build/withSentryAndroid.d.ts +7 -0
  78. package/plugin/build/withSentryAndroid.js +68 -0
  79. package/plugin/build/withSentryIOS.d.ts +8 -0
  80. package/plugin/build/withSentryIOS.js +71 -0
  81. package/scripts/sentry-xcode-debug-files.sh +5 -1
  82. package/scripts/sentry-xcode.sh +7 -2
  83. package/src/js/NativeRNSentry.ts +2 -1
  84. package/ts3.8/dist/js/NativeRNSentry.d.ts +1 -1
  85. package/ts3.8/dist/js/integrations/reactnativeinfo.d.ts +1 -1
  86. package/ts3.8/dist/js/measurements.d.ts +0 -7
  87. package/ts3.8/dist/js/profiling/constants.d.ts +2 -0
  88. package/ts3.8/dist/js/profiling/integration.d.ts +0 -1
  89. package/ts3.8/dist/js/tracing/addTracingExtensions.d.ts +8 -0
  90. package/ts3.8/dist/js/tracing/reactnativenavigation.d.ts +1 -1
  91. package/ts3.8/dist/js/utils/environment.d.ts +1 -1
  92. package/ts3.8/dist/js/utils/rnlibraries.d.ts +3 -0
  93. package/ts3.8/dist/js/utils/rnlibraries.web.d.ts +3 -0
  94. package/ts3.8/dist/js/utils/rnlibrariesinterface.d.ts +19 -0
  95. package/ts3.8/dist/js/version.d.ts +1 -1
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.addSentryWithBundledScriptsToBundleShellScript = exports.modifyExistingXcodeBuildScript = exports.withSentryIOS = void 0;
27
+ const config_plugins_1 = require("expo/config-plugins");
28
+ const path = __importStar(require("path"));
29
+ const utils_1 = require("./utils");
30
+ const SENTRY_REACT_NATIVE_XCODE_PATH = "`\"$NODE_BINARY\" --print \"require('path').dirname(require.resolve('@sentry/react-native/package.json')) + '/scripts/sentry-xcode.sh'\"`";
31
+ const SENTRY_REACT_NATIVE_XCODE_DEBUG_FILES_PATH = "`${NODE_BINARY:-node} --print \"require('path').dirname(require.resolve('@sentry/react-native/package.json')) + '/scripts/sentry-xcode-debug-files.sh'\"`";
32
+ const withSentryIOS = (config, sentryProperties) => {
33
+ const cfg = (0, config_plugins_1.withXcodeProject)(config, config => {
34
+ const xcodeProject = config.modResults;
35
+ const sentryBuildPhase = xcodeProject.pbxItemByComment('Upload Debug Symbols to Sentry', 'PBXShellScriptBuildPhase');
36
+ if (!sentryBuildPhase) {
37
+ xcodeProject.addBuildPhase([], 'PBXShellScriptBuildPhase', 'Upload Debug Symbols to Sentry', null, {
38
+ shellPath: '/bin/sh',
39
+ shellScript: `/bin/sh ${SENTRY_REACT_NATIVE_XCODE_DEBUG_FILES_PATH}`,
40
+ });
41
+ }
42
+ const bundleReactNativePhase = xcodeProject.pbxItemByComment('Bundle React Native code and images', 'PBXShellScriptBuildPhase');
43
+ modifyExistingXcodeBuildScript(bundleReactNativePhase);
44
+ return config;
45
+ });
46
+ return (0, config_plugins_1.withDangerousMod)(cfg, [
47
+ 'ios',
48
+ config => {
49
+ (0, utils_1.writeSentryPropertiesTo)(path.resolve(config.modRequest.projectRoot, 'ios'), sentryProperties);
50
+ return config;
51
+ },
52
+ ]);
53
+ };
54
+ exports.withSentryIOS = withSentryIOS;
55
+ function modifyExistingXcodeBuildScript(script) {
56
+ if (!script.shellScript.match(/(packager|scripts)\/react-native-xcode\.sh\b/) ||
57
+ script.shellScript.includes('sentry-xcode.sh') ||
58
+ script.shellScript.includes('@sentry')) {
59
+ config_plugins_1.WarningAggregator.addWarningIOS(utils_1.SDK_PACKAGE_NAME, "Unable to modify build script 'Bundle React Native code and images'. Please open a bug report at https://github.com/expo/sentry-expo.");
60
+ return;
61
+ }
62
+ const code = JSON.parse(script.shellScript);
63
+ script.shellScript = JSON.stringify(addSentryWithBundledScriptsToBundleShellScript(code));
64
+ }
65
+ exports.modifyExistingXcodeBuildScript = modifyExistingXcodeBuildScript;
66
+ function addSentryWithBundledScriptsToBundleShellScript(script) {
67
+ return script.replace(/^.*?(packager|scripts)\/react-native-xcode\.sh\s*(\\'\\\\")?/m,
68
+ // eslint-disable-next-line no-useless-escape
69
+ (match) => `/bin/sh ${SENTRY_REACT_NATIVE_XCODE_PATH} ${match}`);
70
+ }
71
+ exports.addSentryWithBundledScriptsToBundleShellScript = addSentryWithBundledScriptsToBundleShellScript;
@@ -5,6 +5,8 @@
5
5
  # print commands before executing them and stop on first error
6
6
  set -x -e
7
7
 
8
+ LOCAL_NODE_BINARY=${NODE_BINARY:-node}
9
+
8
10
  # load envs if loader file exists (since rn 0.68)
9
11
  WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
10
12
  if [ -f "$WITH_ENVIRONMENT" ]; then
@@ -12,7 +14,9 @@ if [ -f "$WITH_ENVIRONMENT" ]; then
12
14
  fi
13
15
 
14
16
  [ -z "$SENTRY_PROPERTIES" ] && export SENTRY_PROPERTIES=sentry.properties
15
- [ -z "$SENTRY_CLI_EXECUTABLE" ] && SENTRY_CLI_EXECUTABLE="../node_modules/@sentry/cli/bin/sentry-cli"
17
+
18
+ [ -z "$SENTRY_CLI_EXECUTABLE" ] && SENTRY_CLI_PACKAGE_PATH=$("$LOCAL_NODE_BINARY" --print "require('path').dirname(require.resolve('@sentry/cli/package.json'))")
19
+ [ -z "$SENTRY_CLI_EXECUTABLE" ] && SENTRY_CLI_EXECUTABLE="${SENTRY_CLI_PACKAGE_PATH}/bin/sentry-cli"
16
20
 
17
21
  [[ $SENTRY_INCLUDE_NATIVE_SOURCES == "true" ]] && INCLUDE_SOURCES_FLAG="--include-sources" || INCLUDE_SOURCES_FLAG=""
18
22
 
@@ -7,9 +7,13 @@ set -x -e
7
7
 
8
8
  # WITH_ENVIRONMENT is executed by React Native
9
9
 
10
+ LOCAL_NODE_BINARY=${NODE_BINARY:-node}
11
+
10
12
  [ -z "$SENTRY_PROPERTIES" ] && export SENTRY_PROPERTIES=sentry.properties
11
13
  [ -z "$SOURCEMAP_FILE" ] && export SOURCEMAP_FILE="$DERIVED_FILE_DIR/main.jsbundle.map"
12
- [ -z "$SENTRY_CLI_EXECUTABLE" ] && SENTRY_CLI_EXECUTABLE="../node_modules/@sentry/cli/bin/sentry-cli"
14
+
15
+ [ -z "$SENTRY_CLI_EXECUTABLE" ] && SENTRY_CLI_PACKAGE_PATH=$("$LOCAL_NODE_BINARY" --print "require('path').dirname(require.resolve('@sentry/cli/package.json'))")
16
+ [ -z "$SENTRY_CLI_EXECUTABLE" ] && SENTRY_CLI_EXECUTABLE="${SENTRY_CLI_PACKAGE_PATH}/bin/sentry-cli"
13
17
 
14
18
  REACT_NATIVE_XCODE=$1
15
19
 
@@ -25,7 +29,8 @@ else
25
29
  /bin/sh -c "$REACT_NATIVE_XCODE"
26
30
  fi
27
31
 
28
- [ -z "$SENTRY_COLLECT_MODULES" ] && SENTRY_COLLECT_MODULES="../node_modules/@sentry/react-native/scripts/collect-modules.sh"
32
+ [ -z "$SENTRY_COLLECT_MODULES" ] && SENTRY_RN_PACKAGE_PATH=$("$LOCAL_NODE_BINARY" --print "require('path').dirname(require.resolve('@sentry/react-native/package.json'))")
33
+ [ -z "$SENTRY_COLLECT_MODULES" ] && SENTRY_COLLECT_MODULES="${SENTRY_RN_PACKAGE_PATH}/scripts/collect-modules.sh"
29
34
 
30
35
  if [ -f "$SENTRY_COLLECT_MODULES" ]; then
31
36
  /bin/sh "$SENTRY_COLLECT_MODULES"
@@ -1,7 +1,8 @@
1
1
  import type { Package } from '@sentry/types';
2
2
  import type { TurboModule } from 'react-native';
3
3
  import { TurboModuleRegistry } from 'react-native';
4
- import type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';
4
+
5
+ import type { UnsafeObject } from './utils/rnlibrariesinterface';
5
6
 
6
7
  // There has to be only one interface and it has to be named `Spec`
7
8
  // Only extra allowed definitions are types (probably codegen bug)
@@ -1,6 +1,6 @@
1
1
  import type { Package } from '@sentry/types';
2
2
  import type { TurboModule } from 'react-native';
3
- import type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';
3
+ import type { UnsafeObject } from './utils/rnlibrariesinterface';
4
4
  export interface Spec extends TurboModule {
5
5
  addBreadcrumb(breadcrumb: UnsafeObject): void;
6
6
  captureEnvelope(bytes: string, options: {
@@ -5,7 +5,7 @@ export interface ReactNativeContext extends Context {
5
5
  fabric: boolean;
6
6
  expo: boolean;
7
7
  hermes_version?: string;
8
- react_native_version: string;
8
+ react_native_version?: string;
9
9
  component_stack?: string;
10
10
  hermes_debug_info?: boolean;
11
11
  }
@@ -1,13 +1,6 @@
1
- import type { Hub, Transaction } from '@sentry/core';
2
- import type { CustomSamplingContext, TransactionContext } from '@sentry/types';
3
1
  export declare const APP_START_WARM = "app_start_warm";
4
2
  export declare const APP_START_COLD = "app_start_cold";
5
3
  export declare const STALL_COUNT = "stall_count";
6
4
  export declare const STALL_TOTAL_TIME = "stall_total_time";
7
5
  export declare const STALL_LONGEST_TIME = "stall_longest_time";
8
- /**
9
- * Adds React Native's extensions. Needs to be called before any transactions are created.
10
- */
11
- export declare function _addTracingExtensions(): void;
12
- export type StartTransactionFunction = (this: Hub, transactionContext: TransactionContext, customSamplingContext?: CustomSamplingContext) => Transaction;
13
6
  //# sourceMappingURL=measurements.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare const MAX_PROFILE_DURATION_MS: number;
2
+ //# sourceMappingURL=constants.d.ts.map
@@ -2,7 +2,6 @@ import type { Hub } from '@sentry/core';
2
2
  import type { EventProcessor, Integration, ThreadCpuProfile } from '@sentry/types';
3
3
  import type { NativeProfileEvent } from './nativeTypes';
4
4
  import type { CombinedProfileEvent, HermesProfileEvent } from './types';
5
- export declare const MAX_PROFILE_DURATION_MS: number;
6
5
  /**
7
6
  * Profiling integration creates a profile for each transaction and adds it to the event envelope.
8
7
  *
@@ -0,0 +1,8 @@
1
+ import type { Hub, Transaction } from '@sentry/core';
2
+ import type { CustomSamplingContext, TransactionContext } from '@sentry/types';
3
+ /**
4
+ * Adds React Native's extensions. Needs to be called before any transactions are created.
5
+ */
6
+ export declare function _addTracingExtensions(): void;
7
+ export type StartTransactionFunction = (this: Hub, transactionContext: TransactionContext, customSamplingContext?: CustomSamplingContext) => Transaction;
8
+ //# sourceMappingURL=addTracingExtensions.d.ts.map
@@ -1,4 +1,4 @@
1
- import type { EmitterSubscription } from 'react-native/Libraries/vendor/emitter/EventEmitter';
1
+ import type { EmitterSubscription } from '../utils/rnlibrariesinterface';
2
2
  import type { OnConfirmRoute, TransactionCreator } from './routingInstrumentation';
3
3
  import { InternalRoutingInstrumentation } from './routingInstrumentation';
4
4
  import type { BeforeNavigate } from './types';
@@ -5,7 +5,7 @@ export declare function isTurboModuleEnabled(): boolean;
5
5
  /** Checks if the React Native Fabric renderer is running */
6
6
  export declare function isFabricEnabled(): boolean;
7
7
  /** Returns React Native Version as semver string */
8
- export declare function getReactNativeVersion(): string;
8
+ export declare function getReactNativeVersion(): string | undefined;
9
9
  /** Checks if Expo is present in the runtime */
10
10
  export declare function isExpo(): boolean;
11
11
  /** Returns Hermes Version if hermes is present in the runtime */
@@ -0,0 +1,3 @@
1
+ import type { ReactNativeLibrariesInterface } from './rnlibrariesinterface';
2
+ export declare const ReactNativeLibraries: Required<ReactNativeLibrariesInterface>;
3
+ //# sourceMappingURL=rnlibraries.d.ts.map
@@ -0,0 +1,3 @@
1
+ import type { ReactNativeLibrariesInterface } from './rnlibrariesinterface';
2
+ export declare const ReactNativeLibraries: ReactNativeLibrariesInterface;
3
+ //# sourceMappingURL=rnlibraries.web.d.ts.map
@@ -0,0 +1,19 @@
1
+ import type { version as RNV } from 'react-native/Libraries/Core/ReactNativeVersion';
2
+ import type * as ReactNative from '../vendor/react-native';
3
+ export type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';
4
+ export type { EmitterSubscription } from 'react-native/Libraries/vendor/emitter/EventEmitter';
5
+ export interface ReactNativeLibrariesInterface {
6
+ Devtools?: {
7
+ parseErrorStack: (errorStack: string) => Array<ReactNative.StackFrame>;
8
+ symbolicateStackTrace: (stack: Array<ReactNative.StackFrame>, extraData?: Record<string, unknown>) => Promise<ReactNative.SymbolicatedStackTrace>;
9
+ getDevServer: () => ReactNative.DevServerInfo;
10
+ };
11
+ Utilities?: {
12
+ polyfillGlobal: <T>(name: string, getValue: () => T) => void;
13
+ };
14
+ Promise?: typeof Promise;
15
+ ReactNativeVersion?: {
16
+ version: typeof RNV;
17
+ };
18
+ }
19
+ //# sourceMappingURL=rnlibrariesinterface.d.ts.map
@@ -1,4 +1,4 @@
1
1
  export declare const SDK_PACKAGE_NAME = "npm:@sentry/react-native";
2
2
  export declare const SDK_NAME = "sentry.javascript.react-native";
3
- export declare const SDK_VERSION = "5.15.1";
3
+ export declare const SDK_VERSION = "5.16.0-alpha.2";
4
4
  //# sourceMappingURL=version.d.ts.map