@rootnode-app/react-native 0.1.0 → 0.1.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.
package/README.md CHANGED
@@ -8,8 +8,10 @@ queueing and sessions, person properties, push registration.
8
8
  npx expo install @rootnode-app/react-native
9
9
  ```
10
10
 
11
- > Includes a native crash engine — ship it with a new build (EAS), not an OTA
12
- > update.
11
+ > One command — the native engines arrive automatically (npm installs peer
12
+ > dependencies since v7). If expo-doctor reports a version mismatch with your
13
+ > Expo SDK, run `npx expo install --fix` once. Includes a native crash
14
+ > engine: ship with a new build (EAS), not an OTA update.
13
15
 
14
16
  ```tsx
15
17
  import { Rootnode } from '@rootnode-app/react-native';
package/dist/core.js CHANGED
@@ -1,17 +1,30 @@
1
1
  "use strict";
2
+ /**
3
+ * Platform-free core of the React Native SDK: queue + batching + retry,
4
+ * persisted across restarts, session rotation, anonymous→user identity.
5
+ * Everything platform-ish (AppState, expo modules, Sentry) is injected by
6
+ * the binding in index.ts — so this logic runs (and is tested) in plain node.
7
+ *
8
+ * Contract: nothing here ever throws into the host app.
9
+ */
2
10
  Object.defineProperty(exports, "__esModule", { value: true });
3
11
  exports.RootnodeCore = void 0;
4
- const crypto_1 = require("crypto");
5
12
  const QUEUE_KEY = 'rootnode.queue';
6
13
  const ID_KEY = 'rootnode.distinct_id';
7
14
  const QUEUE_CAP = 1000;
8
15
  const AUTO_FLUSH_AT = 20;
9
- const uuid = () => typeof crypto_1.randomUUID === 'function'
10
- ? (0, crypto_1.randomUUID)()
11
- : 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
16
+ // No Node builtins here — this file must bundle under Metro (React Native).
17
+ // Prefer the Web Crypto UUID when the runtime has one; fall back to a plain
18
+ // Math.random v4 (these are analytics ids, not secrets).
19
+ const uuid = () => {
20
+ const c = globalThis.crypto;
21
+ if (typeof c?.randomUUID === 'function')
22
+ return c.randomUUID();
23
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (ch) => {
12
24
  const r = (Math.random() * 16) | 0;
13
- return (c === 'x' ? r : (r & 0x3) | 0x8).toString(16);
25
+ return (ch === 'x' ? r : (r & 0x3) | 0x8).toString(16);
14
26
  });
27
+ };
15
28
  class RootnodeCore {
16
29
  constructor(cfg, deps) {
17
30
  this.cfg = cfg;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rootnode-app/react-native",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Rootnode for React Native / Expo apps: crash reporting, analytics, sessions and push registration — one install, one init.",
5
5
  "license": "MIT",
6
6
  "author": "Doğan Aktı",
@@ -19,19 +19,19 @@
19
19
  "scripts": {
20
20
  "build": "tsc -p tsconfig.build.json",
21
21
  "test": "vitest run",
22
- "prepublishOnly": "npm run test && npm run build"
22
+ "prepublishOnly": "npm run test && npm run build && npm run verify:bundle",
23
+ "verify:bundle": "esbuild dist/index.js --bundle --platform=browser --outfile=/dev/null --external:react-native --external:@sentry/react-native --external:expo-device --external:expo-notifications --external:expo-file-system --external:expo-file-system/legacy --external:expo-application --external:expo-updates --external:@react-native-async-storage/async-storage --log-level=error"
23
24
  },
24
- "dependencies": {
25
+ "peerDependencies": {
26
+ "react-native": "*",
25
27
  "@sentry/react-native": ">=5.0.0",
26
28
  "expo-device": "*",
27
29
  "expo-notifications": "*"
28
30
  },
29
- "peerDependencies": {
30
- "react-native": "*"
31
- },
32
31
  "devDependencies": {
33
32
  "@types/node": "^22.20.5",
34
33
  "typescript": "^5.9.3",
35
- "vitest": "^2.1.9"
34
+ "vitest": "^2.1.9",
35
+ "esbuild": "^0.24.0"
36
36
  }
37
37
  }