@buoy-gg/redux 7.0.5 → 7.0.7

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 (45) hide show
  1. package/README.md +21 -2
  2. package/lib/commonjs/index.js +38 -0
  3. package/lib/commonjs/redux/components/ReduxAutoInstrument.js +20 -0
  4. package/lib/commonjs/redux/components/ReduxModal.js +11 -1
  5. package/lib/commonjs/redux/components/index.js +8 -1
  6. package/lib/commonjs/redux/hooks/useAutoInstrumentRedux.js +32 -42
  7. package/lib/commonjs/redux/sync/reduxSyncAdapter.js +27 -8
  8. package/lib/commonjs/redux/utils/activeStoreRegistry.js +73 -0
  9. package/lib/commonjs/redux/utils/autoInstrument.js +88 -114
  10. package/lib/commonjs/redux/utils/buoyReduxMiddleware.js +20 -15
  11. package/lib/commonjs/redux/utils/devtoolsHook.js +137 -0
  12. package/lib/commonjs/redux/utils/index.js +32 -1
  13. package/lib/module/index.js +26 -3
  14. package/lib/module/redux/components/ReduxAutoInstrument.js +17 -0
  15. package/lib/module/redux/components/ReduxModal.js +11 -1
  16. package/lib/module/redux/components/index.js +2 -1
  17. package/lib/module/redux/hooks/useAutoInstrumentRedux.js +33 -43
  18. package/lib/module/redux/sync/reduxSyncAdapter.js +28 -9
  19. package/lib/module/redux/utils/activeStoreRegistry.js +63 -0
  20. package/lib/module/redux/utils/autoInstrument.js +82 -113
  21. package/lib/module/redux/utils/buoyReduxMiddleware.js +20 -15
  22. package/lib/module/redux/utils/devtoolsHook.js +130 -0
  23. package/lib/module/redux/utils/index.js +3 -1
  24. package/lib/typescript/index.d.ts +18 -4
  25. package/lib/typescript/index.d.ts.map +1 -1
  26. package/lib/typescript/redux/components/ReduxAutoInstrument.d.ts +11 -0
  27. package/lib/typescript/redux/components/ReduxAutoInstrument.d.ts.map +1 -0
  28. package/lib/typescript/redux/components/ReduxModal.d.ts.map +1 -1
  29. package/lib/typescript/redux/components/index.d.ts +1 -0
  30. package/lib/typescript/redux/components/index.d.ts.map +1 -1
  31. package/lib/typescript/redux/hooks/useAutoInstrumentRedux.d.ts +16 -28
  32. package/lib/typescript/redux/hooks/useAutoInstrumentRedux.d.ts.map +1 -1
  33. package/lib/typescript/redux/sync/reduxSyncAdapter.d.ts +18 -4
  34. package/lib/typescript/redux/sync/reduxSyncAdapter.d.ts.map +1 -1
  35. package/lib/typescript/redux/utils/activeStoreRegistry.d.ts +47 -0
  36. package/lib/typescript/redux/utils/activeStoreRegistry.d.ts.map +1 -0
  37. package/lib/typescript/redux/utils/autoInstrument.d.ts +46 -23
  38. package/lib/typescript/redux/utils/autoInstrument.d.ts.map +1 -1
  39. package/lib/typescript/redux/utils/buoyReduxMiddleware.d.ts +5 -1
  40. package/lib/typescript/redux/utils/buoyReduxMiddleware.d.ts.map +1 -1
  41. package/lib/typescript/redux/utils/devtoolsHook.d.ts +45 -0
  42. package/lib/typescript/redux/utils/devtoolsHook.d.ts.map +1 -0
  43. package/lib/typescript/redux/utils/index.d.ts +3 -2
  44. package/lib/typescript/redux/utils/index.d.ts.map +1 -1
  45. package/package.json +8 -5
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Store-creation-time capture via the OFFICIAL Redux DevTools hook.
3
+ *
4
+ * `configureStore` defaults `devTools: true` and, at RTK module-evaluation
5
+ * time, snapshots `window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__` if defined.
6
+ * That global doesn't exist in React Native — so Buoy claims it (dev builds
7
+ * only, and only when nothing else has). This makes Buoy a real store
8
+ * ENHANCER, present from the store's birth:
9
+ *
10
+ * - FULL capture: actions dispatched from inside middleware/thunks (RTK
11
+ * `pending`/`fulfilled`/`rejected`, RTK Query) hit our dispatch because the
12
+ * enhancer sits BELOW applyMiddleware in the compose chain.
13
+ * - Real time travel: we wrap the reducer, so BUOY_JUMP_TO_STATE actually
14
+ * jumps — and replaceReducer is re-wrapped, so hosts that inject reducers
15
+ * dynamically keep working.
16
+ * - Nothing is monkey-patched: this is the integration point Redux itself
17
+ * ships for devtools (same one react-native-debugger used).
18
+ *
19
+ * Race note: RTK snapshots the global when ITS module first evaluates, so this
20
+ * module must load before `@reduxjs/toolkit` does. `@buoy-gg/core` requires us
21
+ * at module scope, which usually wins; when it doesn't, the dispatch-patch
22
+ * fallback in autoInstrument.ts still binds at first mount. Apps that want a
23
+ * guarantee put `import '@buoy-gg/redux';` as the FIRST import of their entry.
24
+ */
25
+ type AnyReducer = (state: any, action: any) => any;
26
+ type AnyCreateStore = (reducer: AnyReducer, preloadedState?: unknown) => any;
27
+ /**
28
+ * The Buoy store enhancer. Innermost in the compose chain (below
29
+ * applyMiddleware), so every action that reaches the reducer — including ones
30
+ * dispatched from inside middleware and thunks — passes through here.
31
+ */
32
+ export declare const buoyDevtoolsEnhancer: (createStore: AnyCreateStore) => (reducer: AnyReducer, preloadedState?: unknown) => any;
33
+ /**
34
+ * Claim the DevTools globals — dev builds only, and never over an existing
35
+ * claimant (e.g. the real browser extension on web).
36
+ *
37
+ * Idempotent; runs at module scope so simply importing `@buoy-gg/redux` (which
38
+ * `@buoy-gg/core` does at module scope) performs the claim as early as
39
+ * possible.
40
+ */
41
+ export declare function claimDevtoolsHook(): boolean;
42
+ /** Whether Buoy owns the DevTools compose global (i.e. won the load race). */
43
+ export declare function isDevtoolsHookClaimed(): boolean;
44
+ export {};
45
+ //# sourceMappingURL=devtoolsHook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devtoolsHook.d.ts","sourceRoot":"","sources":["../../../../src/redux/utils/devtoolsHook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAOH,KAAK,UAAU,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,KAAK,GAAG,CAAC;AACnD,KAAK,cAAc,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,cAAc,CAAC,EAAE,OAAO,KAAK,GAAG,CAAC;AA+B7E;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAC9B,aAAa,cAAc,MAC3B,SAAS,UAAU,EAAE,iBAAiB,OAAO,QAgC7C,CAAC;AAuBJ;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAc3C;AAED,8EAA8E;AAC9E,wBAAgB,qBAAqB,IAAI,OAAO,CAE/C"}
@@ -1,6 +1,7 @@
1
1
  export { reduxActionStore } from "./reduxActionStore";
