@rozenite/network-activity-plugin 1.2.0 → 1.3.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.
@@ -26,8 +26,7 @@ const getNetworkRequestsRegistry = () => {
26
26
  });
27
27
  };
28
28
  const getEntry = (id) => {
29
- var _a;
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 (blob == null ? void 0 : blob.name) === "string") {
230
+ if (typeof blob?.name === "string") {
232
231
  return blob.name;
233
232
  }
234
- if ((blob == null ? void 0 : blob.data) && typeof blob.data.name === "string") {
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
- (acc, [key, value]) => {
273
- if (isBlob(value)) {
274
- acc[key] = getBinaryPostData(value);
275
- } else if (isArrayBuffer(value)) {
276
- acc[key] = getArrayBufferPostData(value);
277
- } else {
278
- acc[key] = getTextPostData(value);
279
- }
280
- return acc;
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
- var _a;
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 = (options == null ? void 0 : options.enableBootRecording) ?? true;
1059
- const maxQueueSize = (options == null ? void 0 : options.maxQueueSize) ?? 200;
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 == null ? void 0 : options.inspectors
1059
+ ...options?.inspectors
1065
1060
  };
1066
1061
  validateConfig({ inspectors });
1067
1062
  const eventsListener = createEventsListener();
@@ -23,8 +23,7 @@ const getNetworkRequestsRegistry = () => {
23
23
  });
24
24
  };
25
25
  const getEntry = (id) => {
26
- var _a;
27
- return ((_a = registry.get(id)) == null ? void 0 : _a.request) ?? null;
26
+ return registry.get(id)?.request ?? null;
28
27
  };
29
28
  const clear = () => {
30
29
  registry.clear();
@@ -225,10 +224,10 @@ const getContentType = (request) => {
225
224
  }
226
225
  };
