reactoradar 1.5.6 → 1.5.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 (3) hide show
  1. package/README.md +26 -0
  2. package/bin/setup.js +32 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -145,6 +145,32 @@ npx reactoradar remove
145
145
  - Deep equality comparison (no false positives from reference changes)
146
146
  - Time travel with ◀ ▶ navigation
147
147
 
148
+ ### Redux Setup
149
+
150
+ `npx reactoradar setup` auto-detects Redux and patches your store. If it can't auto-patch, add manually:
151
+
152
+ **Redux Toolkit (configureStore):**
153
+ ```js
154
+ // In your store file (e.g. src/store/store.ts)
155
+ import { configureStore } from '@reduxjs/toolkit';
156
+
157
+ export const store = configureStore({
158
+ reducer: rootReducer,
159
+ middleware: (getDefaultMiddleware) =>
160
+ __DEV__
161
+ ? getDefaultMiddleware().concat(require('../debug/RNDebugSDK').reduxMiddleware)
162
+ : getDefaultMiddleware(),
163
+ });
164
+ ```
165
+
166
+ **Legacy Redux (createStore):**
167
+ ```js
168
+ import { reduxEnhancer } from '../debug/RNDebugSDK';
169
+ const store = createStore(reducer, __DEV__ ? reduxEnhancer : undefined);
170
+ ```
171
+
172
+ > **Note:** The import path is relative from your store file to `src/debug/RNDebugSDK`. Adjust if your store is in a different directory. Run `npx reactoradar setup` to auto-detect the correct path.
173
+
148
174
  ## Themes
149
175
 
150
176
  9 built-in themes: **Dark** (default), **Light**, **Monokai**, **Dracula**, **Solarized Dark**, **Solarized Light**, **Nord**, **GitHub Dark**, **One Dark**
package/bin/setup.js CHANGED
@@ -242,7 +242,38 @@ ${SDK_MARKER_END}
242
242
  if (!relSDK.startsWith('.')) relSDK = './' + relSDK;
243
243
 
244
244
  if (storeContent.includes('RNDebugSDK')) {
245
- log('Redux store already has RNDebugSDK wiredskipping');
245
+ // Check if the require path is correct fix stale/wrong paths from older setup versions
246
+ const wrongPathRe = /require\(['"]([^'"]*RNDebugSDK[^'"]*)['"]\)/g;
247
+ let hasWrongPath = false;
248
+ let fixedContent = storeContent;
249
+ let match;
250
+ while ((match = wrongPathRe.exec(storeContent)) !== null) {
251
+ const existingPath = match[1];
252
+ // Normalize: strip .js extension for comparison
253
+ const normalizedExisting = existingPath.replace(/\.js$/, '');
254
+ const normalizedExpected = relSDK.replace(/\.js$/, '');
255
+ if (normalizedExisting !== normalizedExpected) {
256
+ hasWrongPath = true;
257
+ fixedContent = fixedContent.replace(match[0], `require('${relSDK}')`);
258
+ }
259
+ }
260
+ // Also fix import statements
261
+ const wrongImportRe = /from\s+['"]([^'"]*RNDebugSDK[^'"]*)['"]/g;
262
+ while ((match = wrongImportRe.exec(storeContent)) !== null) {
263
+ const existingPath = match[1];
264
+ const normalizedExisting = existingPath.replace(/\.js$/, '');
265
+ const normalizedExpected = relSDK.replace(/\.js$/, '');
266
+ if (normalizedExisting !== normalizedExpected) {
267
+ hasWrongPath = true;
268
+ fixedContent = fixedContent.replace(match[0], `from '${relSDK}'`);
269
+ }
270
+ }
271
+ if (hasWrongPath) {
272
+ fs.writeFileSync(storePath, fixedContent);
273
+ log('Fixed stale SDK path in', C.bold + storeFile + C.reset, '→', C.cyan + relSDK + C.reset);
274
+ } else {
275
+ log('Redux store already has RNDebugSDK wired correctly — skipping');
276
+ }
246
277
  } else if (storeContent.includes('configureStore')) {
247
278
  // RTK configureStore
248
279
  // Try to add middleware to configureStore
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "reactoradar",
3
3
  "productName": "ReactoRadar",
4
- "version": "1.5.6",
4
+ "version": "1.5.7",
5
5
  "description": "macOS debugger for React Native — Console, Sources, Network, Performance, Memory, Redux, AsyncStorage, React tree. Supports RN 0.74+ with Hermes and New Architecture.",
6
6
  "main": "main.js",
7
7
  "bin": {