rn-inspector 0.1.6 → 0.2.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.
- package/README.md +62 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +984 -82
- package/dist/index.js.map +1 -1
- package/package.json +6 -4
- package/ui/assets/index-1MGE-7sm.js +166 -0
- package/{ui-dist → ui}/index.html +1 -1
- package/ui-dist/assets/index-DcrAH1Mf.js +0 -164
- /package/{ui-dist → ui}/Legend_moyai.png +0 -0
- /package/{ui-dist → ui}/assets/index-1KQqYNq3.css +0 -0
- /package/{ui-dist → ui}/banner.png +0 -0
- /package/{ui-dist → ui}/icon.png +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# rn-inspector CLI
|
|
2
2
|
|
|
3
|
-
> **Warning:** All versions **before `0.
|
|
3
|
+
> **Warning:** All versions **before `0.2.0`** had known issues (especially on macOS and DevTools reconnect behavior). Please upgrade and use the latest version `0.2.0` or newer. We’re sorry for the inconvenience.
|
|
4
4
|
|
|
5
5
|
`rn-inspector` is a small CLI + Web UI that helps you debug **React Native** apps by:
|
|
6
6
|
|
|
@@ -47,30 +47,38 @@ After installing, the `rn-inspector` command is available in your shell.
|
|
|
47
47
|
## CLI usage
|
|
48
48
|
|
|
49
49
|
```bash
|
|
50
|
-
rn-inspector
|
|
50
|
+
rn-inspector \
|
|
51
|
+
[--port 8081 | --port=8081] \
|
|
52
|
+
[--ui-port 4173 | --ui-port=4173] \
|
|
53
|
+
[--ui-ws-port 9230 | --ui-ws-port=9230] \
|
|
54
|
+
[--devtools-url ws://...] \
|
|
55
|
+
[--version | -v | version]
|
|
51
56
|
```
|
|
52
57
|
|
|
53
58
|
### Options
|
|
54
59
|
|
|
55
|
-
- `--port=<number>`
|
|
60
|
+
- `--port <number>` / `--port=<number>`
|
|
56
61
|
- Metro port to connect to.
|
|
57
62
|
- Default: `8081`.
|
|
58
63
|
- This is also affected by the `METRO_PORT` environment variable (see below).
|
|
59
64
|
|
|
60
|
-
- `--ui-port=<number>`
|
|
65
|
+
- `--ui-port <number>` / `--ui-port=<number>`
|
|
61
66
|
- HTTP port where the Web UI is served.
|
|
62
67
|
- Default: `4173`.
|
|
63
68
|
- The UI will be available at `http://localhost:<ui-port>`.
|
|
64
69
|
|
|
65
|
-
- `--ui-ws-port=<number>`
|
|
70
|
+
- `--ui-ws-port <number>` / `--ui-ws-port=<number>`
|
|
66
71
|
- WebSocket port used between the CLI proxy and the Web UI.
|
|
67
72
|
- Default: `9230`.
|
|
68
73
|
- The UI connects to `ws://localhost:<ui-ws-port>/inspector`.
|
|
69
74
|
|
|
70
|
-
- `--devtools-url=<ws-url>`
|
|
75
|
+
- `--devtools-url <ws-url>` / `--devtools-url=<ws-url>`
|
|
71
76
|
- Explicit DevTools websocket URL to attach to (for advanced usage).
|
|
72
77
|
- If omitted, `rn-inspector` will **auto-discover** DevTools targets via `http://<host>:<port>/json` on a range of ports (starting around the Metro port) and attach to all matching targets.
|
|
73
78
|
|
|
79
|
+
- `--version`, `-v`, `version`
|
|
80
|
+
- Print the `rn-inspector` CLI version and exit without starting the proxy.
|
|
81
|
+
|
|
74
82
|
### Environment variables
|
|
75
83
|
|
|
76
84
|
- `METRO_PORT`
|
|
@@ -116,14 +124,59 @@ The UI includes:
|
|
|
116
124
|
- Live console logs from Metro and DevTools.
|
|
117
125
|
- Level filters (log/info/warn/error).
|
|
118
126
|
- Detail drawer with copy-to-clipboard and timestamps.
|
|
127
|
+
- Glassy search bar and Clear action in the header to filter and reset the current view.
|
|
119
128
|
|
|
120
129
|
- **Network** page
|
|
121
130
|
- HTTP requests captured via an injected fetch wrapper / DevTools Network domain.
|
|
122
131
|
- Detail drawer with headers, payload, and response preview (including text, JSON, images, and some binary types).
|
|
132
|
+
- Glassy search bar and Clear action in the header to filter by URL/method/status and reset the current view.
|
|
123
133
|
|
|
124
134
|
- **Header controls**
|
|
125
135
|
- Global **device selector** (backed by the `deviceId` tagging in the CLI).
|
|
126
136
|
- Global **capture toggles** for Console and Network streams.
|
|
137
|
+
- Global **proxy WS status chip** (shows connection status and basic stats; click to reconnect when disconnected).
|
|
138
|
+
- Global **DevTools status chip** (shows connected/closed/error and lets you request a DevTools reconnect from the UI).
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Storage & Redux inspection
|
|
143
|
+
|
|
144
|
+
The **Storage** page lets you inspect:
|
|
145
|
+
|
|
146
|
+
- **AsyncStorage** key/value pairs.
|
|
147
|
+
- **Redux** state (if you are using Redux).
|
|
148
|
+
|
|
149
|
+
To keep the CLI simple and avoid depending on your bundler setup, you need to expose these on the global object in your app:
|
|
150
|
+
|
|
151
|
+
### AsyncStorage
|
|
152
|
+
|
|
153
|
+
In your React Native app (for example in `App.tsx`):
|
|
154
|
+
|
|
155
|
+
```ts
|
|
156
|
+
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
157
|
+
|
|
158
|
+
// Make AsyncStorage visible to rn-inspector storage helper
|
|
159
|
+
(global as any).AsyncStorage = AsyncStorage;
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Once this is set and the app is running with DevTools debugging enabled, the Storage page's **AsyncStorage** panel will show your keys and values.
|
|
163
|
+
|
|
164
|
+
### Redux store
|
|
165
|
+
|
|
166
|
+
If you use Redux, expose your store after you create it (anywhere in your app setup):
|
|
167
|
+
|
|
168
|
+
```ts
|
|
169
|
+
import { createStore } from 'redux';
|
|
170
|
+
|
|
171
|
+
const store = createStore(reducer);
|
|
172
|
+
|
|
173
|
+
// Expose Redux store for rn-inspector
|
|
174
|
+
(global as any).__RN_INSPECTOR_REDUX_STORE__ = store;
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
The Storage page's **Redux State** panel will then show `store.getState()` and update as your state changes.
|
|
178
|
+
|
|
179
|
+
If you do not expose these globals, the Storage page will show a helpful message explaining what to add in your app.
|
|
127
180
|
|
|
128
181
|
---
|
|
129
182
|
|
|
@@ -149,8 +202,9 @@ If the terminal does not support raw mode (no TTY), these shortcuts are safely d
|
|
|
149
202
|
|
|
150
203
|
- If the **Metro websocket** closes or errors, the CLI logs a message and sends a small `meta` event to the UI so you can see the status.
|
|
151
204
|
- For **DevTools websockets** (one per device):
|
|
152
|
-
- The CLI
|
|
153
|
-
-
|
|
205
|
+
- The CLI emits `devtools` **status meta events** (`open`, `closed`, `error`) but does **not** auto-retry reconnecting.
|
|
206
|
+
- The Web UI header exposes a **DevTools status chip**; clicking it sends a control message to the CLI to re-run DevTools discovery and attach again.
|
|
207
|
+
- When DevTools auto-discovery finds no `/json` targets, the CLI logs a message *and* emits a warning `meta` event so the UI can surface a toast like “DevTools auto-discovery found no /json targets (falling back to Metro-only mode)”.
|
|
154
208
|
|
|
155
209
|
---
|
|
156
210
|
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAw0DA,wBAAsB,IAAI,kBA4BzB"}
|