227
226
  function getBlobName(blob) {
228
- if (typeof (blob == null ? void 0 : blob.name) === "string") {
227
+ if (typeof blob?.name === "string") {
229
228
  return blob.name;
230
229
  }
231
- if ((blob == null ? void 0 : blob.data) && typeof blob.data.name === "string") {
230
+ if (blob?.data && typeof blob.data.name === "string") {
232
231
  return blob.data.name;
233
232
  }
234
233
  return void 0;
@@ -265,19 +264,16 @@ const getTextPostData = (body) => ({
265
264
  });
266
265
  const getFormDataPostData = (body) => ({
267
266
  type: "form-data",
268
- value: getFormDataEntries(body).reduce(
269
- (acc, [key, value]) => {
270
- if (isBlob(value)) {
271
- acc[key] = getBinaryPostData(value);
272
- } else if (isArrayBuffer(value)) {
273
- acc[key] = getArrayBufferPostData(value);
274
- } else {
275
- acc[key] = getTextPostData(value);
276
- }
277
- return acc;
278
- },
279
- {}
280
- )
267
+ value: Array.from(getFormDataEntries(body)).reduce((acc, [key, value]) => {
268
+ if (isBlob(value)) {
269
+ acc[key] = getBinaryPostData(value);
270
+ } else if (isArrayBuffer(value)) {
271
+ acc[key] = getArrayBufferPostData(value);
272
+ } else {
273
+ acc[key] = getTextPostData(value);
274
+ }
275
+ return acc;
276
+ }, {})
281
277
  });
282
278
  const getRequestBody = (body) => {
283
279
  if (isNullOrUndefined(body)) {
@@ -824,8 +820,7 @@ const isSSEEvent = (type) => {
824
820
  const getSSEInspector = () => {
825
821
  const eventEmitter = createNanoEvents();
826
822
  const getRequestId = (eventSource) => {
827
- var _a;
828
- const requestId = (_a = eventSource._xhr) == null ? void 0 : _a._rozeniteRequestId;
823
+ const requestId = eventSource._xhr?._rozeniteRequestId;
829
824
  if (!requestId) {
830
825
  return null;
831
826
  }
@@ -1052,13 +1047,13 @@ const createNetworkInspectorsConfiguration = (options) => {
1052
1047
  if (inspectorsConfig) {
1053
1048
  return inspectorsConfig;
1054
1049
  }
1055
- bootRecordingEnabled = (options == null ? void 0 : options.enableBootRecording) ?? true;
1056
- const maxQueueSize = (options == null ? void 0 : options.maxQueueSize) ?? 200;
1050
+ bootRecordingEnabled = options?.enableBootRecording ?? true;
1051
+ const maxQueueSize = options?.maxQueueSize ?? 200;
1057
1052
  const inspectors = {
1058
1053
  http: true,
1059
1054
  websocket: true,
1060
1055
  sse: true,
1061
- ...options == null ? void 0 : options.inspectors
1056
+ ...options?.inspectors
1062
1057
  };
1063
1058
  validateConfig({ inspectors });
1064
1059
  const eventsListener = createEventsListener();
@@ -1 +1 @@
1
- {"name":"@rozenite/network-activity-plugin","version":"1.1.0","description":"Network Activity for Rozenite.","panels":[{"name":"Network Activity","source":"/App.html"}]}
1
+ {"name":"@rozenite/network-activity-plugin","version":"1.3.0","description":"Network Activity for Rozenite.","panels":[{"name":"Network Activity","source":"/App.html"}]}
@@ -1,4 +1,3 @@
1
- import { default as WebSocketInterceptor } from 'react-native/Libraries/WebSocket/WebSocketInterceptor';
2
1
  export interface WebSocketInterceptor {
3
2
  /**
4
3
  * Invoked when RCTWebSocketModule.close(...) is called.
@@ -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 = ((_a = config.inspectors) == null ? void 0 : _a.http) ?? true;
96
- const isWebSocketInspectorEnabled = ((_b = config.inspectors) == null ? void 0 : _b.websocket) ?? true;
97
- const isSSEInspectorEnabled = ((_c = config.inspectors) == null ? void 0 : _c.sse) ?? true;
98
- const showUrlAsName = (_d = config.clientUISettings) == null ? void 0 : _d.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 ?? ((_a2 = bootRecording.DEFAULT_CONFIG.clientUISettings) == null ? void 0 : _a2.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 = ((_a = config.inspectors) == null ? void 0 : _a.http) ?? true;
94
- const isWebSocketInspectorEnabled = ((_b = config.inspectors) == null ? void 0 : _b.websocket) ?? true;
95
- const isSSEInspectorEnabled = ((_c = config.inspectors) == null ? void 0 : _c.sse) ?? true;
96
- const showUrlAsName = (_d = config.clientUISettings) == null ? void 0 : _d.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 ?? ((_a2 = DEFAULT_CONFIG.clientUISettings) == null ? void 0 : _a2.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.2.0",
3
+ "version": "1.3.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.2.0"
11
+ "@rozenite/plugin-bridge": "1.3.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": "^5.7.3",
35
- "vite": "^6.0.0",
39
+ "typescript": "~5.9.3",
40
+ "vite": "^7.3.1",
36
41
  "zustand": "^5.0.6",
37
- "@types/react": "~18.3.23",
38
- "@types/react-dom": "~18.3.1",
39
- "rozenite": "1.2.0",
40
- "@rozenite/vite-plugin": "1.2.0"
42
+ "rozenite": "1.3.0",
43
+ "@rozenite/vite-plugin": "1.3.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<RequestFormDataPostData['value']>(
51
- (acc, [key, value]) => {
52
- if (isBlob(value)) {
53
- acc[key] = getBinaryPostData(value);
54
- } else if (isArrayBuffer(value)) {
55
- acc[key] = getArrayBufferPostData(value);
56
- } else {
57
- acc[key] = getTextPostData(value);
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
- return acc;
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 () => clearTimeout(timeoutRef.current);
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
- clearTimeout(timeoutRef.current);
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
- }
@@ -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"}