@rozenite/network-activity-plugin 1.0.0-alpha.1 → 1.0.0-alpha.3
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 +1 -1
- package/dist/assets/panel-CU9Fj1Ml.js +16717 -0
- package/dist/assets/panel-DXGMsavf.css +555 -0
- package/dist/panel.html +2 -2
- package/dist/react-native.cjs +8 -1
- package/dist/react-native.d.ts +86 -1
- package/dist/react-native.js +6 -171
- package/dist/rozenite.json +1 -1
- package/dist/useNetworkActivityDevTools.js +488 -0
- package/package.json +4 -4
- package/react-native.ts +2 -1
- package/rozenite.config.ts +1 -1
- package/src/css-modules.d.ts +1 -1
- package/src/react-native/network-inspector.ts +391 -0
- package/src/react-native/network-requests-registry.ts +122 -0
- package/src/react-native/useNetworkActivityDevTools.ts +6 -217
- package/src/react-native/xhr-interceptor.ts +211 -0
- package/src/react-native/xml-request.d.ts +23 -0
- package/src/types/client.ts +111 -0
- package/src/types/network.ts +26 -147
- package/src/ui/components.tsx +48 -26
- package/src/ui/network-details.module.css +140 -0
- package/src/ui/network-details.tsx +252 -41
- package/src/ui/network-list.module.css +6 -0
- package/src/ui/network-list.tsx +148 -53
- package/src/ui/network-toolbar.tsx +3 -9
- package/src/ui/panel.module.css +6 -0
- package/src/ui/panel.tsx +158 -40
- package/src/ui/tanstack-query.tsx +83 -76
- package/src/ui/utils.ts +22 -13
- package/tsconfig.json +13 -6
- package/vite.config.ts +1 -1
- package/dist/assets/panel-C5YgUUj5.js +0 -54
- package/dist/assets/panel-NCVczPb1.css +0 -1
package/src/types/network.ts
CHANGED
|
@@ -1,153 +1,32 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Network types for the simplified event structure - limited to XMLHttpRequest capturable properties
|
|
2
|
+
import {
|
|
3
|
+
NetworkRequestId,
|
|
4
|
+
NetworkLoaderId,
|
|
5
|
+
NetworkResourceType,
|
|
6
|
+
NetworkRequest,
|
|
7
|
+
NetworkResponse,
|
|
8
|
+
NetworkInitiator,
|
|
9
|
+
} from './client';
|
|
2
10
|
|
|
3
|
-
export
|
|
4
|
-
requestId:
|
|
5
|
-
loaderId
|
|
6
|
-
documentURL
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
method: string;
|
|
10
|
-
headers: Record<string, string>;
|
|
11
|
-
postData?: string;
|
|
12
|
-
hasPostData?: boolean;
|
|
13
|
-
};
|
|
14
|
-
timestamp: number;
|
|
15
|
-
wallTime: number;
|
|
16
|
-
initiator: {
|
|
17
|
-
type: string;
|
|
18
|
-
stack?: {
|
|
19
|
-
callFrames: Array<{
|
|
20
|
-
functionName: string;
|
|
21
|
-
scriptId: string;
|
|
22
|
-
url: string;
|
|
23
|
-
lineNumber: number;
|
|
24
|
-
columnNumber: number;
|
|
25
|
-
}>;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
redirectHasExtraInfo: boolean;
|
|
29
|
-
redirectResponse?: any;
|
|
30
|
-
referrerPolicy: string;
|
|
31
|
-
type: string;
|
|
32
|
-
frameId: string;
|
|
33
|
-
hasUserGesture: boolean;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface NetworkRequestExtraInfo {
|
|
37
|
-
requestId: string;
|
|
38
|
-
blockedCookies: Array<{
|
|
39
|
-
blockedReasons: string[];
|
|
40
|
-
cookie: {
|
|
41
|
-
name: string;
|
|
42
|
-
value: string;
|
|
43
|
-
domain: string;
|
|
44
|
-
path: string;
|
|
45
|
-
expires: number;
|
|
46
|
-
size: number;
|
|
47
|
-
httpOnly: boolean;
|
|
48
|
-
secure: boolean;
|
|
49
|
-
session: boolean;
|
|
50
|
-
sameSite: string;
|
|
51
|
-
};
|
|
52
|
-
}>;
|
|
11
|
+
export type NetworkEntry = {
|
|
12
|
+
requestId: NetworkRequestId;
|
|
13
|
+
loaderId?: NetworkLoaderId;
|
|
14
|
+
documentURL?: string;
|
|
15
|
+
url: string;
|
|
16
|
+
method: string;
|
|
53
17
|
headers: Record<string, string>;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
};
|
|
57
|
-
clientSecurityState?: {
|
|
58
|
-
initiatorIsSecureContext: boolean;
|
|
59
|
-
initiatorIPAddressSpace: string;
|
|
60
|
-
privateNetworkRequestPolicy: string;
|
|
61
|
-
};
|
|
62
|
-
siteHasCookieInOtherPartition: boolean;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export interface NetworkResponse {
|
|
66
|
-
requestId: string;
|
|
67
|
-
loaderId: string;
|
|
68
|
-
timestamp: number;
|
|
69
|
-
type: string;
|
|
70
|
-
response: {
|
|
71
|
-
url: string;
|
|
72
|
-
status: number;
|
|
73
|
-
statusText: string;
|
|
74
|
-
headers: Record<string, string>;
|
|
75
|
-
mimeType: string;
|
|
76
|
-
requestHeaders: Record<string, string>;
|
|
77
|
-
requestHeadersText?: string;
|
|
78
|
-
connectionReused: boolean;
|
|
79
|
-
connectionId: number;
|
|
80
|
-
remoteIPAddress?: string;
|
|
81
|
-
remotePort?: number;
|
|
82
|
-
protocol?: string;
|
|
83
|
-
securityState: string;
|
|
84
|
-
encodedDataLength: number;
|
|
85
|
-
timing?: {
|
|
86
|
-
requestTime: number;
|
|
87
|
-
proxyStart: number;
|
|
88
|
-
proxyEnd: number;
|
|
89
|
-
dnsStart: number;
|
|
90
|
-
dnsEnd: number;
|
|
91
|
-
connectStart: number;
|
|
92
|
-
connectEnd: number;
|
|
93
|
-
sslStart: number;
|
|
94
|
-
sslEnd: number;
|
|
95
|
-
workerStart: number;
|
|
96
|
-
workerReadyStart: number;
|
|
97
|
-
workerReadyEnd: number;
|
|
98
|
-
sendStart: number;
|
|
99
|
-
sendEnd: number;
|
|
100
|
-
pushStart: number;
|
|
101
|
-
pushEnd: number;
|
|
102
|
-
receiveHeadersEnd: number;
|
|
103
|
-
};
|
|
104
|
-
responseTime: number;
|
|
105
|
-
fromDiskCache: boolean;
|
|
106
|
-
fromServiceWorker: boolean;
|
|
107
|
-
fromPrefetchCache: boolean;
|
|
108
|
-
encodedBodySize: number;
|
|
109
|
-
decodedBodySize: number;
|
|
110
|
-
headersText?: string;
|
|
111
|
-
serviceWorkerResponseSource?: string;
|
|
112
|
-
responseSource: string;
|
|
113
|
-
statusCode: number;
|
|
114
|
-
};
|
|
115
|
-
hasExtraInfo: boolean;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export interface NetworkLoadingFinished {
|
|
119
|
-
requestId: string;
|
|
120
|
-
timestamp: number;
|
|
121
|
-
encodedDataLength: number;
|
|
122
|
-
shouldReportCorbBlocking: boolean;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export interface NetworkLoadingFailed {
|
|
126
|
-
requestId: string;
|
|
127
|
-
timestamp: number;
|
|
128
|
-
type: string;
|
|
129
|
-
errorText: string;
|
|
130
|
-
canceled?: boolean;
|
|
131
|
-
blockedReason?: string;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export interface NetworkEventMap extends Record<string, unknown> {
|
|
135
|
-
'Network.requestWillBeSent': NetworkRequest;
|
|
136
|
-
'Network.requestWillBeSentExtraInfo': NetworkRequestExtraInfo;
|
|
137
|
-
'Network.responseReceived': NetworkResponse;
|
|
138
|
-
'Network.loadingFinished': NetworkLoadingFinished;
|
|
139
|
-
'Network.loadingFailed': NetworkLoadingFailed;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
export interface NetworkEntry {
|
|
143
|
-
requestId: string;
|
|
144
|
-
request: NetworkRequest;
|
|
145
|
-
extraInfo?: NetworkRequestExtraInfo;
|
|
146
|
-
response?: NetworkResponse;
|
|
147
|
-
loadingFinished?: NetworkLoadingFinished;
|
|
148
|
-
loadingFailed?: NetworkLoadingFailed;
|
|
18
|
+
postData?: string;
|
|
19
|
+
hasPostData?: boolean;
|
|
149
20
|
status: 'pending' | 'loading' | 'finished' | 'failed';
|
|
150
21
|
startTime: number;
|
|
151
22
|
endTime?: number;
|
|
152
23
|
duration?: number;
|
|
153
|
-
|
|
24
|
+
type?: NetworkResourceType;
|
|
25
|
+
initiator?: NetworkInitiator;
|
|
26
|
+
request?: NetworkRequest;
|
|
27
|
+
response?: NetworkResponse;
|
|
28
|
+
errorText?: string;
|
|
29
|
+
canceled?: boolean;
|
|
30
|
+
encodedDataLength?: number;
|
|
31
|
+
dataLength?: number;
|
|
32
|
+
};
|
package/src/ui/components.tsx
CHANGED
|
@@ -33,14 +33,26 @@ export const Button: React.FC<ButtonProps> = ({
|
|
|
33
33
|
style,
|
|
34
34
|
className,
|
|
35
35
|
}) => {
|
|
36
|
-
const sizeClass =
|
|
37
|
-
|
|
36
|
+
const sizeClass =
|
|
37
|
+
size === 'small'
|
|
38
|
+
? styles.buttonSmall
|
|
39
|
+
: size === 'large'
|
|
40
|
+
? styles.buttonLarge
|
|
41
|
+
: styles.buttonMedium;
|
|
42
|
+
const variantClass =
|
|
43
|
+
styles[
|
|
44
|
+
`button${
|
|
45
|
+
variant.charAt(0).toUpperCase() + variant.slice(1)
|
|
46
|
+
}` as keyof typeof styles
|
|
47
|
+
];
|
|
38
48
|
|
|
39
49
|
return (
|
|
40
50
|
<button
|
|
41
51
|
onClick={onClick}
|
|
42
52
|
disabled={disabled}
|
|
43
|
-
className={`${styles.button} ${sizeClass} ${variantClass} ${
|
|
53
|
+
className={`${styles.button} ${sizeClass} ${variantClass} ${
|
|
54
|
+
className || ''
|
|
55
|
+
}`}
|
|
44
56
|
style={style}
|
|
45
57
|
>
|
|
46
58
|
{children}
|
|
@@ -68,11 +80,12 @@ interface BadgeProps {
|
|
|
68
80
|
style?: React.CSSProperties;
|
|
69
81
|
}
|
|
70
82
|
|
|
71
|
-
export const Badge: React.FC<BadgeProps> = ({
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
83
|
+
export const Badge: React.FC<BadgeProps> = ({
|
|
84
|
+
children,
|
|
85
|
+
color = '#007AFF',
|
|
86
|
+
style,
|
|
87
|
+
}) => (
|
|
88
|
+
<span className={styles.badge} style={{ backgroundColor: color, ...style }}>
|
|
76
89
|
{children}
|
|
77
90
|
</span>
|
|
78
91
|
);
|
|
@@ -95,7 +108,10 @@ interface PanelHeaderProps {
|
|
|
95
108
|
style?: React.CSSProperties;
|
|
96
109
|
}
|
|
97
110
|
|
|
98
|
-
export const PanelHeader: React.FC<PanelHeaderProps> = ({
|
|
111
|
+
export const PanelHeader: React.FC<PanelHeaderProps> = ({
|
|
112
|
+
children,
|
|
113
|
+
style,
|
|
114
|
+
}) => (
|
|
99
115
|
<div className={styles.panelHeader} style={style}>
|
|
100
116
|
{children}
|
|
101
117
|
</div>
|
|
@@ -120,10 +136,10 @@ interface LoadingSpinnerProps {
|
|
|
120
136
|
style?: React.CSSProperties;
|
|
121
137
|
}
|
|
122
138
|
|
|
123
|
-
export const LoadingSpinner: React.FC<LoadingSpinnerProps> = ({
|
|
124
|
-
size = 16,
|
|
139
|
+
export const LoadingSpinner: React.FC<LoadingSpinnerProps> = ({
|
|
140
|
+
size = 16,
|
|
125
141
|
color = '#007AFF',
|
|
126
|
-
style
|
|
142
|
+
style,
|
|
127
143
|
}) => (
|
|
128
144
|
<div
|
|
129
145
|
className={styles.loadingSpinner}
|
|
@@ -146,13 +162,13 @@ interface TooltipProps {
|
|
|
146
162
|
variant?: 'default' | 'info' | 'warning' | 'error';
|
|
147
163
|
}
|
|
148
164
|
|
|
149
|
-
export const Tooltip: React.FC<TooltipProps> = ({
|
|
150
|
-
children,
|
|
151
|
-
content,
|
|
152
|
-
style,
|
|
165
|
+
export const Tooltip: React.FC<TooltipProps> = ({
|
|
166
|
+
children,
|
|
167
|
+
content,
|
|
168
|
+
style,
|
|
153
169
|
showOnlyWhenTruncated = false,
|
|
154
170
|
placement = 'top',
|
|
155
|
-
variant = 'default'
|
|
171
|
+
variant = 'default',
|
|
156
172
|
}) => {
|
|
157
173
|
const [isOpen, setIsOpen] = useState(false);
|
|
158
174
|
const [isTruncated, setIsTruncated] = useState(false);
|
|
@@ -173,7 +189,11 @@ export const Tooltip: React.FC<TooltipProps> = ({
|
|
|
173
189
|
const dismiss = useDismiss(context);
|
|
174
190
|
const role = useRole(context, { role: 'tooltip' });
|
|
175
191
|
|
|
176
|
-
const { getReferenceProps, getFloatingProps } = useInteractions([
|
|
192
|
+
const { getReferenceProps, getFloatingProps } = useInteractions([
|
|
193
|
+
hover,
|
|
194
|
+
dismiss,
|
|
195
|
+
role,
|
|
196
|
+
]);
|
|
177
197
|
|
|
178
198
|
React.useEffect(() => {
|
|
179
199
|
if (showOnlyWhenTruncated && refs.reference.current) {
|
|
@@ -186,7 +206,12 @@ export const Tooltip: React.FC<TooltipProps> = ({
|
|
|
186
206
|
|
|
187
207
|
const shouldShowTooltip = showOnlyWhenTruncated ? isTruncated : true;
|
|
188
208
|
|
|
189
|
-
const variantClass =
|
|
209
|
+
const variantClass =
|
|
210
|
+
styles[
|
|
211
|
+
`tooltip${
|
|
212
|
+
variant.charAt(0).toUpperCase() + variant.slice(1)
|
|
213
|
+
}` as keyof typeof styles
|
|
214
|
+
];
|
|
190
215
|
|
|
191
216
|
return (
|
|
192
217
|
<>
|
|
@@ -198,8 +223,8 @@ export const Tooltip: React.FC<TooltipProps> = ({
|
|
|
198
223
|
>
|
|
199
224
|
{children}
|
|
200
225
|
</div>
|
|
201
|
-
|
|
202
|
-
|
|
226
|
+
|
|
227
|
+
<FloatingPortal>
|
|
203
228
|
{isOpen && (
|
|
204
229
|
<div
|
|
205
230
|
ref={refs.setFloating}
|
|
@@ -209,11 +234,8 @@ export const Tooltip: React.FC<TooltipProps> = ({
|
|
|
209
234
|
>
|
|
210
235
|
{content}
|
|
211
236
|
</div>
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
237
|
+
)}
|
|
238
|
+
</FloatingPortal>
|
|
215
239
|
</>
|
|
216
240
|
);
|
|
217
241
|
};
|
|
218
|
-
|
|
219
|
-
|
|
@@ -34,6 +34,14 @@
|
|
|
34
34
|
word-break: break-all;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
.infoRowSub {
|
|
38
|
+
margin-bottom: 2px;
|
|
39
|
+
margin-left: 16px;
|
|
40
|
+
word-break: break-all;
|
|
41
|
+
font-size: 11px;
|
|
42
|
+
color: #666;
|
|
43
|
+
}
|
|
44
|
+
|
|
37
45
|
.urlText {
|
|
38
46
|
cursor: help;
|
|
39
47
|
border-bottom: 1px dotted #666;
|
|
@@ -54,4 +62,136 @@
|
|
|
54
62
|
|
|
55
63
|
.headerValue {
|
|
56
64
|
word-break: break-all;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.postDataContainer {
|
|
68
|
+
background-color: #f5f5f5;
|
|
69
|
+
padding: 8px;
|
|
70
|
+
border-radius: 4px;
|
|
71
|
+
max-height: 200px;
|
|
72
|
+
overflow: auto;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.postDataText {
|
|
76
|
+
margin: 0;
|
|
77
|
+
font-size: 12px;
|
|
78
|
+
font-family: monospace;
|
|
79
|
+
white-space: pre-wrap;
|
|
80
|
+
word-break: break-all;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.responseBodyContainer {
|
|
84
|
+
background-color: #f5f5f5;
|
|
85
|
+
padding: 8px;
|
|
86
|
+
border-radius: 4px;
|
|
87
|
+
max-height: 300px;
|
|
88
|
+
overflow: auto;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.responseBodyText {
|
|
92
|
+
margin: 0;
|
|
93
|
+
font-size: 12px;
|
|
94
|
+
font-family: monospace;
|
|
95
|
+
white-space: pre-wrap;
|
|
96
|
+
word-break: break-all;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.loadResponseBodyButton {
|
|
100
|
+
background-color: #007acc;
|
|
101
|
+
color: white;
|
|
102
|
+
border: none;
|
|
103
|
+
padding: 8px 16px;
|
|
104
|
+
border-radius: 4px;
|
|
105
|
+
cursor: pointer;
|
|
106
|
+
font-size: 12px;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.loadResponseBodyButton:hover:not(:disabled) {
|
|
110
|
+
background-color: #005a9e;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.loadResponseBodyButton:disabled {
|
|
114
|
+
background-color: #ccc;
|
|
115
|
+
cursor: not-allowed;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.symbolicateButton {
|
|
119
|
+
background-color: #28a745;
|
|
120
|
+
color: white;
|
|
121
|
+
border: none;
|
|
122
|
+
padding: 4px 8px;
|
|
123
|
+
border-radius: 4px;
|
|
124
|
+
cursor: pointer;
|
|
125
|
+
font-size: 11px;
|
|
126
|
+
margin-top: 4px;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.symbolicateButton:hover:not(:disabled) {
|
|
130
|
+
background-color: #218838;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.symbolicateButton:disabled {
|
|
134
|
+
background-color: #ccc;
|
|
135
|
+
cursor: not-allowed;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.symbolicatedContainer {
|
|
139
|
+
font-size: 12px;
|
|
140
|
+
font-family: monospace;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.codeFrameContainer {
|
|
144
|
+
margin-bottom: 16px;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.codeFrameTitle {
|
|
148
|
+
margin: 0 0 8px 0;
|
|
149
|
+
font-size: 14px;
|
|
150
|
+
font-weight: bold;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.codeFrameContent {
|
|
154
|
+
background-color: #f5f5f5;
|
|
155
|
+
padding: 8px;
|
|
156
|
+
border-radius: 4px;
|
|
157
|
+
margin: 0;
|
|
158
|
+
font-size: 11px;
|
|
159
|
+
white-space: pre-wrap;
|
|
160
|
+
word-break: break-all;
|
|
161
|
+
max-height: 200px;
|
|
162
|
+
overflow: auto;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.stackContainer {
|
|
166
|
+
background-color: #f5f5f5;
|
|
167
|
+
padding: 8px;
|
|
168
|
+
border-radius: 4px;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.stackTitle {
|
|
172
|
+
margin: 0 0 8px 0;
|
|
173
|
+
font-size: 14px;
|
|
174
|
+
font-weight: bold;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.stackFrame {
|
|
178
|
+
margin-bottom: 8px;
|
|
179
|
+
padding: 4px 0;
|
|
180
|
+
border-bottom: 1px solid #ddd;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.stackFrame:last-child {
|
|
184
|
+
border-bottom: none;
|
|
185
|
+
margin-bottom: 0;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.stackFrameHeader {
|
|
189
|
+
margin-bottom: 2px;
|
|
190
|
+
color: #333;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.stackFrameLocation {
|
|
194
|
+
font-size: 11px;
|
|
195
|
+
color: #666;
|
|
196
|
+
word-break: break-all;
|
|
57
197
|
}
|