2
2
  export { buoyReduxMiddleware, createBuoyReduxMiddleware, withBuoyDevTools, jumpToState, replayAction, BUOY_JUMP_TO_STATE, BUOY_REPLAY_ACTION, } from "./buoyReduxMiddleware";
3
3
  export { createReduxHistoryAdapter, reduxHistoryAdapter, type ReduxHistoryAdapterOptions, } from "./createReduxHistoryAdapter";
4
- export { instrumentStore, uninstrumentStore, isStoreInstrumented, isAutoInstrumentActive, getActiveStore, jumpToState as autoJumpToState, replayAction as autoReplayAction, } from "./autoInstrument";
5
- export type { AutoInstrumentOptions } from "./autoInstrument";
4
+ export { instrumentStore, uninstrumentStore, isStoreInstrumented, isAutoInstrumentActive, getActiveStore, getInstrumentationStatus, registerReduxStore, jumpToState as autoJumpToState, replayAction as autoReplayAction, } from "./autoInstrument";
5
+ export type { AutoInstrumentOptions, InstrumentationStatus, CaptureMechanism, } from "./autoInstrument";
6
+ export { buoyDevtoolsEnhancer, claimDevtoolsHook, isDevtoolsHookClaimed, } from "./devtoolsHook";
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/redux/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,KAAK,0BAA0B,GAChC,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,cAAc,EACd,WAAW,IAAI,eAAe,EAC9B,YAAY,IAAI,gBAAgB,GACjC,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/redux/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,KAAK,0BAA0B,GAChC,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,cAAc,EACd,wBAAwB,EACxB,kBAAkB,EAClB,WAAW,IAAI,eAAe,EAC9B,YAAY,IAAI,gBAAgB,GACjC,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buoy-gg/redux",
3
- "version": "7.0.5",
3
+ "version": "7.0.7",
4
4
  "description": "Redux DevTools inside your React Native app — action log, state diffs & time travel with zero store changes. Part of Buoy devtools.",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -24,11 +24,14 @@
24
24
  "files": [
25
25
  "lib"
26
26
  ],
27
- "sideEffects": false,
27
+ "sideEffects": [
28
+ "**/devtoolsHook.js",
29
+ "**/devtoolsHook.ts"
30
+ ],
28
31
  "dependencies": {
29
- "@buoy-gg/shared-ui": "7.0.5",
30
- "@buoy-gg/license": "7.0.5",
31
- "@buoy-gg/floating-tools-core": "7.0.5"
32
+ "@buoy-gg/license": "7.0.7",
33
+ "@buoy-gg/floating-tools-core": "7.0.7",
34
+ "@buoy-gg/shared-ui": "7.0.7"
32
35
  },
33
36
  "peerDependencies": {
34
37
  "@reduxjs/toolkit": ">=1.9.0",