@evolu/react-native 15.0.2 → 16.0.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.
Files changed (42) hide show
  1. package/dist/src/LockManager.d.ts.map +1 -1
  2. package/dist/src/LockManager.js +2 -0
  3. package/dist/src/Polyfills.d.ts.map +1 -1
  4. package/dist/src/Polyfills.js +7 -2
  5. package/dist/src/Task.d.ts +2 -1
  6. package/dist/src/Task.d.ts.map +1 -1
  7. package/dist/src/Task.js +5 -2
  8. package/dist/src/components/EvoluIdenticon.js +2 -2
  9. package/dist/src/exports/expo-sqlite.d.ts +2 -1
  10. package/dist/src/exports/expo-sqlite.d.ts.map +1 -1
  11. package/dist/src/exports/expo-sqlite.js +2 -8
  12. package/dist/src/shared.js +0 -47
  13. package/dist/src/sqlite-drivers/createExpoSqliteDriver.d.ts.map +1 -1
  14. package/dist/src/sqlite-drivers/createExpoSqliteDriver.js +1 -0
  15. package/package.json +11 -43
  16. package/src/ErrorUtils.d.ts +2 -1
  17. package/src/LockManager.test.ts +537 -0
  18. package/src/LockManager.ts +2 -0
  19. package/src/Polyfills.test.ts +623 -0
  20. package/src/Polyfills.ts +7 -2
  21. package/src/Task.test.ts +82 -0
  22. package/src/Task.ts +8 -3
  23. package/src/components/EvoluIdenticon.tsx +2 -2
  24. package/src/exports/expo-sqlite.ts +2 -9
  25. package/src/shared.ts +1 -50
  26. package/src/sqlite-drivers/createExpoSqliteDriver.ts +5 -1
  27. package/dist/src/createExpoDeps.d.ts +0 -1
  28. package/dist/src/createExpoDeps.d.ts.map +0 -1
  29. package/dist/src/createExpoDeps.js +0 -163
  30. package/dist/src/exports/bare-op-sqlite.d.ts +0 -1
  31. package/dist/src/exports/bare-op-sqlite.d.ts.map +0 -1
  32. package/dist/src/exports/bare-op-sqlite.js +0 -31
  33. package/dist/src/exports/expo-op-sqlite.d.ts +0 -1
  34. package/dist/src/exports/expo-op-sqlite.d.ts.map +0 -1
  35. package/dist/src/exports/expo-op-sqlite.js +0 -16
  36. package/dist/src/sqlite-drivers/createOpSqliteDriver.d.ts +0 -3
  37. package/dist/src/sqlite-drivers/createOpSqliteDriver.d.ts.map +0 -1
  38. package/dist/src/sqlite-drivers/createOpSqliteDriver.js +0 -119
  39. package/src/createExpoDeps.ts +0 -164
  40. package/src/exports/bare-op-sqlite.ts +0 -30
  41. package/src/exports/expo-op-sqlite.ts +0 -15
  42. package/src/sqlite-drivers/createOpSqliteDriver.ts +0 -76
@@ -1 +1 @@
1
- {"version":3,"file":"LockManager.d.ts","sourceRoot":"","sources":["../../src/LockManager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAyQH;;;;;GAKG;AACH,eAAO,MAAM,WAAW,EAAE,WAIzB,CAAC"}
1
+ {"version":3,"file":"LockManager.d.ts","sourceRoot":"","sources":["../../src/LockManager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA2QH;;;;;GAKG;AACH,eAAO,MAAM,WAAW,EAAE,WAIzB,CAAC"}
@@ -70,6 +70,7 @@ const createLockManagerPonyfill = ({ clientId = "in-memory-main-thread", } = {})
70
70
  }
71
71
  pendingRequest.signal?.removeEventListener("abort", pendingRequest.abort);
72
72
  pendingRequest.phase = "running";
73
+ // oxlint-disable-next-line unicorn/no-useless-promise-resolve-reject -- Normalizes generic T to Awaited<T> for the lock request contract.
73
74
  return Promise.resolve(pendingRequest.callback({ mode: pendingRequest.mode, name }));
74
75
  })
