@rozenite/network-activity-plugin 1.2.0 → 1.4.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/CHANGELOG.md +17 -0
- package/dist/App.html +1 -1
- package/dist/assets/{App-o_iVtD-5.js → App-CGt4qucR.js} +12130 -6792
- package/dist/boot-recording.cjs +17 -22
- package/dist/boot-recording.js +23 -25
- package/dist/rozenite.json +1 -1
- package/dist/src/react-native/websocket/websocket-interceptor.d.ts +0 -1
- package/dist/useNetworkActivityDevTools.cjs +5 -7
- package/dist/useNetworkActivityDevTools.js +5 -7
- package/package.json +16 -11
- package/react-native.ts +1 -0
- package/src/react-native/http/http-utils.ts +12 -13
- package/src/ui/hooks/useCopyToClipboard.ts +9 -3
- package/project.json +0 -12
- package/tsconfig.tsbuildinfo +0 -1
- /package/src/react-native/websocket/{websocket-interceptor.d.ts → websocket-interceptor-types.d.ts} +0 -0
package/dist/boot-recording.cjs
CHANGED
|
@@ -26,8 +26,7 @@ const getNetworkRequestsRegistry = () => {
|
|
|
26
26
|
});
|
|
27
27
|
};
|
|
28
28
|
const getEntry = (id) => {
|
|
29
|
-
|
|
30
|
-
return ((_a = registry.get(id)) == null ? void 0 : _a.request) ?? null;
|
|
29
|
+
return registry.get(id)?.request ?? null;
|
|
31
30
|
};
|
|
32
31
|
const clear = () => {
|
|
33
32
|
registry.clear();
|
|
@@ -228,10 +227,10 @@ const getContentType = (request) => {
|
|
|
228
227
|
}
|
|
229
228
|
};
|
|
230
229
|
function getBlobName(blob) {
|
|
231
|
-
if (typeof
|
|
230
|
+
if (typeof blob?.name === "string") {
|
|
232
231
|
return blob.name;
|
|
233
232
|
}
|
|
234
|
-
if (
|
|
233
|
+
if (blob?.data && typeof blob.data.name === "string") {
|
|
235
234
|
return blob.data.name;
|
|
236
235
|
}
|
|
237
236
|
return void 0;
|
|
@@ -268,19 +267,16 @@ const getTextPostData = (body) => ({
|
|
|
268
267
|
});
|
|
269
268
|
const getFormDataPostData = (body) => ({
|
|
270
269
|
type: "form-data",
|
|
271
|
-
value: getFormDataEntries(body).reduce(
|
|
272
|
-
(
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
},
|
|
282
|
-
{}
|
|
283
|
-
)
|
|
270
|
+
value: Array.from(getFormDataEntries(body)).reduce((acc, [key, value]) => {
|
|
271
|
+
if (isBlob(value)) {
|
|
272
|
+
acc[key] = getBinaryPostData(value);
|
|
273
|
+
} else if (isArrayBuffer(value)) {
|
|
274
|
+
acc[key] = getArrayBufferPostData(value);
|
|
275
|
+
} else {
|
|
276
|
+
acc[key] = getTextPostData(value);
|
|
277
|
+
}
|
|
278
|
+
return acc;
|
|
279
|
+
}, {})
|
|
284
280
|
});
|
|
285
281
|
const getRequestBody = (body) => {
|
|
286
282
|
if (isNullOrUndefined(body)) {
|
|
@@ -827,8 +823,7 @@ const isSSEEvent = (type) => {
|
|
|
827
823
|
const getSSEInspector = () => {
|
|
828
824
|
const eventEmitter = nanoevents.createNanoEvents();
|
|
829
825
|
const getRequestId = (eventSource2) => {
|
|
830
|
-
|
|
831
|
-
const requestId = (_a = eventSource2._xhr) == null ? void 0 : _a._rozeniteRequestId;
|
|
826
|
+
const requestId = eventSource2._xhr?._rozeniteRequestId;
|
|
832
827
|
if (!requestId) {
|
|
833
828
|
return null;
|
|
834
829
|
}
|
|
@@ -1055,13 +1050,13 @@ const createNetworkInspectorsConfiguration = (options) => {
|
|
|
1055
1050
|
if (inspectorsConfig) {
|
|
1056
1051
|
return inspectorsConfig;
|
|
1057
1052
|
}
|
|
1058
|
-
bootRecordingEnabled =
|
|
1059
|
-
const maxQueueSize =
|
|
1053
|
+
bootRecordingEnabled = options?.enableBootRecording ?? true;
|
|
1054
|
+
const maxQueueSize = options?.maxQueueSize ?? 200;
|
|
1060
1055
|
const inspectors = {
|
|
1061
1056
|
http: true,
|
|
1062
1057
|
websocket: true,
|
|
1063
1058
|
sse: true,
|
|
1064
|
-
...options
|
|
1059
|
+
...options?.inspectors
|
|
1065
1060
|
};
|
|
1066
1061
|
validateConfig({ inspectors });
|
|
1067
1062
|
const eventsListener = createEventsListener();
|
package/dist/boot-recording.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { c, w } from "./boot-recording.js";
|
|
2
|
+
export {
|
|
3
|
+
c as createNetworkInspectorsConfiguration,
|
|
4
|
+
w as withOnBootNetworkActivityRecording
|
|
5
|
+
};
|
|
6
|
+
;
|
|
4
7
|
import WebSocketInterceptor from "react-native/Libraries/WebSocket/WebSocketInterceptor";
|
|
5
8
|
const REQUEST_TTL = 1e3 * 60 * 5;
|
|
6
9
|
const getNetworkRequestsRegistry = () => {
|
|
@@ -23,8 +26,7 @@ const getNetworkRequestsRegistry = () => {
|
|
|
23
26
|
});
|
|
24
27
|
};
|
|
25
28
|
const getEntry = (id) => {
|
|
26
|
-
|
|
27
|
-
return ((_a = registry.get(id)) == null ? void 0 : _a.request) ?? null;
|
|
29
|
+
return registry.get(id)?.request ?? null;
|
|
28
30
|
};
|
|
29
31
|
const clear = () => {
|
|
30
32
|
registry.clear();
|
|
@@ -225,10 +227,10 @@ const getContentType = (request) => {
|
|
|
225
227
|
}
|
|
226
228
|
};
|
|
227
229
|
function getBlobName(blob) {
|
|
228
|
-
if (typeof
|
|
230
|
+
if (typeof blob?.name === "string") {
|
|
229
231
|
return blob.name;
|
|
230
232
|
}
|
|
231
|
-
if (
|
|
233
|
+
if (blob?.data && typeof blob.data.name === "string") {
|
|
232
234
|
return blob.data.name;
|
|
233
235
|
}
|
|
234
236
|
return void 0;
|
|
@@ -265,19 +267,16 @@ const getTextPostData = (body) => ({
|
|
|
265
267
|
});
|
|
266
268
|
const getFormDataPostData = (body) => ({
|
|
267
269
|
type: "form-data",
|
|
268
|
-
value: getFormDataEntries(body).reduce(
|
|
269
|
-
(
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
},
|
|
279
|
-
{}
|
|
280
|
-
)
|
|
270
|
+
value: Array.from(getFormDataEntries(body)).reduce((acc, [key, value]) => {
|
|
271
|
+
if (isBlob(value)) {
|
|
272
|
+
acc[key] = getBinaryPostData(value);
|
|
273
|
+
} else if (isArrayBuffer(value)) {
|
|
274
|
+
acc[key] = getArrayBufferPostData(value);
|
|
275
|
+
} else {
|
|
276
|
+
acc[key] = getTextPostData(value);
|
|
277
|
+
}
|
|
278
|
+
return acc;
|
|
279
|
+
}, {})
|
|
281
280
|
});
|
|
282
281
|
const getRequestBody = (body) => {
|
|
283
282
|
if (isNullOrUndefined(body)) {
|
|
@@ -824,8 +823,7 @@ const isSSEEvent = (type) => {
|
|
|
824
823
|
const getSSEInspector = () => {
|
|
825
824
|
const eventEmitter = createNanoEvents();
|
|
826
825
|
const getRequestId = (eventSource) => {
|
|
827
|
-
|
|
828
|
-
const requestId = (_a = eventSource._xhr) == null ? void 0 : _a._rozeniteRequestId;
|
|
826
|
+
const requestId = eventSource._xhr?._rozeniteRequestId;
|
|
829
827
|
if (!requestId) {
|
|
830
828
|
return null;
|
|
831
829
|
}
|
|
@@ -1052,13 +1050,13 @@ const createNetworkInspectorsConfiguration = (options) => {
|
|
|
1052
1050
|
if (inspectorsConfig) {
|
|
1053
1051
|
return inspectorsConfig;
|
|
1054
1052
|
}
|
|
1055
|
-
bootRecordingEnabled =
|
|
1056
|
-
const maxQueueSize =
|
|
1053
|
+
bootRecordingEnabled = options?.enableBootRecording ?? true;
|
|
1054
|
+
const maxQueueSize = options?.maxQueueSize ?? 200;
|
|
1057
1055
|
const inspectors = {
|
|
1058
1056
|
http: true,
|
|
1059
1057
|
websocket: true,
|
|
1060
1058
|
sse: true,
|
|
1061
|
-
...options
|
|
1059
|
+
...options?.inspectors
|
|
1062
1060
|
};
|
|
1063
1061
|
validateConfig({ inspectors });
|
|
1064
1062
|
const eventsListener = createEventsListener();
|
package/dist/rozenite.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@rozenite/network-activity-plugin","version":"1.
|
|
1
|
+
{"name":"@rozenite/network-activity-plugin","version":"1.4.0","description":"Network Activity for Rozenite.","panels":[{"name":"Network Activity","source":"/App.html"}]}
|
|
@@ -87,15 +87,14 @@ const useSSEInspector = (client, sseInspector, isEnabled, isRecordingEnabled) =>
|
|
|
87
87
|
};
|
|
88
88
|
const inspectorsConfig = bootRecording.createNetworkInspectorsConfiguration();
|
|
89
89
|
const useNetworkActivityDevTools = (config = bootRecording.DEFAULT_CONFIG) => {
|
|
90
|
-
var _a, _b, _c, _d;
|
|
91
90
|
const isRecordingEnabledRef = react.useRef(false);
|
|
92
91
|
const client = pluginBridge.useRozeniteDevToolsClient({
|
|
93
92
|
pluginId: "@rozenite/network-activity-plugin"
|
|
94
93
|
});
|
|
95
|
-
const isHttpInspectorEnabled =
|
|
96
|
-
const isWebSocketInspectorEnabled =
|
|
97
|
-
const isSSEInspectorEnabled =
|
|
98
|
-
const showUrlAsName =
|
|
94
|
+
const isHttpInspectorEnabled = config.inspectors?.http ?? true;
|
|
95
|
+
const isWebSocketInspectorEnabled = config.inspectors?.websocket ?? true;
|
|
96
|
+
const isSSEInspectorEnabled = config.inspectors?.sse ?? true;
|
|
97
|
+
const showUrlAsName = config.clientUISettings?.showUrlAsName;
|
|
99
98
|
const { eventsListener, networkInspector } = inspectorsConfig;
|
|
100
99
|
react.useEffect(() => {
|
|
101
100
|
if (!client) {
|
|
@@ -108,10 +107,9 @@ const useNetworkActivityDevTools = (config = bootRecording.DEFAULT_CONFIG) => {
|
|
|
108
107
|
return;
|
|
109
108
|
}
|
|
110
109
|
const sendClientUISettings = () => {
|
|
111
|
-
var _a2;
|
|
112
110
|
client.send("client-ui-settings", {
|
|
113
111
|
settings: {
|
|
114
|
-
showUrlAsName: showUrlAsName ??
|
|
112
|
+
showUrlAsName: showUrlAsName ?? bootRecording.DEFAULT_CONFIG.clientUISettings?.showUrlAsName
|
|
115
113
|
}
|
|
116
114
|
});
|
|
117
115
|
};
|
|
@@ -85,15 +85,14 @@ const useSSEInspector = (client, sseInspector, isEnabled, isRecordingEnabled) =>
|
|
|
85
85
|
};
|
|
86
86
|
const inspectorsConfig = createNetworkInspectorsConfiguration();
|
|
87
87
|
const useNetworkActivityDevTools = (config = DEFAULT_CONFIG) => {
|
|
88
|
-
var _a, _b, _c, _d;
|
|
89
88
|
const isRecordingEnabledRef = useRef(false);
|
|
90
89
|
const client = useRozeniteDevToolsClient({
|
|
91
90
|
pluginId: "@rozenite/network-activity-plugin"
|
|
92
91
|
});
|
|
93
|
-
const isHttpInspectorEnabled =
|
|
94
|
-
const isWebSocketInspectorEnabled =
|
|
95
|
-
const isSSEInspectorEnabled =
|
|
96
|
-
const showUrlAsName =
|
|
92
|
+
const isHttpInspectorEnabled = config.inspectors?.http ?? true;
|
|
93
|
+
const isWebSocketInspectorEnabled = config.inspectors?.websocket ?? true;
|
|
94
|
+
const isSSEInspectorEnabled = config.inspectors?.sse ?? true;
|
|
95
|
+
const showUrlAsName = config.clientUISettings?.showUrlAsName;
|
|
97
96
|
const { eventsListener, networkInspector } = inspectorsConfig;
|
|
98
97
|
useEffect(() => {
|
|
99
98
|
if (!client) {
|
|
@@ -106,10 +105,9 @@ const useNetworkActivityDevTools = (config = DEFAULT_CONFIG) => {
|
|
|
106
105
|
return;
|
|
107
106
|
}
|
|
108
107
|
const sendClientUISettings = () => {
|
|
109
|
-
var _a2;
|
|
110
108
|
client.send("client-ui-settings", {
|
|
111
109
|
settings: {
|
|
112
|
-
showUrlAsName: showUrlAsName ??
|
|
110
|
+
showUrlAsName: showUrlAsName ?? DEFAULT_CONFIG.clientUISettings?.showUrlAsName
|
|
113
111
|
}
|
|
114
112
|
});
|
|
115
113
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rozenite/network-activity-plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Network Activity for Rozenite.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/react-native.cjs",
|
|
@@ -8,36 +8,39 @@
|
|
|
8
8
|
"types": "./dist/react-native.d.ts",
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"nanoevents": "^9.1.0",
|
|
11
|
-
"@rozenite/plugin-bridge": "1.
|
|
11
|
+
"@rozenite/plugin-bridge": "1.4.0"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"@floating-ui/react": "^0.26.0",
|
|
15
|
+
"@radix-ui/react-dropdown-menu": "^2.1.15",
|
|
15
16
|
"@radix-ui/react-scroll-area": "^1.2.9",
|
|
16
17
|
"@radix-ui/react-separator": "^1.1.7",
|
|
17
18
|
"@radix-ui/react-slot": "^1.2.3",
|
|
18
19
|
"@radix-ui/react-tabs": "^1.1.12",
|
|
19
|
-
"@radix-ui/react-dropdown-menu": "^2.1.15",
|
|
20
20
|
"@tanstack/react-table": "^8.21.3",
|
|
21
21
|
"@tanstack/react-virtual": "^3.0.0",
|
|
22
|
+
"@types/react": "~19.2.2",
|
|
23
|
+
"@types/react-dom": "~19.1.7",
|
|
22
24
|
"autoprefixer": "^10.4.21",
|
|
23
25
|
"class-variance-authority": "^0.7.1",
|
|
24
26
|
"clsx": "^2.1.1",
|
|
25
27
|
"lucide-react": "^0.263.1",
|
|
26
28
|
"postcss": "^8.5.6",
|
|
27
29
|
"proxy-memoize": "^3.0.1",
|
|
28
|
-
"react": "
|
|
30
|
+
"react": "19.2.0",
|
|
31
|
+
"react-dom": "19.2.0",
|
|
29
32
|
"react-json-tree": "^0.20.0",
|
|
33
|
+
"react-native": "0.83.1",
|
|
30
34
|
"react-native-sse": "^1.2.1",
|
|
35
|
+
"react-native-web": "^0.21.2",
|
|
31
36
|
"tailwind-merge": "^3.3.1",
|
|
32
37
|
"tailwindcss": "^3.4.17",
|
|
33
38
|
"tailwindcss-animate": "^1.0.7",
|
|
34
|
-
"typescript": "
|
|
35
|
-
"vite": "^
|
|
39
|
+
"typescript": "~5.9.3",
|
|
40
|
+
"vite": "^7.3.1",
|
|
36
41
|
"zustand": "^5.0.6",
|
|
37
|
-
"
|
|
38
|
-
"@
|
|
39
|
-
"rozenite": "1.2.0",
|
|
40
|
-
"@rozenite/vite-plugin": "1.2.0"
|
|
42
|
+
"rozenite": "1.4.0",
|
|
43
|
+
"@rozenite/vite-plugin": "1.4.0"
|
|
41
44
|
},
|
|
42
45
|
"peerDependencies": {
|
|
43
46
|
"react-native-sse": "*"
|
|
@@ -50,6 +53,8 @@
|
|
|
50
53
|
"license": "MIT",
|
|
51
54
|
"scripts": {
|
|
52
55
|
"build": "rozenite build",
|
|
53
|
-
"dev": "rozenite dev"
|
|
56
|
+
"dev": "rozenite dev",
|
|
57
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
58
|
+
"lint": "eslint ."
|
|
54
59
|
}
|
|
55
60
|
}
|
package/react-native.ts
CHANGED
|
@@ -17,5 +17,6 @@ if (isDev && !isWeb && !isServer) {
|
|
|
17
17
|
require('./src/react-native/boot-recording').withOnBootNetworkActivityRecording;
|
|
18
18
|
} else {
|
|
19
19
|
useNetworkActivityDevTools = () => null;
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
20
21
|
withOnBootNetworkActivityRecording = (options: any) => null;
|
|
21
22
|
}
|
|
@@ -47,20 +47,19 @@ const getTextPostData = (body: unknown): RequestTextPostData => ({
|
|
|
47
47
|
|
|
48
48
|
const getFormDataPostData = (body: FormData): RequestFormDataPostData => ({
|
|
49
49
|
type: 'form-data',
|
|
50
|
-
value: getFormDataEntries(body).reduce<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
50
|
+
value: Array.from(getFormDataEntries(body)).reduce<
|
|
51
|
+
RequestFormDataPostData['value']
|
|
52
|
+
>((acc, [key, value]) => {
|
|
53
|
+
if (isBlob(value)) {
|
|
54
|
+
acc[key] = getBinaryPostData(value);
|
|
55
|
+
} else if (isArrayBuffer(value)) {
|
|
56
|
+
acc[key] = getArrayBufferPostData(value);
|
|
57
|
+
} else {
|
|
58
|
+
acc[key] = getTextPostData(value);
|
|
59
|
+
}
|
|
59
60
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
{},
|
|
63
|
-
),
|
|
61
|
+
return acc;
|
|
62
|
+
}, {}),
|
|
64
63
|
});
|
|
65
64
|
|
|
66
65
|
export const getRequestBody = (body: XHRPostData): RequestPostData => {
|
|
@@ -5,10 +5,14 @@ import { copyToClipboard } from '../utils/copyToClipboard';
|
|
|
5
5
|
export function useCopyToClipboard() {
|
|
6
6
|
const [isCopied, setIsCopied] = useState(false);
|
|
7
7
|
|
|
8
|
-
const timeoutRef = useRef<NodeJS.Timeout>();
|
|
8
|
+
const timeoutRef = useRef<NodeJS.Timeout>(null);
|
|
9
9
|
|
|
10
10
|
useEffect(() => {
|
|
11
|
-
return () =>
|
|
11
|
+
return () => {
|
|
12
|
+
if (timeoutRef.current) {
|
|
13
|
+
clearTimeout(timeoutRef.current);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
12
16
|
}, []);
|
|
13
17
|
|
|
14
18
|
const copy = useCallback(async (value: string) => {
|
|
@@ -17,7 +21,9 @@ export function useCopyToClipboard() {
|
|
|
17
21
|
|
|
18
22
|
setIsCopied(true);
|
|
19
23
|
|
|
20
|
-
|
|
24
|
+
if (timeoutRef.current) {
|
|
25
|
+
clearTimeout(timeoutRef.current);
|
|
26
|
+
}
|
|
21
27
|
timeoutRef.current = setTimeout(() => setIsCopied(false), 1000);
|
|
22
28
|
} catch (error) {
|
|
23
29
|
console.error('Failed to copy:', error);
|
package/project.json
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
3
|
-
"name": "@rozenite/network-activity-plugin",
|
|
4
|
-
"targets": {
|
|
5
|
-
"build": {
|
|
6
|
-
"cache": true,
|
|
7
|
-
"dependsOn": ["^build"],
|
|
8
|
-
"inputs": ["{projectRoot}/src/**/*"],
|
|
9
|
-
"outputs": ["{projectRoot}/dist"]
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
package/tsconfig.tsbuildinfo
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"root":["./src/css-modules.d.ts","./src/react-native/network-inspector.ts","./src/react-native/network-requests-registry.ts","./src/react-native/usenetworkactivitydevtools.ts","./src/react-native/xhr-interceptor.ts","./src/react-native/xml-request.d.ts","./src/types/client.ts","./src/types/network.ts","./src/ui/components.tsx","./src/ui/network-details.tsx","./src/ui/network-list.tsx","./src/ui/network-toolbar.tsx","./src/ui/panel.tsx","./src/ui/tanstack-query.tsx","./src/ui/utils.ts","./react-native.ts","./rozenite.config.ts"],"errors":true,"version":"5.8.3"}
|
/package/src/react-native/websocket/{websocket-interceptor.d.ts → websocket-interceptor-types.d.ts}
RENAMED
|
File without changes
|