@concavejs/devtools 0.0.1-alpha.4
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 +263 -0
- package/dist/client-D6NyDOCN.js +2781 -0
- package/dist/client.d.ts +7 -0
- package/dist/client.js +5 -0
- package/dist/extension/page-agent.d.ts +8 -0
- package/dist/extension/panel.d.ts +14 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +380 -0
- package/dist/interceptor/index.d.ts +5 -0
- package/dist/interceptor/websocket-interceptor.d.ts +67 -0
- package/dist/overlay/ActivityPanel.d.ts +10 -0
- package/dist/overlay/ContextMenu.d.ts +23 -0
- package/dist/overlay/DataInspector.d.ts +12 -0
- package/dist/overlay/DevToolbar.d.ts +11 -0
- package/dist/overlay/LogsPanel.d.ts +10 -0
- package/dist/overlay/NetworkPanel.d.ts +9 -0
- package/dist/overlay/PerformancePanel.d.ts +10 -0
- package/dist/overlay/SearchField.d.ts +9 -0
- package/dist/overlay/SettingsPanel.d.ts +9 -0
- package/dist/overlay/SubscriptionsPanel.d.ts +9 -0
- package/dist/overlay/TimelinePanel.d.ts +9 -0
- package/dist/overlay/utils.d.ts +16 -0
- package/dist/standalone.d.ts +11 -0
- package/dist/store/event-store.d.ts +165 -0
- package/dist/store/safe-storage.d.ts +7 -0
- package/dist/types.d.ts +146 -0
- package/dist/version.d.ts +10 -0
- package/dist/vite-plugin/index.d.ts +16 -0
- package/dist/vite-plugin.js +544 -0
- package/package.json +62 -0
package/README.md
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
# Concave DevTools
|
|
2
|
+
|
|
3
|
+
Professional development tools for Convex/Concave applications. A high-signal browser DevTools focused on operation debugging, subscriptions, logs, and performance.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
### 🔎 Activity Panel
|
|
8
|
+
- Unified list of queries, mutations, and actions
|
|
9
|
+
- Fast filter/search with keyboard navigation
|
|
10
|
+
- Search across function path, IDs, args, results, errors, and log lines
|
|
11
|
+
- Incremental history loading for long sessions
|
|
12
|
+
- Arguments and results inspection
|
|
13
|
+
- Inline error visibility with focused details pane
|
|
14
|
+
|
|
15
|
+
### 📈 Performance Monitoring
|
|
16
|
+
- Average and P95 latency metrics
|
|
17
|
+
- Slowest operations tracking
|
|
18
|
+
- Queries, mutations, and actions statistics
|
|
19
|
+
- Performance trend analysis
|
|
20
|
+
- Click-through from slow operations to full Activity details
|
|
21
|
+
|
|
22
|
+
### 📡 Subscriptions Panel
|
|
23
|
+
- Live subscribed query tracking
|
|
24
|
+
- Update counts, status, and component context
|
|
25
|
+
|
|
26
|
+
### 📝 Logs Panel
|
|
27
|
+
- Centralized console logs from all functions
|
|
28
|
+
- Filter by log level (log, info, warn, error)
|
|
29
|
+
- Auto-scroll and search
|
|
30
|
+
- Search by related operation path/ID
|
|
31
|
+
- Related event tracking
|
|
32
|
+
|
|
33
|
+
### ⚙️ Settings & Advanced Features
|
|
34
|
+
- **Pause/Resume Recording**: Control when events are captured
|
|
35
|
+
- **Export/Import Sessions**: Save and share debugging sessions
|
|
36
|
+
- **Time-Travel Debugging**: Create snapshots and restore state
|
|
37
|
+
- **Persistent Storage**: Events persist across page reloads
|
|
38
|
+
- **Keyboard Shortcuts**: Fast access to all features
|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm install @concavejs/devtools
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
### Vite Plugin
|
|
49
|
+
|
|
50
|
+
Add the devtools plugin to your `vite.config.ts`:
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
import { defineConfig } from "vite";
|
|
54
|
+
import { concaveDevTools } from "@concavejs/devtools/vite";
|
|
55
|
+
|
|
56
|
+
export default defineConfig({
|
|
57
|
+
plugins: [
|
|
58
|
+
concaveDevTools({
|
|
59
|
+
// Only enable in development (default: true in dev mode)
|
|
60
|
+
enabled: true,
|
|
61
|
+
|
|
62
|
+
// Position of the devtools overlay
|
|
63
|
+
position: "bottom-right", // "bottom-right" | "bottom-left" | "top-right" | "top-left"
|
|
64
|
+
}),
|
|
65
|
+
],
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
That's it! The devtools will automatically initialize when your app loads in development mode.
|
|
70
|
+
|
|
71
|
+
### Manual Installation (without Vite plugin)
|
|
72
|
+
|
|
73
|
+
If you're not using Vite or want manual control:
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
import { initDevTools } from "@concavejs/devtools/client";
|
|
77
|
+
|
|
78
|
+
// Initialize devtools
|
|
79
|
+
initDevTools({
|
|
80
|
+
position: "bottom-right",
|
|
81
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Keyboard Shortcuts
|
|
85
|
+
|
|
86
|
+
- **Cmd/Ctrl + Shift + D**: Toggle DevTools
|
|
87
|
+
- **Cmd/Ctrl + K**: Focus search
|
|
88
|
+
- **Cmd/Ctrl + E**: Export session
|
|
89
|
+
- **Cmd/Ctrl + P**: Pause/Resume recording
|
|
90
|
+
|
|
91
|
+
## API
|
|
92
|
+
|
|
93
|
+
### Event Store
|
|
94
|
+
|
|
95
|
+
The devtools use a global event store that you can access programmatically:
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
import { getGlobalEventStore } from "@concavejs/devtools";
|
|
99
|
+
|
|
100
|
+
const store = getGlobalEventStore();
|
|
101
|
+
|
|
102
|
+
// Subscribe to events
|
|
103
|
+
const unsubscribe = store.subscribe((event) => {
|
|
104
|
+
console.log("New event:", event);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
// Get all events
|
|
108
|
+
const events = store.getAllEvents();
|
|
109
|
+
|
|
110
|
+
// Get events by type
|
|
111
|
+
const queries = store.getEventsByType("query");
|
|
112
|
+
|
|
113
|
+
// Get active subscriptions
|
|
114
|
+
const subscriptions = store.getActiveSubscriptions();
|
|
115
|
+
|
|
116
|
+
// Get performance metrics
|
|
117
|
+
const metrics = store.getPerformanceMetrics();
|
|
118
|
+
|
|
119
|
+
// Export session
|
|
120
|
+
const session = store.exportSession();
|
|
121
|
+
|
|
122
|
+
// Import session
|
|
123
|
+
store.importSession(session);
|
|
124
|
+
|
|
125
|
+
// Pause/Resume
|
|
126
|
+
store.pause();
|
|
127
|
+
store.resume();
|
|
128
|
+
|
|
129
|
+
// Clear all data
|
|
130
|
+
store.clear();
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### WebSocket Interceptor
|
|
134
|
+
|
|
135
|
+
The devtools automatically intercept WebSocket communication with the Convex/Concave backend. You can also use the interceptor directly:
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
import { WebSocketInterceptor, EventStore } from "@concavejs/devtools";
|
|
139
|
+
|
|
140
|
+
const eventStore = new EventStore();
|
|
141
|
+
const interceptor = new WebSocketInterceptor(eventStore);
|
|
142
|
+
|
|
143
|
+
// Install the interceptor
|
|
144
|
+
interceptor.install();
|
|
145
|
+
|
|
146
|
+
// Uninstall when done
|
|
147
|
+
interceptor.uninstall();
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Components
|
|
151
|
+
|
|
152
|
+
You can use the devtools components in your own React application:
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
import { DevToolbar } from "@concavejs/devtools";
|
|
156
|
+
import { getGlobalEventStore } from "@concavejs/devtools";
|
|
157
|
+
|
|
158
|
+
function MyApp() {
|
|
159
|
+
const eventStore = getGlobalEventStore();
|
|
160
|
+
|
|
161
|
+
return <DevToolbar eventStore={eventStore} position="bottom-right" />;
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Session Management
|
|
166
|
+
|
|
167
|
+
### Export Session
|
|
168
|
+
|
|
169
|
+
Export your debugging session to share with team members or for later analysis:
|
|
170
|
+
|
|
171
|
+
1. Open DevTools
|
|
172
|
+
2. Click the 💾 button or press **Cmd/Ctrl + E**
|
|
173
|
+
3. Save the `.json` file
|
|
174
|
+
|
|
175
|
+
### Import Session
|
|
176
|
+
|
|
177
|
+
Import a previously exported session:
|
|
178
|
+
|
|
179
|
+
1. Open DevTools
|
|
180
|
+
2. Go to Settings tab
|
|
181
|
+
3. Click "Import Session"
|
|
182
|
+
4. Select the `.json` file
|
|
183
|
+
|
|
184
|
+
### Time-Travel Debugging
|
|
185
|
+
|
|
186
|
+
Create snapshots of your application state:
|
|
187
|
+
|
|
188
|
+
1. Open DevTools → Settings
|
|
189
|
+
2. Click "Create Snapshot"
|
|
190
|
+
3. Continue using your app
|
|
191
|
+
4. Click "Restore" on any snapshot to go back in time
|
|
192
|
+
|
|
193
|
+
## Configuration
|
|
194
|
+
|
|
195
|
+
### Event Store Settings
|
|
196
|
+
|
|
197
|
+
Configure the event store behavior:
|
|
198
|
+
|
|
199
|
+
```typescript
|
|
200
|
+
import { getGlobalEventStore } from "@concavejs/devtools";
|
|
201
|
+
|
|
202
|
+
const store = getGlobalEventStore();
|
|
203
|
+
|
|
204
|
+
store.saveSettings({
|
|
205
|
+
// Persist events across page reloads
|
|
206
|
+
persistEvents: true,
|
|
207
|
+
|
|
208
|
+
// Maximum number of events to store
|
|
209
|
+
maxEvents: 1000,
|
|
210
|
+
|
|
211
|
+
// Capture console logs from functions
|
|
212
|
+
captureLogLines: true,
|
|
213
|
+
});
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Performance
|
|
217
|
+
|
|
218
|
+
The devtools are designed to have minimal impact on your application:
|
|
219
|
+
|
|
220
|
+
- Events are stored in a circular buffer (configurable max size)
|
|
221
|
+
- WebSocket interception uses native proxies for minimal overhead
|
|
222
|
+
- React components are optimized with proper memoization
|
|
223
|
+
- Persistence uses localStorage with size limits
|
|
224
|
+
|
|
225
|
+
## Browser Support
|
|
226
|
+
|
|
227
|
+
- Chrome/Edge: ✅ Full support
|
|
228
|
+
- Firefox: ✅ Full support
|
|
229
|
+
- Safari: ✅ Full support
|
|
230
|
+
|
|
231
|
+
## Development
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
# Install dependencies
|
|
235
|
+
npm install
|
|
236
|
+
|
|
237
|
+
# Build the package
|
|
238
|
+
npm run build
|
|
239
|
+
|
|
240
|
+
# Type check
|
|
241
|
+
npm run type-check
|
|
242
|
+
|
|
243
|
+
# Watch mode (for development)
|
|
244
|
+
npm run dev
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## Architecture
|
|
248
|
+
|
|
249
|
+
The devtools consist of several key components:
|
|
250
|
+
|
|
251
|
+
1. **Vite Plugin**: Injects the devtools into your app during development
|
|
252
|
+
2. **WebSocket Interceptor**: Captures Convex sync protocol messages
|
|
253
|
+
3. **Event Store**: Maintains a history of all captured events
|
|
254
|
+
4. **React UI**: Full-featured devtools interface
|
|
255
|
+
5. **Client Entry**: Initializes everything and mounts the UI
|
|
256
|
+
|
|
257
|
+
## License
|
|
258
|
+
|
|
259
|
+
MIT
|
|
260
|
+
|
|
261
|
+
## Contributing
|
|
262
|
+
|
|
263
|
+
Contributions are welcome! Please feel free to submit issues or pull requests.
|