@sentry/react-native 5.14.0 → 5.14.1

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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.14.1
4
+
5
+ ### Fixes
6
+
7
+ - Add hermes to Pod dependencies to fix profiling with `use_frameworks` ([#3416](https://github.com/getsentry/sentry-react-native/pull/3416))
8
+ - Define SentryCurrentDateProvider in RNSentry ([#3418](https://github.com/getsentry/sentry-react-native/pull/3418))
9
+
3
10
  ## 5.14.0
4
11
 
5
12
  ### Features
package/RNSentry.podspec CHANGED
@@ -1,12 +1,20 @@
1
+ require_relative './scripts/sentry_utils.rb'
1
2
  require 'json'
2
3
  version = JSON.parse(File.read('package.json'))["version"]
3
4
 
5
+ rn_package = parse_rn_package_json()
6
+ rn_version = get_rn_version(rn_package)
7
+ is_hermes_default = is_hermes_default(rn_version)
8
+ is_profiling_supported = is_profiling_supported(rn_version)
9
+
4
10
  folly_flags = ' -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1'
5
11
  folly_compiler_flags = folly_flags + ' ' + '-Wno-comma -Wno-shorten-64-to-32'
6
12
 
7
13
  is_new_arch_enabled = ENV["RCT_NEW_ARCH_ENABLED"] == "1"
14
+ is_using_hermes = (ENV['USE_HERMES'] == nil && is_hermes_default) || ENV['USE_HERMES'] == '1'
8
15
  new_arch_enabled_flag = (is_new_arch_enabled ? folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED" : "")
9
- other_cflags = "$(inherited)" + new_arch_enabled_flag
16
+ sentry_profiling_supported_flag = (is_profiling_supported ? " -DSENTRY_PROFILING_SUPPORTED=1" : "")
17
+ other_cflags = "$(inherited)" + new_arch_enabled_flag + sentry_profiling_supported_flag
10
18
 
11
19
  Pod::Spec.new do |s|
12
20
  s.name = 'RNSentry'
@@ -43,4 +51,9 @@ Pod::Spec.new do |s|
43
51
  s.dependency "RCTTypeSafety"
44
52
  s.dependency "ReactCommon/turbomodule/core"
45
53
  end
54
+
55
+ if is_using_hermes then
56
+ s.dependency 'React-hermes'
57
+ s.dependency 'hermes-engine'
58
+ end
46
59
  end
@@ -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.14.0";
3
+ export declare const SDK_VERSION = "5.14.1";
4
4
  //# sourceMappingURL=version.d.ts.map
@@ -1,4 +1,4 @@
1
1
  export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';
2
2
  export const SDK_NAME = 'sentry.javascript.react-native';
3
- export const SDK_VERSION = '5.14.0';
3
+ export const SDK_VERSION = '5.14.1';
4
4
  //# sourceMappingURL=version.js.map
@@ -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,QAAQ,CAAC","sourcesContent":["export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';\nexport const SDK_NAME = 'sentry.javascript.react-native';\nexport const SDK_VERSION = '5.14.0';\n"]}
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,QAAQ,CAAC","sourcesContent":["export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';\nexport const SDK_NAME = 'sentry.javascript.react-native';\nexport const SDK_VERSION = '5.14.1';\n"]}
package/ios/RNSentry.h CHANGED
@@ -32,3 +32,15 @@ SentrySDK (Private)
32
32
  symbolicate: (SymbolicateCallbackType) symbolicate;
33
33
 
34
34
  @end
35
+
36
+ @interface SentryCurrentDateProvider : NSObject
37
+
38
+ - (NSDate *)date;
39
+
40
+ - (dispatch_time_t)dispatchTimeNow;
41
+
42
+ - (NSInteger)timezoneOffset;
43
+
44
+ - (uint64_t)systemTime;
45
+
46
+ @end
package/ios/RNSentry.mm CHANGED
@@ -7,7 +7,7 @@
7
7
  #import "RCTConvert.h"
8
8
  #endif
9
9
 
10
- #if __has_include(<hermes/hermes.h>)
10
+ #if __has_include(<hermes/hermes.h>) && SENTRY_PROFILING_SUPPORTED
11
11
  #define SENTRY_PROFILING_ENABLED 1
12
12
  #import <Sentry/SentryProfilingConditionals.h>
13
13
  #else
@@ -22,7 +22,6 @@
22
22
  #import <Sentry/SentryBinaryImageCache.h>
23
23
  #import <Sentry/SentryDependencyContainer.h>
24
24
  #import <Sentry/SentryFormatter.h>
25
- #import <Sentry/SentryCurrentDateProvider.h>
26
25
 
27
26
  // This guard prevents importing Hermes in JSC apps
28
27
  #if SENTRY_PROFILING_ENABLED
@@ -655,6 +654,7 @@ RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSDictionary *, stopProfiling)
655
654
 
656
655
  facebook::hermes::HermesRuntime::disableSamplingProfiler();
657
656
  std::stringstream ss;
657
+ // Before RN 0.69 Hermes used llvh::raw_ostream (profiling is supported for 0.69 and newer)
658
658
  facebook::hermes::HermesRuntime::dumpSampledTraceToStream(ss);
659
659
 
660
660
  std::string s = ss.str();
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.14.0",
5
+ "version": "5.14.1",
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",
@@ -0,0 +1,33 @@
1
+ def parse_rn_package_json()
2
+ rn_path = File.dirname(`node --print "require.resolve('react-native/package.json')"`)
3
+ env_rn_path = ENV['REACT_NATIVE_NODE_MODULES_DIR']
4
+ if env_rn_path != nil
5
+ rn_path = env_rn_path
6
+ end
7
+
8
+ rn_package_json_path = File.join(rn_path, 'package.json')
9
+ if !File.exist?(rn_package_json_path)
10
+ raise "React Native `package.json` not found, it doesn't exist in #{rn_package_json_path}, use `REACT_NATIVE_NODE_MODULES_DIR` env variable to specify a custom location"
11
+ end
12
+
13
+ return JSON.parse(File.read(rn_package_json_path))
14
+ end
15
+
16
+ def get_rn_version(package)
17
+ version = package['version'].split('.')
18
+ result = {
19
+ :major => version[0].to_i,
20
+ :minor => version[1].to_i,
21
+ }
22
+ return result
23
+ end
24
+
25
+ def is_hermes_default(rn_version)
26
+ return (rn_version[:major] >= 1 || (rn_version[:major] == 0 && rn_version[:minor] >= 70))
27
+ end
28
+
29
+ # before RN 0.69 Hermes was not shipped with RN
30
+ # users could use unexpected version of Hermes
31
+ def is_profiling_supported(rn_version)
32
+ return (rn_version[:major] >= 1 || (rn_version[:major] == 0 && rn_version[:minor] >= 69))
33
+ end
@@ -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.14.0";
3
+ export declare const SDK_VERSION = "5.14.1";
4
4
  //# sourceMappingURL=version.d.ts.map