@flight-framework/devtools 1.0.1 → 2.0.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.
- package/LICENSE +21 -0
- package/README.md +220 -220
- package/dist/bundle-panel.js +189 -189
- package/dist/cache-panel.js +189 -189
- package/dist/hydration-panel.js +142 -142
- package/dist/panel.d.ts.map +1 -1
- package/dist/panel.js +735 -717
- package/dist/panel.js.map +1 -1
- package/package.json +49 -49
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-2026 Flight Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,220 +1,220 @@
|
|
|
1
|
-
# @flight-framework/devtools
|
|
2
|
-
|
|
3
|
-
Developer tools for Flight Framework. Inspect routes, debug server actions, and monitor performance.
|
|
4
|
-
|
|
5
|
-
## Table of Contents
|
|
6
|
-
|
|
7
|
-
- [Installation](#installation)
|
|
8
|
-
- [Quick Start](#quick-start)
|
|
9
|
-
- [Features](#features)
|
|
10
|
-
- [Configuration](#configuration)
|
|
11
|
-
- [Browser Extension](#browser-extension)
|
|
12
|
-
- [API](#api)
|
|
13
|
-
- [License](#license)
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## Installation
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
npm install -D @flight-framework/devtools
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## Quick Start
|
|
26
|
-
|
|
27
|
-
```typescript
|
|
28
|
-
// flight.config.ts
|
|
29
|
-
import { defineConfig } from '@flight-framework/core';
|
|
30
|
-
import { devtools } from '@flight-framework/devtools';
|
|
31
|
-
|
|
32
|
-
export default defineConfig({
|
|
33
|
-
plugins: [
|
|
34
|
-
devtools(),
|
|
35
|
-
],
|
|
36
|
-
});
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
Access the devtools panel at `/__devtools` in development mode.
|
|
40
|
-
|
|
41
|
-
---
|
|
42
|
-
|
|
43
|
-
## Features
|
|
44
|
-
|
|
45
|
-
### Route Inspector
|
|
46
|
-
- View all registered routes
|
|
47
|
-
- See route parameters and patterns
|
|
48
|
-
- Test route matching
|
|
49
|
-
|
|
50
|
-
### Component Tree
|
|
51
|
-
- Visualize component hierarchy
|
|
52
|
-
- Inspect props and state
|
|
53
|
-
- Highlight rendering
|
|
54
|
-
|
|
55
|
-
### Server Actions
|
|
56
|
-
- Log all server action calls
|
|
57
|
-
- View request/response payloads
|
|
58
|
-
- Measure execution time
|
|
59
|
-
|
|
60
|
-
### Cache Inspector
|
|
61
|
-
- View cached entries
|
|
62
|
-
- Inspect TTL and hit rates
|
|
63
|
-
- Manually invalidate entries
|
|
64
|
-
|
|
65
|
-
### Network Monitor
|
|
66
|
-
- Track API requests
|
|
67
|
-
- View request/response headers
|
|
68
|
-
- Measure response times
|
|
69
|
-
|
|
70
|
-
### Performance
|
|
71
|
-
- Core Web Vitals (LCP, FID, CLS)
|
|
72
|
-
- Hydration timing
|
|
73
|
-
- Bundle size analysis
|
|
74
|
-
|
|
75
|
-
---
|
|
76
|
-
|
|
77
|
-
## Contributing
|
|
78
|
-
|
|
79
|
-
See the main [CONTRIBUTING.md](../../CONTRIBUTING.md) for guidelines.
|
|
80
|
-
|
|
81
|
-
---
|
|
82
|
-
|
|
83
|
-
## New in V2: Enhanced Panels
|
|
84
|
-
|
|
85
|
-
### Hydration Panel
|
|
86
|
-
|
|
87
|
-
Track island hydration timing and status:
|
|
88
|
-
|
|
89
|
-
```typescript
|
|
90
|
-
import { subscribeToHydration, setupHydrationTracking } from '@flight-framework/devtools/hydration';
|
|
91
|
-
|
|
92
|
-
// Auto-track hydration events
|
|
93
|
-
setupHydrationTracking();
|
|
94
|
-
|
|
95
|
-
// Subscribe to updates
|
|
96
|
-
subscribeToHydration((islands, metrics) => {
|
|
97
|
-
console.log(`Hydrated: ${metrics.hydratedCount}/${metrics.totalIslands}`);
|
|
98
|
-
console.log(`Avg time: ${metrics.averageHydrationTime}ms`);
|
|
99
|
-
});
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
### Bundle Panel
|
|
103
|
-
|
|
104
|
-
Monitor chunk loading and sizes:
|
|
105
|
-
|
|
106
|
-
```typescript
|
|
107
|
-
import { subscribeToBundles, setupBundleTracking } from '@flight-framework/devtools/bundle';
|
|
108
|
-
|
|
109
|
-
// Auto-track via Performance API
|
|
110
|
-
setupBundleTracking();
|
|
111
|
-
|
|
112
|
-
// Subscribe to updates
|
|
113
|
-
subscribeToBundles((chunks, metrics) => {
|
|
114
|
-
console.log(`Total size: ${metrics.totalSize} bytes`);
|
|
115
|
-
console.log(`Loaded: ${metrics.loadedChunks} chunks`);
|
|
116
|
-
});
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
### Enhanced Cache Panel
|
|
120
|
-
|
|
121
|
-
Advanced cache inspection with tag support:
|
|
122
|
-
|
|
123
|
-
```typescript
|
|
124
|
-
import { subscribeToCache, invalidateByTag } from '@flight-framework/devtools/cache';
|
|
125
|
-
|
|
126
|
-
// Subscribe to cache updates
|
|
127
|
-
subscribeToCache((entries, metrics) => {
|
|
128
|
-
console.log(`Hit rate: ${metrics.hitRate}%`);
|
|
129
|
-
console.log(`Tags: ${metrics.uniqueTags.join(', ')}`);
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
// Invalidate by tag
|
|
133
|
-
invalidateByTag('user-data');
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
---
|
|
137
|
-
|
|
138
|
-
## Configuration
|
|
139
|
-
|
|
140
|
-
```typescript
|
|
141
|
-
devtools({
|
|
142
|
-
// Enable in development only (default)
|
|
143
|
-
enabled: process.env.NODE_ENV !== 'production',
|
|
144
|
-
|
|
145
|
-
// Devtools server port
|
|
146
|
-
port: 9229,
|
|
147
|
-
|
|
148
|
-
// Open devtools automatically
|
|
149
|
-
open: false,
|
|
150
|
-
|
|
151
|
-
// Features to enable
|
|
152
|
-
features: {
|
|
153
|
-
routes: true,
|
|
154
|
-
components: true,
|
|
155
|
-
actions: true,
|
|
156
|
-
cache: true,
|
|
157
|
-
network: true,
|
|
158
|
-
performance: true,
|
|
159
|
-
},
|
|
160
|
-
|
|
161
|
-
// Overlay position
|
|
162
|
-
position: 'bottom-right',
|
|
163
|
-
});
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
---
|
|
167
|
-
|
|
168
|
-
## Browser Extension
|
|
169
|
-
|
|
170
|
-
Install the Flight DevTools browser extension for an integrated debugging experience:
|
|
171
|
-
|
|
172
|
-
- **Chrome**: [Flight DevTools](https://chrome.google.com/webstore/...)
|
|
173
|
-
- **Firefox**: [Flight DevTools](https://addons.mozilla.org/...)
|
|
174
|
-
|
|
175
|
-
The extension adds a "Flight" panel to your browser's developer tools.
|
|
176
|
-
|
|
177
|
-
---
|
|
178
|
-
|
|
179
|
-
## API
|
|
180
|
-
|
|
181
|
-
### Programmatic Access
|
|
182
|
-
|
|
183
|
-
```typescript
|
|
184
|
-
import { getDevtools } from '@flight-framework/devtools';
|
|
185
|
-
|
|
186
|
-
const devtools = getDevtools();
|
|
187
|
-
|
|
188
|
-
// Log custom event
|
|
189
|
-
devtools.log('custom', { message: 'Hello' });
|
|
190
|
-
|
|
191
|
-
// Add custom panel
|
|
192
|
-
devtools.addPanel('my-panel', {
|
|
193
|
-
title: 'My Panel',
|
|
194
|
-
render: () => '<div>Custom content</div>',
|
|
195
|
-
});
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
### React Hook
|
|
199
|
-
|
|
200
|
-
```tsx
|
|
201
|
-
import { useDevtools } from '@flight-framework/devtools/react';
|
|
202
|
-
|
|
203
|
-
function MyComponent() {
|
|
204
|
-
const { log, measure } = useDevtools();
|
|
205
|
-
|
|
206
|
-
const handleClick = () => {
|
|
207
|
-
const end = measure('click-handler');
|
|
208
|
-
// ... do work
|
|
209
|
-
end();
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
return <button onClick={handleClick}>Click</button>;
|
|
213
|
-
}
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
---
|
|
217
|
-
|
|
218
|
-
## License
|
|
219
|
-
|
|
220
|
-
MIT
|
|
1
|
+
# @flight-framework/devtools
|
|
2
|
+
|
|
3
|
+
Developer tools for Flight Framework. Inspect routes, debug server actions, and monitor performance.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Installation](#installation)
|
|
8
|
+
- [Quick Start](#quick-start)
|
|
9
|
+
- [Features](#features)
|
|
10
|
+
- [Configuration](#configuration)
|
|
11
|
+
- [Browser Extension](#browser-extension)
|
|
12
|
+
- [API](#api)
|
|
13
|
+
- [License](#license)
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install -D @flight-framework/devtools
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
// flight.config.ts
|
|
29
|
+
import { defineConfig } from '@flight-framework/core';
|
|
30
|
+
import { devtools } from '@flight-framework/devtools';
|
|
31
|
+
|
|
32
|
+
export default defineConfig({
|
|
33
|
+
plugins: [
|
|
34
|
+
devtools(),
|
|
35
|
+
],
|
|
36
|
+
});
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Access the devtools panel at `/__devtools` in development mode.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Features
|
|
44
|
+
|
|
45
|
+
### Route Inspector
|
|
46
|
+
- View all registered routes
|
|
47
|
+
- See route parameters and patterns
|
|
48
|
+
- Test route matching
|
|
49
|
+
|
|
50
|
+
### Component Tree
|
|
51
|
+
- Visualize component hierarchy
|
|
52
|
+
- Inspect props and state
|
|
53
|
+
- Highlight rendering
|
|
54
|
+
|
|
55
|
+
### Server Actions
|
|
56
|
+
- Log all server action calls
|
|
57
|
+
- View request/response payloads
|
|
58
|
+
- Measure execution time
|
|
59
|
+
|
|
60
|
+
### Cache Inspector
|
|
61
|
+
- View cached entries
|
|
62
|
+
- Inspect TTL and hit rates
|
|
63
|
+
- Manually invalidate entries
|
|
64
|
+
|
|
65
|
+
### Network Monitor
|
|
66
|
+
- Track API requests
|
|
67
|
+
- View request/response headers
|
|
68
|
+
- Measure response times
|
|
69
|
+
|
|
70
|
+
### Performance
|
|
71
|
+
- Core Web Vitals (LCP, FID, CLS)
|
|
72
|
+
- Hydration timing
|
|
73
|
+
- Bundle size analysis
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Contributing
|
|
78
|
+
|
|
79
|
+
See the main [CONTRIBUTING.md](../../CONTRIBUTING.md) for guidelines.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## New in V2: Enhanced Panels
|
|
84
|
+
|
|
85
|
+
### Hydration Panel
|
|
86
|
+
|
|
87
|
+
Track island hydration timing and status:
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
import { subscribeToHydration, setupHydrationTracking } from '@flight-framework/devtools/hydration';
|
|
91
|
+
|
|
92
|
+
// Auto-track hydration events
|
|
93
|
+
setupHydrationTracking();
|
|
94
|
+
|
|
95
|
+
// Subscribe to updates
|
|
96
|
+
subscribeToHydration((islands, metrics) => {
|
|
97
|
+
console.log(`Hydrated: ${metrics.hydratedCount}/${metrics.totalIslands}`);
|
|
98
|
+
console.log(`Avg time: ${metrics.averageHydrationTime}ms`);
|
|
99
|
+
});
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Bundle Panel
|
|
103
|
+
|
|
104
|
+
Monitor chunk loading and sizes:
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
import { subscribeToBundles, setupBundleTracking } from '@flight-framework/devtools/bundle';
|
|
108
|
+
|
|
109
|
+
// Auto-track via Performance API
|
|
110
|
+
setupBundleTracking();
|
|
111
|
+
|
|
112
|
+
// Subscribe to updates
|
|
113
|
+
subscribeToBundles((chunks, metrics) => {
|
|
114
|
+
console.log(`Total size: ${metrics.totalSize} bytes`);
|
|
115
|
+
console.log(`Loaded: ${metrics.loadedChunks} chunks`);
|
|
116
|
+
});
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Enhanced Cache Panel
|
|
120
|
+
|
|
121
|
+
Advanced cache inspection with tag support:
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
import { subscribeToCache, invalidateByTag } from '@flight-framework/devtools/cache';
|
|
125
|
+
|
|
126
|
+
// Subscribe to cache updates
|
|
127
|
+
subscribeToCache((entries, metrics) => {
|
|
128
|
+
console.log(`Hit rate: ${metrics.hitRate}%`);
|
|
129
|
+
console.log(`Tags: ${metrics.uniqueTags.join(', ')}`);
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
// Invalidate by tag
|
|
133
|
+
invalidateByTag('user-data');
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Configuration
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
devtools({
|
|
142
|
+
// Enable in development only (default)
|
|
143
|
+
enabled: process.env.NODE_ENV !== 'production',
|
|
144
|
+
|
|
145
|
+
// Devtools server port
|
|
146
|
+
port: 9229,
|
|
147
|
+
|
|
148
|
+
// Open devtools automatically
|
|
149
|
+
open: false,
|
|
150
|
+
|
|
151
|
+
// Features to enable
|
|
152
|
+
features: {
|
|
153
|
+
routes: true,
|
|
154
|
+
components: true,
|
|
155
|
+
actions: true,
|
|
156
|
+
cache: true,
|
|
157
|
+
network: true,
|
|
158
|
+
performance: true,
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
// Overlay position
|
|
162
|
+
position: 'bottom-right',
|
|
163
|
+
});
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Browser Extension
|
|
169
|
+
|
|
170
|
+
Install the Flight DevTools browser extension for an integrated debugging experience:
|
|
171
|
+
|
|
172
|
+
- **Chrome**: [Flight DevTools](https://chrome.google.com/webstore/...)
|
|
173
|
+
- **Firefox**: [Flight DevTools](https://addons.mozilla.org/...)
|
|
174
|
+
|
|
175
|
+
The extension adds a "Flight" panel to your browser's developer tools.
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## API
|
|
180
|
+
|
|
181
|
+
### Programmatic Access
|
|
182
|
+
|
|
183
|
+
```typescript
|
|
184
|
+
import { getDevtools } from '@flight-framework/devtools';
|
|
185
|
+
|
|
186
|
+
const devtools = getDevtools();
|
|
187
|
+
|
|
188
|
+
// Log custom event
|
|
189
|
+
devtools.log('custom', { message: 'Hello' });
|
|
190
|
+
|
|
191
|
+
// Add custom panel
|
|
192
|
+
devtools.addPanel('my-panel', {
|
|
193
|
+
title: 'My Panel',
|
|
194
|
+
render: () => '<div>Custom content</div>',
|
|
195
|
+
});
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### React Hook
|
|
199
|
+
|
|
200
|
+
```tsx
|
|
201
|
+
import { useDevtools } from '@flight-framework/devtools/react';
|
|
202
|
+
|
|
203
|
+
function MyComponent() {
|
|
204
|
+
const { log, measure } = useDevtools();
|
|
205
|
+
|
|
206
|
+
const handleClick = () => {
|
|
207
|
+
const end = measure('click-handler');
|
|
208
|
+
// ... do work
|
|
209
|
+
end();
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
return <button onClick={handleClick}>Click</button>;
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## License
|
|
219
|
+
|
|
220
|
+
MIT
|