react-native-debug-toolkit 3.5.0 → 3.5.1

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.
Files changed (100) hide show
  1. package/README.md +40 -26
  2. package/README.zh-CN.md +52 -38
  3. package/android/src/main/java/com/reactnativedebugtoolkit/DebugToolkitNativeLogsModule.java +146 -0
  4. package/android/src/main/java/com/reactnativedebugtoolkit/ReactNativeDebugToolkitPackage.java +5 -3
  5. package/ios/DebugToolkitNativeLogs.mm +92 -0
  6. package/lib/commonjs/core/initialize.js +3 -1
  7. package/lib/commonjs/core/initialize.js.map +1 -1
  8. package/lib/commonjs/features/nativeLogs/NativeLogTab.js +156 -0
  9. package/lib/commonjs/features/nativeLogs/NativeLogTab.js.map +1 -0
  10. package/lib/commonjs/features/nativeLogs/index.js +97 -0
  11. package/lib/commonjs/features/nativeLogs/index.js.map +1 -0
  12. package/lib/commonjs/features/nativeLogs/nativeLogsBridge.js +71 -0
  13. package/lib/commonjs/features/nativeLogs/nativeLogsBridge.js.map +1 -0
  14. package/lib/commonjs/features/network/NetworkLogTab.js +5 -8
  15. package/lib/commonjs/features/network/NetworkLogTab.js.map +1 -1
  16. package/lib/commonjs/features/sessionHistory/SessionHistoryTab.js +2 -0
  17. package/lib/commonjs/features/sessionHistory/SessionHistoryTab.js.map +1 -1
  18. package/lib/commonjs/features/sessionHistory/index.js +2 -1
  19. package/lib/commonjs/features/sessionHistory/index.js.map +1 -1
  20. package/lib/commonjs/index.js +7 -0
  21. package/lib/commonjs/index.js.map +1 -1
  22. package/lib/commonjs/ui/DebugView.js +1 -0
  23. package/lib/commonjs/ui/DebugView.js.map +1 -1
  24. package/lib/commonjs/ui/panel/FeatureIntroCard.js +49 -29
  25. package/lib/commonjs/ui/panel/FeatureIntroCard.js.map +1 -1
  26. package/lib/commonjs/ui/panel/FeatureRail.js +3 -3
  27. package/lib/commonjs/ui/panel/FeatureRail.js.map +1 -1
  28. package/lib/commonjs/ui/panel/FloatPanelView.js +4 -32
  29. package/lib/commonjs/ui/panel/FloatPanelView.js.map +1 -1
  30. package/lib/commonjs/utils/SessionManager.js +1 -1
  31. package/lib/commonjs/utils/SessionManager.js.map +1 -1
  32. package/lib/module/core/initialize.js +3 -1
  33. package/lib/module/core/initialize.js.map +1 -1
  34. package/lib/module/features/nativeLogs/NativeLogTab.js +151 -0
  35. package/lib/module/features/nativeLogs/NativeLogTab.js.map +1 -0
  36. package/lib/module/features/nativeLogs/index.js +91 -0
  37. package/lib/module/features/nativeLogs/index.js.map +1 -0
  38. package/lib/module/features/nativeLogs/nativeLogsBridge.js +63 -0
  39. package/lib/module/features/nativeLogs/nativeLogsBridge.js.map +1 -0
  40. package/lib/module/features/network/NetworkLogTab.js +5 -8
  41. package/lib/module/features/network/NetworkLogTab.js.map +1 -1
  42. package/lib/module/features/sessionHistory/SessionHistoryTab.js +2 -0
  43. package/lib/module/features/sessionHistory/SessionHistoryTab.js.map +1 -1
  44. package/lib/module/features/sessionHistory/index.js +2 -1
  45. package/lib/module/features/sessionHistory/index.js.map +1 -1
  46. package/lib/module/index.js +1 -1
  47. package/lib/module/index.js.map +1 -1
  48. package/lib/module/ui/DebugView.js +1 -0
  49. package/lib/module/ui/DebugView.js.map +1 -1
  50. package/lib/module/ui/panel/FeatureIntroCard.js +50 -30
  51. package/lib/module/ui/panel/FeatureIntroCard.js.map +1 -1
  52. package/lib/module/ui/panel/FeatureRail.js +3 -3
  53. package/lib/module/ui/panel/FeatureRail.js.map +1 -1
  54. package/lib/module/ui/panel/FloatPanelView.js +5 -33
  55. package/lib/module/ui/panel/FloatPanelView.js.map +1 -1
  56. package/lib/module/utils/SessionManager.js +1 -1
  57. package/lib/module/utils/SessionManager.js.map +1 -1
  58. package/lib/typescript/src/core/initialize.d.ts +2 -0
  59. package/lib/typescript/src/core/initialize.d.ts.map +1 -1
  60. package/lib/typescript/src/features/nativeLogs/NativeLogTab.d.ts +4 -0
  61. package/lib/typescript/src/features/nativeLogs/NativeLogTab.d.ts.map +1 -0
  62. package/lib/typescript/src/features/nativeLogs/index.d.ts +12 -0
  63. package/lib/typescript/src/features/nativeLogs/index.d.ts.map +1 -0
  64. package/lib/typescript/src/features/nativeLogs/nativeLogsBridge.d.ts +11 -0
  65. package/lib/typescript/src/features/nativeLogs/nativeLogsBridge.d.ts.map +1 -0
  66. package/lib/typescript/src/features/network/NetworkLogTab.d.ts.map +1 -1
  67. package/lib/typescript/src/features/sessionHistory/SessionHistoryTab.d.ts.map +1 -1
  68. package/lib/typescript/src/index.d.ts +3 -1
  69. package/lib/typescript/src/index.d.ts.map +1 -1
  70. package/lib/typescript/src/types/feature.d.ts +1 -1
  71. package/lib/typescript/src/types/feature.d.ts.map +1 -1
  72. package/lib/typescript/src/types/index.d.ts +1 -1
  73. package/lib/typescript/src/types/index.d.ts.map +1 -1
  74. package/lib/typescript/src/types/logs.d.ts +15 -0
  75. package/lib/typescript/src/types/logs.d.ts.map +1 -1
  76. package/lib/typescript/src/ui/DebugView.d.ts.map +1 -1
  77. package/lib/typescript/src/ui/panel/FeatureIntroCard.d.ts +4 -1
  78. package/lib/typescript/src/ui/panel/FeatureIntroCard.d.ts.map +1 -1
  79. package/lib/typescript/src/ui/panel/FloatPanelView.d.ts.map +1 -1
  80. package/lib/typescript/src/utils/SessionManager.d.ts +1 -1
  81. package/lib/typescript/src/utils/SessionManager.d.ts.map +1 -1
  82. package/node/daemon/src/console/console.html +18 -0
  83. package/node/mcp/src/logs.js +1 -1
  84. package/package.json +1 -1
  85. package/src/core/initialize.ts +5 -0
  86. package/src/features/nativeLogs/NativeLogTab.tsx +66 -0
  87. package/src/features/nativeLogs/index.ts +94 -0
  88. package/src/features/nativeLogs/nativeLogsBridge.ts +51 -0
  89. package/src/features/network/NetworkLogTab.tsx +3 -4
  90. package/src/features/sessionHistory/SessionHistoryTab.tsx +2 -0
  91. package/src/features/sessionHistory/index.ts +2 -2
  92. package/src/index.ts +5 -0
  93. package/src/types/feature.ts +1 -0
  94. package/src/types/index.ts +3 -0
  95. package/src/types/logs.ts +17 -0
  96. package/src/ui/DebugView.tsx +1 -0
  97. package/src/ui/panel/FeatureIntroCard.tsx +47 -27
  98. package/src/ui/panel/FeatureRail.tsx +3 -3
  99. package/src/ui/panel/FloatPanelView.tsx +3 -34
  100. package/src/utils/SessionManager.ts +2 -2