75
76
  .then((value) => {
@@ -144,6 +145,7 @@ const createLockManagerPonyfill = ({ clientId = "in-memory-main-thread", } = {})
144
145
  return Promise.reject(options.signal.reason);
145
146
  }
146
147
  if (options.ifAvailable && !canGrantImmediately(name, mode)) {
148
+ // oxlint-disable-next-line unicorn/no-useless-promise-resolve-reject -- Normalizes generic T to Awaited<T> for the lock request contract.
147
149
  return Promise.resolve().then(() => Promise.resolve(callback(null)));
148
150
  }
149
151
  return new Promise((resolve, reject) => {
@@ -1 +1 @@
1
- {"version":3,"file":"Polyfills.d.ts","sourceRoot":"","sources":["../../src/Polyfills.ts"],"names":[],"mappings":"AAmCA,qEAAqE;AACrE,eAAO,MAAM,gBAAgB,QAAO,IAKnC,CAAC"}
1
+ {"version":3,"file":"Polyfills.d.ts","sourceRoot":"","sources":["../../src/Polyfills.ts"],"names":[],"mappings":"AAkCA,qEAAqE;AACrE,eAAO,MAAM,gBAAgB,QAAO,IAKnC,CAAC"}
@@ -1,5 +1,4 @@
1
- /* eslint-disable @typescript-eslint/no-unsafe-member-access */
2
- /* eslint-disable @typescript-eslint/no-unsafe-call */
1
+ /* oxlint-disable typescript/no-unsafe-call, typescript/no-unsafe-member-access */
3
2
  import { installPolyfills as installCommonPolyfills } from "@evolu/common/polyfills";
4
3
  // @ts-expect-error Runtime polyfill package has no TypeScript declarations.
5
4
  import fromAsync from "array-from-async";
@@ -54,11 +53,13 @@ const installPromisePolyfills = () => {
54
53
  };
55
54
  const abortReasonBySignal = new WeakMap();
56
55
  const anyControllersBySignal = new WeakMap();
56
+ /* oxlint-disable evolu/no-unnecessary-global-this -- Patch the global object constructors even if realm lexical bindings shadow them. */
57
57
  const installAbortControllerPolyfills = () => {
58
58
  installAbortReasonPolyfill(globalThis.AbortController, globalThis.AbortSignal);
59
59
  installAbortSignalThrowIfAbortedPolyfill(globalThis.AbortSignal);
60
60
  installAbortSignalStaticMethods(globalThis.AbortController, globalThis.AbortSignal);
61
61
  };
62
+ /* oxlint-enable evolu/no-unnecessary-global-this */
62
63
  const installAbortReasonPolyfill = (abortController, abortSignal) => {
63
64
  if (!("reason" in abortSignal.prototype)) {
64
65
  Object.defineProperty(abortSignal.prototype, "reason", {
@@ -118,10 +119,12 @@ const installAbortSignalStaticMethods = (abortController, abortSignal) => {
118
119
  writable: true,
119
120
  value: (milliseconds) => {
120
121
  const controller = new abortController();
122
+ // oxlint-disable-next-line evolu/no-unnecessary-global-this -- Use the global object timer even if a realm lexical binding shadows it.
121
123
  const timeoutId = globalThis.setTimeout(() => {
122
124
  controller.abort(createTimeoutError(milliseconds));
123
125
  }, milliseconds);
124
126
  controller.signal.addEventListener("abort", () => {
127
+ // oxlint-disable-next-line evolu/no-unnecessary-global-this -- Clear the timer through the same global object API used to create it.
125
128
  globalThis.clearTimeout(timeoutId);
126
129
  }, { once: true });
127
130
  return controller.signal;
@@ -188,6 +191,7 @@ const createAnyControllersRegistry = (sourceSignal) => {
188
191
  sourceSignal.addEventListener("abort", onAbort, { once: true });
189
192
  return {
190
193
  add: (controller) => {
194
+ // oxlint-disable-next-line evolu/no-unnecessary-global-this -- Use the constructor on the global object even if a realm lexical binding shadows it.
191
195
  refs.push(new globalThis.WeakRef(controller));
192
196
  cleanup();
193
197
  },
@@ -211,6 +215,7 @@ const createAbortError = () => createNamedError("AbortError", "This operation wa
211
215
  const createNamedError = (name, message) => {
212
216
  if (typeof globalThis.DOMException === "function") {
213
217
  try {
218
+ // oxlint-disable-next-line evolu/no-unnecessary-global-this -- Construct the same global object DOMException verified by the feature check.
214
219
  return new globalThis.DOMException(message, name);
215
220
  }
216
221
  catch {
@@ -15,6 +15,7 @@ import { type DisposableRun, type RunCustomDeps } from "@evolu/common";
15
15
  *
16
16
  * ```ts
17
17
  * import {
18
+ * assertSame,
18
19
  * createConsole,
19
20
  * createConsoleFormatter,
20
21
  * ok,
@@ -30,7 +31,7 @@ import { type DisposableRun, type RunCustomDeps } from "@evolu/common";
30
31
  * await using run = createRun({ console });
31
32
  * const appPromise = run.ok(() => ok("started"));
32
33
  *
33
- * expect(await appPromise).toBe("started");
34
+ * assertSame(await appPromise, "started");
34
35
  * ```
35
36
  */
36
37
  export declare function createRun(): DisposableRun;
@@ -1 +1 @@
1
- {"version":3,"file":"Task.d.ts","sourceRoot":"","sources":["../../src/Task.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAGL,KAAK,aAAa,EAElB,KAAK,aAAa,EACnB,MAAM,eAAe,CAAC;AAEvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,SAAS,IAAI,aAAa,CAAC;AAE3C,4EAA4E;AAC5E,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EACxC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,GACrB,aAAa,CAAC,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"Task.d.ts","sourceRoot":"","sources":["../../src/Task.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAGL,KAAK,aAAa,EAElB,KAAK,aAAa,EACnB,MAAM,eAAe,CAAC;AAEvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,SAAS,IAAI,aAAa,CAAC;AAE3C,4EAA4E;AAC5E,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EACxC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,GACrB,aAAa,CAAC,CAAC,CAAC,CAAC"}
package/dist/src/Task.js CHANGED
@@ -6,10 +6,13 @@
6
6
  import { createRun as createCommonRun, reportDefectAfterMicrotask, } from "@evolu/common";
7
7
  export function createRun(deps) {
8
8
  const reportDefect = (reported) => {
9
- if (globalThis.ErrorUtils)
9
+ if (globalThis.ErrorUtils) {
10
+ // oxlint-disable-next-line evolu/no-unnecessary-global-this -- Report through the React Native host API on the global object even if a realm lexical binding shadows it.
10
11
  globalThis.ErrorUtils.reportError(reported);
11
- else
12
+ }
13
+ else {
12
14
  reportDefectAfterMicrotask(reported);
15
+ }
13
16
  };
14
17
  return deps === undefined
15
18
  ? createCommonRun({ reportDefect })
@@ -5,10 +5,10 @@ import { View } from "react-native";
5
5
  import { SvgXml } from "react-native-svg";
6
6
  export const EvoluIdenticon = ({ id, size = 32, borderRadius = 3, style }) => {
7
7
  const svg = useMemo(() => createIdenticon(id, style), [id, style]);
8
- return id ? (_jsx(View, { style: {
8
+ return (_jsx(View, { style: {
9
9
  width: size,
10
10
  height: size,
11
11
  borderRadius,
12
12
  overflow: "hidden",
13
- }, children: _jsx(SvgXml, { xml: svg, width: size, height: size }) })) : null;
13
+ }, children: _jsx(SvgXml, { xml: svg, width: size, height: size }) }));
14
14
  };
@@ -2,7 +2,8 @@
2
2
  * Public entry point for Expo SQLite. Exported as
3
3
  * "@evolu/react-native/expo-sqlite" in package.json.
4
4
  *
5
- * Use this with Expo projects that use expo-sqlite.
5
+ * Use this with Expo projects and existing React Native projects configured
6
+ * with Expo modules.
6
7
  */
7
8
  import type { ConsoleDep } from "@evolu/common";
8
9
  import type { EvoluDeps } from "@evolu/common/local-first";
@@ -1 +1 @@
1
- {"version":3,"file":"expo-sqlite.d.ts","sourceRoot":"","sources":["../../../src/exports/expo-sqlite.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAK3D,2CAA2C;AAC3C,eAAO,MAAM,eAAe,UAAU,OAAO,CAAC,UAAU,CAAC,KAAQ,SAO7D,CAAC"}
1
+ {"version":3,"file":"expo-sqlite.d.ts","sourceRoot":"","sources":["../../../src/exports/expo-sqlite.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAK3D,2CAA2C;AAC3C,eAAO,MAAM,eAAe,UAAU,OAAO,CAAC,UAAU,CAAC,KAAQ,SAO7D,CAAC"}
@@ -2,7 +2,8 @@
2
2
  * Public entry point for Expo SQLite. Exported as
3
3
  * "@evolu/react-native/expo-sqlite" in package.json.
4
4
  *
5
- * Use this with Expo projects that use expo-sqlite.
5
+ * Use this with Expo projects and existing React Native projects configured
6
+ * with Expo modules.
6
7
  */
7
8
  import * as Expo from "expo";
8
9
  import { createEvoluDeps as createSharedEvoluDeps } from "../shared.js";
@@ -15,10 +16,3 @@ export const createEvoluDeps = (deps = {}) => createSharedEvoluDeps({
15
16
  void Expo.reloadAppAsync();
16
17
  },
17
18
  });
18
- // import { createExpoDeps } from "../createExpoDeps.ts";
19
- // import { createExpoSqliteDriver } from "../sqlite-drivers/createExpoSqliteDriver.ts";
20
- //
21
- // // eslint-disable-next-line evolu/require-pure-annotation
22
- // export const { evoluReactNativeDeps, localAuth } = createExpoDeps({
23
- // createSqliteDriver: createExpoSqliteDriver,
24
- // });
@@ -108,50 +108,3 @@ export const createEvoluDeps = (deps) => {
108
108
  sharedWorker,
109
109
  });
110
110
  };
111
- // TODO: Reimplement local auth for React Native from scratch.
112
- // export const createSharedLocalAuth = (
113
- // secureStorage: SecureStorage,
114
- // ): LocalAuth =>
115
- // createLocalAuth({
116
- // randomBytes,
117
- // secureStorage,
118
- // });
119
- // import {
120
- // createConsole,
121
- // createLocalAuth,
122
- // createRandomBytes,
123
- // type CreateSqliteDriverDep,
124
- // type LocalAuth,
125
- // type ReloadAppDep,
126
- // type SecureStorage,
127
- // } from "@evolu/common";
128
- // import type {
129
- // // createDbWorkerForPlatform,
130
- // // createDbWorkerForPlatform,
131
- // EvoluDeps,
132
- // } from "@evolu/common/local-first";
133
- //
134
- // const _console = createConsole();
135
- // const randomBytes = createRandomBytes();
136
- //
137
- // export const createSharedEvoluDeps = (
138
- // _deps: CreateSqliteDriverDep & ReloadAppDep,
139
- // ): EvoluDeps => {
140
- // throw new Error("todo");
141
- // };
142
- //
143
- // ({
144
- // ...deps,
145
- // console,
146
- // sharedWorker: "TODO" as never,
147
- // // createDbWorker: () =>
148
- // // createDbWorkerForPlatform({
149
- // // ...deps,
150
- // // console,
151
- // // createWebSocket,
152
- // // random: createRandom(),
153
- // // randomBytes,
154
- // // time: createTime(),
155
- // // }),
156
- // randomBytes,
157
- // });
@@ -1 +1 @@
1
- {"version":3,"file":"createExpoSqliteDriver.d.ts","sourceRoot":"","sources":["../../../src/sqlite-drivers/createExpoSqliteDriver.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,kBAAkB,EAExB,MAAM,eAAe,CAAC;AAOvB,eAAO,MAAM,sBAAsB,EAAE,kBA2ElC,CAAC"}
1
+ {"version":3,"file":"createExpoSqliteDriver.d.ts","sourceRoot":"","sources":["../../../src/sqlite-drivers/createExpoSqliteDriver.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,kBAAkB,EAExB,MAAM,eAAe,CAAC;AAQvB,eAAO,MAAM,sBAAsB,EAAE,kBA8ElC,CAAC"}
@@ -70,6 +70,7 @@ export const createExpoSqliteDriver = (name, options) => () => {
70
70
  return ok({
71
71
  exec: (query) => {
72
72
  const execStatement = (statement) => {
73
+ // Expo only reads the array, but its parameter type is mutable.
73
74
  const result = statement.executeSync(query.parameters);
74
75
  try {
75
76
  const rows = result.getAllSync();
package/package.json CHANGED
@@ -1,12 +1,11 @@
1
1
  {
2
2
  "name": "@evolu/react-native",
3
- "version": "15.0.2",
3
+ "version": "16.0.1",
4
4
  "description": "Evolu for React Native and Expo",
5
5
  "keywords": [
6
6
  "evolu",
7
7
  "expo",
8
8
  "expo-sqlite",
9
- "op-sqlite",
10
9
  "react-native",
11
10
  "react-hooks"
12
11
  ],
@@ -37,18 +36,6 @@
37
36
  "react-native": "./dist/src/exports/expo-sqlite.js",
38
37
  "browser": "./dist/src/web.js",
39
38
  "default": "./dist/src/exports/expo-sqlite.js"
40
- },
41
- "./expo-op-sqlite": {
42
- "types": "./dist/src/exports/expo-op-sqlite.d.ts",
43
- "react-native": "./dist/src/exports/expo-op-sqlite.js",
44
- "browser": "./dist/src/web.js",
45
- "default": "./dist/src/exports/expo-op-sqlite.js"
46
- },
47
- "./bare-op-sqlite": {
48
- "types": "./dist/src/exports/bare-op-sqlite.d.ts",
49
- "react-native": "./dist/src/exports/bare-op-sqlite.js",
50
- "browser": "./dist/src/web.js",
51
- "default": "./dist/src/exports/bare-op-sqlite.js"
52
39
  }
53
40
  },
54
41
  "typesVersions": {
@@ -61,17 +48,12 @@
61
48
  ],
62
49
  "expo-sqlite": [
63
50
  "./dist/src/exports/expo-sqlite.d.ts"
64
- ],
65
- "expo-op-sqlite": [
66
- "./dist/src/exports/expo-op-sqlite.d.ts"
67
- ],
68
- "bare-op-sqlite": [
69
- "./dist/src/exports/bare-op-sqlite.d.ts"
70
51
  ]
71
52
  }
72
53
  },
73
54
  "files": [
74
55
  "dist/src/**",
56
+ "!dist/**/*.test.*",
75
57
  "src/**",
76
58
  "README.md"
77
59
  ],
@@ -89,58 +71,44 @@
89
71
  "set.prototype.union": "^1.1.3"
90
72
  },
91
73
  "devDependencies": {
92
- "@expo/dom-webview": "~57.0.0",
93
- "@op-engineering/op-sqlite": "^17.1.3",
74
+ "@evolu/common": "8.8.0",
75
+ "@evolu/react": "11.0.2",
76
+ "@evolu/typescript-config": "0.1.1",
77
+ "@expo/dom-webview": "57.0.1",
94
78
  "@react-native/metro-config": "0.86.2",
79
+ "@types/node": "^24.10.9",
95
80
  "@types/react": "^19.2.18",
96
81
  "@typescript/native": "npm:typescript@^7.0.2",
97
- "expo": "~57.0.9",
98
- "expo-secure-store": "~57.0.0",
99
- "expo-sqlite": "~57.0.0",
82
+ "expo": "57.0.15",
83
+ "expo-sqlite": "57.0.1",
100
84
  "react": "19.2.3",
101
85
  "react-native": "0.86.2",
102
86
  "react-native-nitro-modules": "0.36.5",
103
87
  "react-native-reanimated": "4.5.1",
104
- "react-native-sensitive-info": "6.1.5",
105
88
  "react-native-svg": "15.15.4",
106
89
  "react-native-worklets": "0.10.1",
107
- "typescript": "npm:@typescript/typescript6@^6.0.2",
108
- "@evolu/react": "11.0.1",
109
- "@evolu/typescript-config": "0.0.2",
110
- "@evolu/common": "8.3.0"
90
+ "typescript": "npm:@typescript/typescript6@^6.0.2"
111
91
  },
112
92
  "peerDependencies": {
113
93
  "@evolu/common": "^8.0.0",
114
94
  "@evolu/react": "^11.0.0",
115
- "@op-engineering/op-sqlite": ">=12",
116
95
  "expo": ">=55",
117
- "expo-secure-store": ">=55",
118
96
  "expo-sqlite": ">=55",
119
97
  "react": ">=19",
120
98
  "react-native": ">=0.83",
121
99
  "react-native-nitro-modules": ">=0.34",
122
- "react-native-sensitive-info": ">=6",
123
100
  "react-native-svg": ">=15.15"
124
101
  },
125
102
  "peerDependenciesMeta": {
126
- "@op-engineering/op-sqlite": {
127
- "optional": true
128
- },
129
103
  "expo": {
130
104
  "optional": true
131
105
  },
132
106
  "expo-sqlite": {
133
107
  "optional": true
134
108
  },
135
- "expo-secure-store": {
136
- "optional": true
137
- },
138
109
  "react-native-nitro-modules": {
139
110
  "optional": true
140
111
  },
141
- "react-native-sensitive-info": {
142
- "optional": true
143
- },
144
112
  "react-native-svg": {
145
113
  "optional": true
146
114
  }
@@ -149,7 +117,7 @@
149
117
  "access": "public"
150
118
  },
151
119
  "engines": {
152
- "node": ">=24.0.0"
120
+ "node": ">=24.20.0"
153
121
  },
154
122
  "sideEffects": false,
155
123
  "scripts": {
@@ -13,8 +13,9 @@ interface ErrorUtils {
13
13
  }
14
14
 
15
15
  declare global {
16
- // eslint-disable-next-line no-var
16
+ // var is required for a global declaration that matches the runtime binding.
17
17
  var ErrorUtils: ErrorUtils | undefined;
18
18
  }
19
19
 
20
+ // oxlint-disable-next-line unicorn/require-module-specifiers -- Marks this declaration file as a module so declare global is valid.
20
21
  export {};