@drakkar.software/starfish-client 1.18.0 → 1.19.0

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,5 +1,6 @@
1
1
  import { type StoreApi } from "zustand/vanilla";
2
- import { type StateStorage, type DevtoolsOptions } from "zustand/middleware";
2
+ import { type StateStorage } from "zustand/middleware";
3
+ import type { DevtoolsOptions } from "zustand/middleware";
3
4
  import { SyncManager } from "../sync.js";
4
5
  import type { AuthProvider, ConflictResolver } from "../types.js";
5
6
  import type { SyncLogger } from "../logger.js";
@@ -26,8 +27,16 @@ export interface CreateStarfishStoreOptions {
26
27
  syncManager: SyncManager;
27
28
  /** Pass `false` to disable persistence. Defaults to `localStorage` in browsers. */
28
29
  storage?: StateStorage | false;
29
- /** Enable Redux DevTools. Pass `true` or a `DevtoolsOptions` object. */
30
- devtools?: boolean | DevtoolsOptions;
30
+ /**
31
+ * Wrap the store with Redux DevTools. Import `devtools` from `'zustand/middleware'`
32
+ * and pass it directly — this keeps the import in your code, preventing
33
+ * `import.meta.env` from being bundled in Metro/Hermes environments.
34
+ *
35
+ * @example
36
+ * import { devtools } from 'zustand/middleware'
37
+ * createStarfishStore({ devtools: (fn) => devtools(fn, { name: 'my-app' }) })
38
+ */
39
+ devtools?: (storeCreator: any) => any;
31
40
  /** Pass `produce` from `immer` to enable draft-based mutations in `set()`. */
32
41
  produce?: <T>(base: T, recipe: (draft: T) => T | void) => T;
33
42
  /**
@@ -1,6 +1,6 @@
1
1
  import { createStore } from "zustand/vanilla";
2
2
  import { useStore } from "zustand";
3
- import { persist, devtools, subscribeWithSelector, createJSONStorage, } from "zustand/middleware";
3
+ import { persist, subscribeWithSelector, createJSONStorage, } from "zustand/middleware";
4
4
  import { useEffect, useRef, useState, useCallback } from "react";
5
5
  import { StarfishClient } from "../client.js";
6
6
  import { SyncManager } from "../sync.js";
@@ -75,13 +75,7 @@ export function createStarfishStore(options) {
75
75
  }),
76
76
  });
77
77
  const withSelector = subscribeWithSelector(withPersist);
78
- if (options.devtools) {
79
- const devtoolsOpts = typeof options.devtools === "object"
80
- ? options.devtools
81
- : { name: `starfish-${name}` };
82
- return createStore()(devtools(withSelector, devtoolsOpts));
83
- }
84
- return createStore()(withSelector);
78
+ return createStore()(options.devtools ? options.devtools(withSelector) : withSelector);
85
79
  }
86
80
  /** Derive a single sync status from store state. */
87
81
  export function deriveSyncStatus(state) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drakkar.software/starfish-client",
3
- "version": "1.18.0",
3
+ "version": "1.19.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/Drakkar-Software/starfish.git",
@@ -69,7 +69,7 @@
69
69
  },
70
70
  "dependencies": {
71
71
  "@noble/curves": "^2.2.0",
72
- "@drakkar.software/starfish-protocol": "1.18.0"
72
+ "@drakkar.software/starfish-protocol": "1.18.1"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@legendapp/state": "^2.0.0",