@@ -51,12 +51,14 @@ interface FlatLogEntry {
51
51
  const FEATURE_LABELS: Record<LogFeatureKey, string> = {
52
52
  console_logs: 'Console',
53
53
  network_logs: 'Network',
54
+ native_logs: 'Native',
54
55
  track_logs: 'Track',
55
56
  };
56
57
 
57
58
  const FEATURE_COLORS: Record<LogFeatureKey, string> = {
58
59
  console_logs: Colors.info,
59
60
  network_logs: Colors.success,
61
+ native_logs: '#FF9500',
60
62
  track_logs: Colors.purple,
61
63
  };
62
64
 
@@ -3,7 +3,7 @@ import type { LogFeatureKey } from '../../types';
3
3
  import { createDebugTab } from '../../utils/createDebugTab';
4
4
  import { getDefaultLogRuntime, type LogRuntimeContext } from '../../utils/logRuntime';
5
5
 
6
- const FEATURE_KEYS: LogFeatureKey[] = ['console_logs', 'network_logs', 'track_logs'];
6
+ const FEATURE_KEYS: LogFeatureKey[] = ['console_logs', 'network_logs', 'native_logs', 'track_logs'];
7
7
 
8
8
  export function createSessionHistoryFeature(
9
9
  runtime: LogRuntimeContext = getDefaultLogRuntime(),
@@ -28,7 +28,7 @@ export function createSessionHistoryFeature(
28
28
  const counts: Record<string, LogCounts> = {};
29
29
  await Promise.all(
30
30
  sessionIds.map(async (id) => {
31
- const c: LogCounts = { console_logs: 0, network_logs: 0, track_logs: 0 };
31
+ const c: LogCounts = { console_logs: 0, network_logs: 0, native_logs: 0, track_logs: 0 };
32
32
  await Promise.all(
33
33
  FEATURE_KEYS.map(async (key) => {
34
34
  c[key] = await runtime.sessionManager.getSessionLogCount(id, key);
package/src/index.ts CHANGED
@@ -23,6 +23,8 @@ export { createClipboardFeature } from './features/clipboard';
23
23
  export { createDevConnectFeature } from './features/devConnect';
24
24
  export type { DevConnectState } from './features/devConnect';
25
25
  export { createSessionHistoryFeature } from './features/sessionHistory';
26
+ export { createNativeLogsFeature } from './features/nativeLogs';
27
+ export type { NativeLogsFeatureConfig } from './features/nativeLogs';
26
28
 
27
29
  // Hooks
28
30
  export { useNavigationLogger } from './features/navigation/useNavigationLogger';
@@ -69,6 +71,9 @@ export type {
69
71
  FeatureDataProvider,
70
72
  NetworkLogEntry,
71
73
  ConsoleLogEntry,
74
+ NativeLogEntry,
75
+ NativeLogLevel,
76
+ NativeLogSource,
72
77
  ZustandLogEntry,
73
78
  NavigationLogEntry,
74
79
  TrackLogEntry,
@@ -5,6 +5,7 @@ export type DebugFeatureListener = () => void;
5
5
  export type BuiltInFeatureName =
6
6
  | 'network'
7
7
  | 'console'
8
+ | 'native'
8
9
  | 'zustand'
9
10
  | 'navigation'
10
11
  | 'track'
@@ -10,6 +10,9 @@ export type {
10
10
  export type {
11
11
  ConsoleLogEntry,
12
12
  NavigationLogEntry,
13
+ NativeLogEntry,
14
+ NativeLogLevel,
15
+ NativeLogSource,
13
16
  NetworkLogEntry,
14
17
  TrackLogEntry,
15
18
  ZustandLogEntry,
package/src/types/logs.ts CHANGED
@@ -52,3 +52,20 @@ export interface TrackLogEntry {
52
52
  eventName: string;
53
53
  [key: string]: unknown;
54
54
  }
55
+
56
+ export type NativeLogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal' | 'unknown';
57
+ export type NativeLogSource = 'logcat' | 'rctLog' | 'manual';
58
+
59
+ export interface NativeLogEntry {
60
+ id: string;
61
+ timestamp: number;
62
+ platform: 'android' | 'ios' | 'unknown';
63
+ level: NativeLogLevel;
64
+ source: NativeLogSource;
65
+ message: string;
66
+ tag?: string;
67
+ thread?: string;
68
+ file?: string;
69
+ line?: number;
70
+ raw?: string;
71
+ }
@@ -52,6 +52,7 @@ export function DebugView({
52
52
  const resolvedFeatures: FeatureConfigs = {
53
53
  network: true,
54
54
  console: true,
55
+ native: true,
55
56
  zustand: true,
56
57
  navigation: true,
57
58
  track: true,
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { View, Text, Pressable, StyleSheet } from 'react-native';
2
+ import { View, Text, Pressable, TextInput, StyleSheet } from 'react-native';
3
3
  import { Colors } from '../theme/colors';
4
4
  import type { FeatureSummary } from './buildFeatureSummary';
5
5
 
@@ -13,6 +13,9 @@ interface FeatureIntroCardProps {
13
13
  summary: FeatureSummary;
14
14
  filterBad: boolean;
15
15
  onFilterBad: (bad: boolean) => void;
16
+ searchQuery?: string;
17
+ onSearchChange?: (text: string) => void;
18
+ showSearch?: boolean;
16
19
  }
17
20
 
18
21
  export function FeatureIntroCard({
@@ -20,12 +23,11 @@ export function FeatureIntroCard({
20
23
  summary,
21
24
  filterBad,
22
25
  onFilterBad,
26
+ searchQuery,
27
+ onSearchChange,
28
+ showSearch,
23
29
  }: FeatureIntroCardProps) {
24
- const {
25
- statusLabel,
26
- statusColor,
27
- supportsBadFilter,
28
- } = summary;
30
+ const { statusLabel, statusColor, supportsBadFilter } = summary;
29
31
 
30
32
  return (
31
33
  <View style={styles.card}>
@@ -38,24 +40,32 @@ export function FeatureIntroCard({
38
40
  </Text>
39
41
  </View>
40
42
  )}
41
- </View>
42
- {supportsBadFilter && (
43
- <View style={styles.actionRow}>
44
- <Pressable
45
- style={[styles.chip, !filterBad && styles.chipActive]}
46
- onPress={() => onFilterBad(false)}
47
- >
48
- <Text style={[styles.chipText, !filterBad && styles.chipTextActive]}>All</Text>
49
- </Pressable>
50
- {supportsBadFilter && (
43
+ {supportsBadFilter && (
44
+ <View style={styles.filterRow}>
45
+ <Pressable
46
+ style={[styles.chip, !filterBad && styles.chipActive]}
47
+ onPress={() => onFilterBad(false)}
48
+ >
49
+ <Text style={[styles.chipText, !filterBad && styles.chipTextActive]}>All</Text>
50
+ </Pressable>
51
51
  <Pressable
52
52
  style={[styles.chip, filterBad && styles.chipBadActive]}
53
53
  onPress={() => onFilterBad(true)}
54
54
  >
55
55
  <Text style={[styles.chipText, filterBad && styles.chipTextBad]}>Bad</Text>
56
56
  </Pressable>
57
- )}
58
- </View>
57
+ </View>
58
+ )}
59
+ </View>
60
+ {showSearch && (
61
+ <TextInput
62
+ style={styles.searchInput}
63
+ placeholder="Search..."
64
+ placeholderTextColor={Colors.textLight}
65
+ value={searchQuery}
66
+ onChangeText={onSearchChange}
67
+ returnKeyType="search"
68
+ />
59
69
  )}
60
70
  </View>
61
71
  );
@@ -63,8 +73,9 @@ export function FeatureIntroCard({
63
73
 
64
74
  const styles = StyleSheet.create({
65
75
  card: {
66
- paddingHorizontal: 14,
67
- paddingVertical: 10,
76
+ paddingHorizontal: 12,
77
+ paddingTop: 8,
78
+ paddingBottom: 6,
68
79
  borderBottomWidth: StyleSheet.hairlineWidth,
69
80
  borderBottomColor: Colors.border,
70
81
  backgroundColor: Colors.background,
@@ -75,10 +86,9 @@ const styles = StyleSheet.create({
75
86
  gap: 8,
76
87
  },
77
88
  title: {
78
- fontSize: 17,
89
+ fontSize: 15,
79
90
  fontWeight: '700',
80
91
  color: Colors.text,
81
- flex: 1,
82
92
  },
83
93
  statusChip: {
84
94
  paddingHorizontal: 8,
@@ -91,16 +101,15 @@ const styles = StyleSheet.create({
91
101
  fontWeight: '700',
92
102
  color: Colors.textSecondary,
93
103
  },
94
- actionRow: {
104
+ filterRow: {
95
105
  flexDirection: 'row',
96
106
  gap: 6,
97
- marginTop: 8,
98
107
  },
99
108
  chip: {
100
- height: 26,
101
- paddingHorizontal: 12,
109
+ height: 24,
110
+ paddingHorizontal: 10,
102
111
  justifyContent: 'center',
103
- borderRadius: 13,
112
+ borderRadius: 12,
104
113
  borderWidth: 1,
105
114
  borderColor: Colors.border,
106
115
  backgroundColor: Colors.surface,
@@ -124,4 +133,15 @@ const styles = StyleSheet.create({
124
133
  chipTextBad: {
125
134
  color: '#fff',
126
135
  },
136
+ searchInput: {
137
+ height: 32,
138
+ borderWidth: 1,
139
+ borderColor: Colors.border,
140
+ borderRadius: 8,
141
+ backgroundColor: Colors.surface,
142
+ paddingHorizontal: 10,
143
+ fontSize: 13,
144
+ color: Colors.text,
145
+ marginTop: 6,
146
+ },
127
147
  });
@@ -128,10 +128,10 @@ const styles = StyleSheet.create({
128
128
  backgroundColor: Colors.primary,
129
129
  },
130
130
  itemName: {
131
- fontSize: 9,
131
+ fontSize: 11,
132
132
  fontWeight: '700',
133
133
  color: Colors.textSecondary,
134
- letterSpacing: 0,
134
+ letterSpacing: 0.2,
135
135
  },
136
136
  activeItemName: {
137
137
  color: Colors.text,
@@ -158,7 +158,7 @@ const styles = StyleSheet.create({
158
158
  justifyContent: 'center',
159
159
  },
160
160
  countText: {
161
- fontSize: 8,
161
+ fontSize: 10,
162
162
  fontWeight: '800',
163
163
  color: Colors.textSecondary,
164
164
  },
@@ -2,7 +2,6 @@ import React, { Component, useCallback, useEffect, useRef, useState } from 'reac
2
2
  import {
3
3
  View,
4
4
  Text,
5
- TextInput,
6
5
  StyleSheet,
7
6
  Animated,
8
7
  } from 'react-native';
@@ -239,20 +238,11 @@ export function FloatPanelView({ features, panelOpen, onOpenPanel, onClosePanel,
239
238
  summary={activeSummary}
240
239
  filterBad={filterBad}
241
240
  onFilterBad={setFilterBad}
241
+ searchQuery={searchQuery}
242
+ onSearchChange={setSearchQuery}
243
+ showSearch={showSearch}
242
244
  />
243
245
  )}
244
- {showSearch && (
245
- <View style={styles.toolbar}>
246
- <TextInput
247
- style={styles.searchInput}
248
- placeholder="Search..."
249
- placeholderTextColor={Colors.textLight}
250
- value={searchQuery}
251
- onChangeText={setSearchQuery}
252
- returnKeyType="search"
253
- />
254
- </View>
255
- )}
256
246
  <Animated.View
257
247
  style={[
258
248
  styles.contentContainer,
@@ -287,27 +277,6 @@ const styles = StyleSheet.create({
287
277
  contentColumn: {
288
278
  flex: 1,
289
279
  },
290
- toolbar: {
291
- flexDirection: 'row',
292
- alignItems: 'center',
293
- gap: 8,
294
- paddingHorizontal: 10,
295
- paddingVertical: 8,
296
- borderBottomWidth: StyleSheet.hairlineWidth,
297
- borderBottomColor: Colors.border,
298
- backgroundColor: Colors.background,
299
- },
300
- searchInput: {
301
- flex: 1,
302
- height: 34,
303
- borderWidth: 1,
304
- borderColor: Colors.border,
305
- borderRadius: 8,
306
- backgroundColor: Colors.surface,
307
- paddingHorizontal: 10,
308
- fontSize: 13,
309
- color: Colors.text,
310
- },
311
280
  contentContainer: { flex: 1 },
312
281
  emptyText: {
313
282
  padding: 20,
@@ -1,7 +1,7 @@
1
1
  import type { SessionInfo } from './deviceReport';
2
2
  import type { StorageAdapter } from './StorageAdapter';
3
3
 
4
- export type LogFeatureKey = 'console_logs' | 'network_logs' | 'track_logs';
4
+ export type LogFeatureKey = 'console_logs' | 'network_logs' | 'native_logs' | 'track_logs';
5
5
 
6
6
  export type LogSession = SessionInfo;
7
7
 
@@ -18,7 +18,7 @@ export interface SessionManagerOptions {
18
18
 
19
19
  const SESSION_INDEX_KEY = '@react_native_debug_toolkit/sessions';
20
20
  const DEFAULT_MAX_SESSIONS = 5;
21
- const DEFAULT_FEATURE_KEYS: LogFeatureKey[] = ['console_logs', 'network_logs', 'track_logs'];
21
+ const DEFAULT_FEATURE_KEYS: LogFeatureKey[] = ['console_logs', 'network_logs', 'native_logs', 'track_logs'];
22
22
 
23
23
  function randomHex(): string {
24
24
  return Math.floor(Math.random() * 0xffffffff).toString(16).padStart(8, '0');