@allstak/react-native 0.3.0 → 0.3.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.
@@ -1,7 +1,9 @@
1
1
  // Standard React Native module Gradle build file. Picked up by RN
2
2
  // autolinking via ../../react-native.config.js (sourceDir).
3
3
  buildscript {
4
- ext.kotlin_version = ext.kotlin_version ?: '1.9.22'
4
+ ext.kotlin_version = rootProject.ext.has('kotlinVersion')
5
+ ? rootProject.ext.get('kotlinVersion')
6
+ : (rootProject.ext.has('kotlin_version') ? rootProject.ext.get('kotlin_version') : '1.9.22')
5
7
  repositories {
6
8
  google()
7
9
  mavenCentral()
@@ -42,4 +42,21 @@ public class AllStakRNModule extends ReactContextBaseJavaModule {
42
42
  promise.reject("drain-failed", t);
43
43
  }
44
44
  }
45
+
46
+ /**
47
+ * DEV-ONLY: deliberately crash the app from a non-React thread so the
48
+ * Thread.UncaughtExceptionHandler in {@link AllStakCrashHandler} fires.
49
+ * Never call this from production code — it terminates the process.
50
+ * The JS wrapper {@code AllStak.__devCrashAndroid__} is documented as
51
+ * DEV_ONLY and is excluded from the public DX surface.
52
+ */
53
+ @ReactMethod
54
+ public void __devTriggerCrash(Promise promise) {
55
+ promise.resolve(true);
56
+ new Thread(() -> {
57
+ try { Thread.sleep(50); } catch (InterruptedException ignored) {}
58
+ throw new RuntimeException(
59
+ "AllStakDevCrash: Dev-only deliberate native crash to verify capture");
60
+ }, "AllStakDevCrashThread").start();
61
+ }
45
62
  }
@@ -26,4 +26,20 @@ RCT_EXPORT_METHOD(drainPendingCrash:(RCTPromiseResolveBlock)resolve
26
26
  resolve(json ?: [NSNull null]);
27
27
  }
28
28
 
29
+ // DEV-ONLY: deliberately crash the app to verify the crash-capture flow.
30
+ // Throws an NSException synchronously on the next runloop tick. Never
31
+ // expose this in user-facing UI of a production app — it kills the
32
+ // process. The JS-side wrapper (`AllStak.__devCrashIos__`) is documented
33
+ // as DEV_ONLY and is excluded from the public DX surface.
34
+ RCT_EXPORT_METHOD(__devTriggerCrash:(RCTPromiseResolveBlock)resolve
35
+ rejecter:(RCTPromiseRejectBlock)reject) {
36
+ dispatch_async(dispatch_get_main_queue(), ^{
37
+ @throw [NSException
38
+ exceptionWithName:@"AllStakDevCrash"
39
+ reason:@"Dev-only: deliberate native crash to verify capture"
40
+ userInfo:nil];
41
+ });
42
+ resolve(@YES);
43
+ }
44
+
29
45
  @end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allstak/react-native",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "AllStak React Native SDK — standalone error tracking, breadcrumbs, network capture, and ErrorUtils + Hermes rejection hooks. No browser or Node dependencies. Native Android/iOS crash modules in ./native.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -10,14 +10,24 @@
10
10
  "types": "./dist/index.d.ts",
11
11
  "import": "./dist/index.mjs",
12
12
  "require": "./dist/index.js"
13
- }
13
+ },
14
+ "./sourcemaps": {
15
+ "types": "./dist/build/sourcemaps.d.ts",
16
+ "import": "./dist/build/sourcemaps.mjs",
17
+ "require": "./dist/build/sourcemaps.js"
18
+ },
19
+ "./app.plugin": "./app.plugin.js",
20
+ "./app.plugin.js": "./app.plugin.js"
14
21
  },
15
22
  "files": [
16
23
  "dist",
17
24
  "native",
25
+ "build-hooks",
18
26
  "react-native.config.js",
19
27
  "app.plugin.js",
28
+ "AllStakRN.podspec",
20
29
  "README.md",
30
+ "CHANGELOG.md",
21
31
  "LICENSE"
22
32
  ],
23
33
  "license": "MIT",
@@ -42,19 +52,27 @@
42
52
  "registry": "https://registry.npmjs.org/"
43
53
  },
44
54
  "scripts": {
45
- "build": "tsup src/index.ts src/expo-plugin.ts --format esm,cjs --dts --clean --sourcemap --platform neutral --external react-native --external promise/setimmediate/rejection-tracking",
55
+ "build": "tsup src/index.ts src/expo-plugin.ts --format esm,cjs --dts --clean --sourcemap --platform neutral --no-shims --external react --external react-native --external @react-navigation/native --external promise/setimmediate/rejection-tracking && tsup src/build/sourcemaps.ts --format esm,cjs --dts --sourcemap --platform node --out-dir dist/build && node scripts/post-build.mjs",
46
56
  "typecheck": "tsc --noEmit",
47
57
  "test": "node --test --test-concurrency=1 test/*.test.mjs"
48
58
  },
49
59
  "peerDependencies": {
60
+ "react": ">=16.8.0",
50
61
  "react-native": ">=0.70"
51
62
  },
52
63
  "peerDependenciesMeta": {
64
+ "react": {
65
+ "optional": false
66
+ },
53
67
  "react-native": {
54
68
  "optional": true
55
69
  }
56
70
  },
57
71
  "devDependencies": {
72
+ "@types/node": "^25.6.0",
73
+ "@types/react": "^18.3.28",
74
+ "react": "^18.3.1",
75
+ "react-test-renderer": "^18.3.1",
58
76
  "tsup": "^8.0.0",
59
77
  "typescript": "^5.3.0"
60
78
  }