react-native-prod-debugger 1.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 +350 -0
- package/lib/commonjs/core/DebugBubble.js +139 -0
- package/lib/commonjs/core/DebugBubble.js.map +1 -0
- package/lib/commonjs/core/DebugOverlay.js +184 -0
- package/lib/commonjs/core/DebugOverlay.js.map +1 -0
- package/lib/commonjs/core/DebuggerProvider.js +174 -0
- package/lib/commonjs/core/DebuggerProvider.js.map +1 -0
- package/lib/commonjs/core/GestureDetector.js +83 -0
- package/lib/commonjs/core/GestureDetector.js.map +1 -0
- package/lib/commonjs/core/PluginRegistry.js +124 -0
- package/lib/commonjs/core/PluginRegistry.js.map +1 -0
- package/lib/commonjs/core/theme.js +50 -0
- package/lib/commonjs/core/theme.js.map +1 -0
- package/lib/commonjs/core/types.js +6 -0
- package/lib/commonjs/core/types.js.map +1 -0
- package/lib/commonjs/core/useDebugger.js +27 -0
- package/lib/commonjs/core/useDebugger.js.map +1 -0
- package/lib/commonjs/core/utils.js +239 -0
- package/lib/commonjs/core/utils.js.map +1 -0
- package/lib/commonjs/index.js +132 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/plugins/console/ConsoleInterceptor.js +103 -0
- package/lib/commonjs/plugins/console/ConsoleInterceptor.js.map +1 -0
- package/lib/commonjs/plugins/console/ConsoleViewerPlugin.js +269 -0
- package/lib/commonjs/plugins/console/ConsoleViewerPlugin.js.map +1 -0
- package/lib/commonjs/plugins/crashReporter/CrashReporterPlugin.js +363 -0
- package/lib/commonjs/plugins/crashReporter/CrashReporterPlugin.js.map +1 -0
- package/lib/commonjs/plugins/customActions/CustomActionsPlugin.js +218 -0
- package/lib/commonjs/plugins/customActions/CustomActionsPlugin.js.map +1 -0
- package/lib/commonjs/plugins/customActions/actionStore.js +46 -0
- package/lib/commonjs/plugins/customActions/actionStore.js.map +1 -0
- package/lib/commonjs/plugins/deepLinkTester/DeepLinkTesterPlugin.js +268 -0
- package/lib/commonjs/plugins/deepLinkTester/DeepLinkTesterPlugin.js.map +1 -0
- package/lib/commonjs/plugins/deviceInfo/DeviceInfoPlugin.js +184 -0
- package/lib/commonjs/plugins/deviceInfo/DeviceInfoPlugin.js.map +1 -0
- package/lib/commonjs/plugins/featureFlags/FeatureFlagsPlugin.js +381 -0
- package/lib/commonjs/plugins/featureFlags/FeatureFlagsPlugin.js.map +1 -0
- package/lib/commonjs/plugins/featureFlags/flagStore.js +125 -0
- package/lib/commonjs/plugins/featureFlags/flagStore.js.map +1 -0
- package/lib/commonjs/plugins/navigationInspector/NavigationInspectorPlugin.js +250 -0
- package/lib/commonjs/plugins/navigationInspector/NavigationInspectorPlugin.js.map +1 -0
- package/lib/commonjs/plugins/navigationInspector/navigationStore.js +65 -0
- package/lib/commonjs/plugins/navigationInspector/navigationStore.js.map +1 -0
- package/lib/commonjs/plugins/network/NetworkInspectorPlugin.js +709 -0
- package/lib/commonjs/plugins/network/NetworkInspectorPlugin.js.map +1 -0
- package/lib/commonjs/plugins/network/NetworkInterceptor.js +305 -0
- package/lib/commonjs/plugins/network/NetworkInterceptor.js.map +1 -0
- package/lib/commonjs/plugins/performance/PerformanceMonitorPlugin.js +261 -0
- package/lib/commonjs/plugins/performance/PerformanceMonitorPlugin.js.map +1 -0
- package/lib/commonjs/plugins/remoteConfig/RemoteConfigPlugin.js +265 -0
- package/lib/commonjs/plugins/remoteConfig/RemoteConfigPlugin.js.map +1 -0
- package/lib/commonjs/plugins/remoteConfig/remoteConfigStore.js +50 -0
- package/lib/commonjs/plugins/remoteConfig/remoteConfigStore.js.map +1 -0
- package/lib/commonjs/plugins/stateInspector/StateInspectorPlugin.js +378 -0
- package/lib/commonjs/plugins/stateInspector/StateInspectorPlugin.js.map +1 -0
- package/lib/commonjs/plugins/stateInspector/stateAdapterRegistry.js +62 -0
- package/lib/commonjs/plugins/stateInspector/stateAdapterRegistry.js.map +1 -0
- package/lib/commonjs/plugins/storageBrowser/StorageBrowserPlugin.js +496 -0
- package/lib/commonjs/plugins/storageBrowser/StorageBrowserPlugin.js.map +1 -0
- package/lib/commonjs/plugins/storageBrowser/storageAdapterRegistry.js +44 -0
- package/lib/commonjs/plugins/storageBrowser/storageAdapterRegistry.js.map +1 -0
- package/lib/commonjs/plugins/timeline/TimelinePlugin.js +294 -0
- package/lib/commonjs/plugins/timeline/TimelinePlugin.js.map +1 -0
- package/lib/commonjs/plugins/timeline/timelineStore.js +61 -0
- package/lib/commonjs/plugins/timeline/timelineStore.js.map +1 -0
- package/lib/module/core/DebugBubble.js +131 -0
- package/lib/module/core/DebugBubble.js.map +1 -0
- package/lib/module/core/DebugOverlay.js +176 -0
- package/lib/module/core/DebugOverlay.js.map +1 -0
- package/lib/module/core/DebuggerProvider.js +167 -0
- package/lib/module/core/DebuggerProvider.js.map +1 -0
- package/lib/module/core/GestureDetector.js +75 -0
- package/lib/module/core/GestureDetector.js.map +1 -0
- package/lib/module/core/PluginRegistry.js +116 -0
- package/lib/module/core/PluginRegistry.js.map +1 -0
- package/lib/module/core/theme.js +43 -0
- package/lib/module/core/theme.js.map +1 -0
- package/lib/module/core/types.js +2 -0
- package/lib/module/core/types.js.map +1 -0
- package/lib/module/core/useDebugger.js +21 -0
- package/lib/module/core/useDebugger.js.map +1 -0
- package/lib/module/core/utils.js +219 -0
- package/lib/module/core/utils.js.map +1 -0
- package/lib/module/index.js +44 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/plugins/console/ConsoleInterceptor.js +97 -0
- package/lib/module/plugins/console/ConsoleInterceptor.js.map +1 -0
- package/lib/module/plugins/console/ConsoleViewerPlugin.js +262 -0
- package/lib/module/plugins/console/ConsoleViewerPlugin.js.map +1 -0
- package/lib/module/plugins/crashReporter/CrashReporterPlugin.js +357 -0
- package/lib/module/plugins/crashReporter/CrashReporterPlugin.js.map +1 -0
- package/lib/module/plugins/customActions/CustomActionsPlugin.js +211 -0
- package/lib/module/plugins/customActions/CustomActionsPlugin.js.map +1 -0
- package/lib/module/plugins/customActions/actionStore.js +38 -0
- package/lib/module/plugins/customActions/actionStore.js.map +1 -0
- package/lib/module/plugins/deepLinkTester/DeepLinkTesterPlugin.js +261 -0
- package/lib/module/plugins/deepLinkTester/DeepLinkTesterPlugin.js.map +1 -0
- package/lib/module/plugins/deviceInfo/DeviceInfoPlugin.js +177 -0
- package/lib/module/plugins/deviceInfo/DeviceInfoPlugin.js.map +1 -0
- package/lib/module/plugins/featureFlags/FeatureFlagsPlugin.js +374 -0
- package/lib/module/plugins/featureFlags/FeatureFlagsPlugin.js.map +1 -0
- package/lib/module/plugins/featureFlags/flagStore.js +117 -0
- package/lib/module/plugins/featureFlags/flagStore.js.map +1 -0
- package/lib/module/plugins/navigationInspector/NavigationInspectorPlugin.js +243 -0
- package/lib/module/plugins/navigationInspector/NavigationInspectorPlugin.js.map +1 -0
- package/lib/module/plugins/navigationInspector/navigationStore.js +58 -0
- package/lib/module/plugins/navigationInspector/navigationStore.js.map +1 -0
- package/lib/module/plugins/network/NetworkInspectorPlugin.js +703 -0
- package/lib/module/plugins/network/NetworkInspectorPlugin.js.map +1 -0
- package/lib/module/plugins/network/NetworkInterceptor.js +299 -0
- package/lib/module/plugins/network/NetworkInterceptor.js.map +1 -0
- package/lib/module/plugins/performance/PerformanceMonitorPlugin.js +254 -0
- package/lib/module/plugins/performance/PerformanceMonitorPlugin.js.map +1 -0
- package/lib/module/plugins/remoteConfig/RemoteConfigPlugin.js +258 -0
- package/lib/module/plugins/remoteConfig/RemoteConfigPlugin.js.map +1 -0
- package/lib/module/plugins/remoteConfig/remoteConfigStore.js +43 -0
- package/lib/module/plugins/remoteConfig/remoteConfigStore.js.map +1 -0
- package/lib/module/plugins/stateInspector/StateInspectorPlugin.js +372 -0
- package/lib/module/plugins/stateInspector/StateInspectorPlugin.js.map +1 -0
- package/lib/module/plugins/stateInspector/stateAdapterRegistry.js +54 -0
- package/lib/module/plugins/stateInspector/stateAdapterRegistry.js.map +1 -0
- package/lib/module/plugins/storageBrowser/StorageBrowserPlugin.js +489 -0
- package/lib/module/plugins/storageBrowser/StorageBrowserPlugin.js.map +1 -0
- package/lib/module/plugins/storageBrowser/storageAdapterRegistry.js +36 -0
- package/lib/module/plugins/storageBrowser/storageAdapterRegistry.js.map +1 -0
- package/lib/module/plugins/timeline/TimelinePlugin.js +287 -0
- package/lib/module/plugins/timeline/TimelinePlugin.js.map +1 -0
- package/lib/module/plugins/timeline/timelineStore.js +54 -0
- package/lib/module/plugins/timeline/timelineStore.js.map +1 -0
- package/lib/typescript/core/DebugBubble.d.ts +22 -0
- package/lib/typescript/core/DebugBubble.d.ts.map +1 -0
- package/lib/typescript/core/DebugOverlay.d.ts +18 -0
- package/lib/typescript/core/DebugOverlay.d.ts.map +1 -0
- package/lib/typescript/core/DebuggerProvider.d.ts +25 -0
- package/lib/typescript/core/DebuggerProvider.d.ts.map +1 -0
- package/lib/typescript/core/GestureDetector.d.ts +20 -0
- package/lib/typescript/core/GestureDetector.d.ts.map +1 -0
- package/lib/typescript/core/PluginRegistry.d.ts +41 -0
- package/lib/typescript/core/PluginRegistry.d.ts.map +1 -0
- package/lib/typescript/core/theme.d.ts +11 -0
- package/lib/typescript/core/theme.d.ts.map +1 -0
- package/lib/typescript/core/types.d.ts +269 -0
- package/lib/typescript/core/types.d.ts.map +1 -0
- package/lib/typescript/core/useDebugger.d.ts +14 -0
- package/lib/typescript/core/useDebugger.d.ts.map +1 -0
- package/lib/typescript/core/utils.d.ts +46 -0
- package/lib/typescript/core/utils.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +23 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/plugins/console/ConsoleInterceptor.d.ts +32 -0
- package/lib/typescript/plugins/console/ConsoleInterceptor.d.ts.map +1 -0
- package/lib/typescript/plugins/console/ConsoleViewerPlugin.d.ts +3 -0
- package/lib/typescript/plugins/console/ConsoleViewerPlugin.d.ts.map +1 -0
- package/lib/typescript/plugins/crashReporter/CrashReporterPlugin.d.ts +3 -0
- package/lib/typescript/plugins/crashReporter/CrashReporterPlugin.d.ts.map +1 -0
- package/lib/typescript/plugins/customActions/CustomActionsPlugin.d.ts +3 -0
- package/lib/typescript/plugins/customActions/CustomActionsPlugin.d.ts.map +1 -0
- package/lib/typescript/plugins/customActions/actionStore.d.ts +16 -0
- package/lib/typescript/plugins/customActions/actionStore.d.ts.map +1 -0
- package/lib/typescript/plugins/deepLinkTester/DeepLinkTesterPlugin.d.ts +3 -0
- package/lib/typescript/plugins/deepLinkTester/DeepLinkTesterPlugin.d.ts.map +1 -0
- package/lib/typescript/plugins/deviceInfo/DeviceInfoPlugin.d.ts +3 -0
- package/lib/typescript/plugins/deviceInfo/DeviceInfoPlugin.d.ts.map +1 -0
- package/lib/typescript/plugins/featureFlags/FeatureFlagsPlugin.d.ts +3 -0
- package/lib/typescript/plugins/featureFlags/FeatureFlagsPlugin.d.ts.map +1 -0
- package/lib/typescript/plugins/featureFlags/flagStore.d.ts +45 -0
- package/lib/typescript/plugins/featureFlags/flagStore.d.ts.map +1 -0
- package/lib/typescript/plugins/navigationInspector/NavigationInspectorPlugin.d.ts +3 -0
- package/lib/typescript/plugins/navigationInspector/NavigationInspectorPlugin.d.ts.map +1 -0
- package/lib/typescript/plugins/navigationInspector/navigationStore.d.ts +30 -0
- package/lib/typescript/plugins/navigationInspector/navigationStore.d.ts.map +1 -0
- package/lib/typescript/plugins/network/NetworkInspectorPlugin.d.ts +3 -0
- package/lib/typescript/plugins/network/NetworkInspectorPlugin.d.ts.map +1 -0
- package/lib/typescript/plugins/network/NetworkInterceptor.d.ts +42 -0
- package/lib/typescript/plugins/network/NetworkInterceptor.d.ts.map +1 -0
- package/lib/typescript/plugins/performance/PerformanceMonitorPlugin.d.ts +3 -0
- package/lib/typescript/plugins/performance/PerformanceMonitorPlugin.d.ts.map +1 -0
- package/lib/typescript/plugins/remoteConfig/RemoteConfigPlugin.d.ts +3 -0
- package/lib/typescript/plugins/remoteConfig/RemoteConfigPlugin.d.ts.map +1 -0
- package/lib/typescript/plugins/remoteConfig/remoteConfigStore.d.ts +20 -0
- package/lib/typescript/plugins/remoteConfig/remoteConfigStore.d.ts.map +1 -0
- package/lib/typescript/plugins/stateInspector/StateInspectorPlugin.d.ts +3 -0
- package/lib/typescript/plugins/stateInspector/StateInspectorPlugin.d.ts.map +1 -0
- package/lib/typescript/plugins/stateInspector/stateAdapterRegistry.d.ts +34 -0
- package/lib/typescript/plugins/stateInspector/stateAdapterRegistry.d.ts.map +1 -0
- package/lib/typescript/plugins/storageBrowser/StorageBrowserPlugin.d.ts +3 -0
- package/lib/typescript/plugins/storageBrowser/StorageBrowserPlugin.d.ts.map +1 -0
- package/lib/typescript/plugins/storageBrowser/storageAdapterRegistry.d.ts +16 -0
- package/lib/typescript/plugins/storageBrowser/storageAdapterRegistry.d.ts.map +1 -0
- package/lib/typescript/plugins/timeline/TimelinePlugin.d.ts +3 -0
- package/lib/typescript/plugins/timeline/TimelinePlugin.d.ts.map +1 -0
- package/lib/typescript/plugins/timeline/timelineStore.d.ts +24 -0
- package/lib/typescript/plugins/timeline/timelineStore.d.ts.map +1 -0
- package/package.json +131 -0
- package/src/core/DebugBubble.tsx +149 -0
- package/src/core/DebugOverlay.tsx +211 -0
- package/src/core/DebuggerProvider.tsx +211 -0
- package/src/core/GestureDetector.tsx +95 -0
- package/src/core/PluginRegistry.ts +118 -0
- package/src/core/theme.ts +41 -0
- package/src/core/types.ts +339 -0
- package/src/core/useDebugger.ts +24 -0
- package/src/core/utils.ts +221 -0
- package/src/index.ts +67 -0
- package/src/plugins/console/ConsoleInterceptor.ts +110 -0
- package/src/plugins/console/ConsoleViewerPlugin.tsx +241 -0
- package/src/plugins/crashReporter/CrashReporterPlugin.tsx +316 -0
- package/src/plugins/customActions/CustomActionsPlugin.tsx +199 -0
- package/src/plugins/customActions/actionStore.ts +49 -0
- package/src/plugins/deepLinkTester/DeepLinkTesterPlugin.tsx +213 -0
- package/src/plugins/deviceInfo/DeviceInfoPlugin.tsx +153 -0
- package/src/plugins/featureFlags/FeatureFlagsPlugin.tsx +338 -0
- package/src/plugins/featureFlags/flagStore.ts +118 -0
- package/src/plugins/navigationInspector/NavigationInspectorPlugin.tsx +170 -0
- package/src/plugins/navigationInspector/navigationStore.ts +70 -0
- package/src/plugins/network/NetworkInspectorPlugin.tsx +598 -0
- package/src/plugins/network/NetworkInterceptor.ts +344 -0
- package/src/plugins/performance/PerformanceMonitorPlugin.tsx +194 -0
- package/src/plugins/remoteConfig/RemoteConfigPlugin.tsx +205 -0
- package/src/plugins/remoteConfig/remoteConfigStore.ts +48 -0
- package/src/plugins/stateInspector/StateInspectorPlugin.tsx +342 -0
- package/src/plugins/stateInspector/stateAdapterRegistry.ts +66 -0
- package/src/plugins/storageBrowser/StorageBrowserPlugin.tsx +410 -0
- package/src/plugins/storageBrowser/storageAdapterRegistry.ts +47 -0
- package/src/plugins/timeline/TimelinePlugin.tsx +242 -0
- package/src/plugins/timeline/timelineStore.ts +65 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { Clipboard, Share, Platform } from 'react-native';
|
|
2
|
+
|
|
3
|
+
/** Generate a unique ID (collision-safe for debugging purposes). */
|
|
4
|
+
export function generateId() {
|
|
5
|
+
return `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/** Format bytes into a human-readable string. */
|
|
9
|
+
export function formatBytes(bytes) {
|
|
10
|
+
if (bytes === undefined || bytes === null) return '—';
|
|
11
|
+
if (bytes === 0) return '0 B';
|
|
12
|
+
const units = ['B', 'KB', 'MB', 'GB'];
|
|
13
|
+
const i = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
14
|
+
const value = bytes / Math.pow(1024, i);
|
|
15
|
+
return `${value.toFixed(i === 0 ? 0 : 1)} ${units[i]}`;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Format milliseconds into a readable duration. */
|
|
19
|
+
export function formatDuration(ms) {
|
|
20
|
+
if (ms === undefined || ms === null) return '—';
|
|
21
|
+
if (ms < 1) return '<1ms';
|
|
22
|
+
if (ms < 1000) return `${Math.round(ms)}ms`;
|
|
23
|
+
if (ms < 60_000) return `${(ms / 1000).toFixed(1)}s`;
|
|
24
|
+
return `${(ms / 60_000).toFixed(1)}m`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Format a UNIX timestamp into a local time string (HH:MM:SS.mmm). */
|
|
28
|
+
export function formatTimestamp(ts) {
|
|
29
|
+
const d = new Date(ts);
|
|
30
|
+
const h = d.getHours().toString().padStart(2, '0');
|
|
31
|
+
const m = d.getMinutes().toString().padStart(2, '0');
|
|
32
|
+
const s = d.getSeconds().toString().padStart(2, '0');
|
|
33
|
+
const ms = d.getMilliseconds().toString().padStart(3, '0');
|
|
34
|
+
return `${h}:${m}:${s}.${ms}`;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Format a relative time ago (e.g., "2s ago", "5m ago"). */
|
|
38
|
+
export function formatTimeAgo(ts) {
|
|
39
|
+
const diff = Date.now() - ts;
|
|
40
|
+
if (diff < 1000) return 'just now';
|
|
41
|
+
if (diff < 60_000) return `${Math.floor(diff / 1000)}s ago`;
|
|
42
|
+
if (diff < 3_600_000) return `${Math.floor(diff / 60_000)}m ago`;
|
|
43
|
+
if (diff < 86_400_000) return `${Math.floor(diff / 3_600_000)}h ago`;
|
|
44
|
+
return `${Math.floor(diff / 86_400_000)}d ago`;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Truncate a string with ellipsis if it exceeds maxLength. */
|
|
48
|
+
export function truncate(str, maxLength = 200) {
|
|
49
|
+
if (!str) return '';
|
|
50
|
+
if (str.length <= maxLength) return str;
|
|
51
|
+
return str.slice(0, maxLength) + '…';
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Safely serialize any value to a JSON string with pretty printing. */
|
|
55
|
+
export function safeStringify(value, indent = 2) {
|
|
56
|
+
try {
|
|
57
|
+
if (value === undefined) return 'undefined';
|
|
58
|
+
if (value === null) return 'null';
|
|
59
|
+
if (typeof value === 'string') return value;
|
|
60
|
+
if (typeof value === 'function') return `[Function: ${value.name || 'anonymous'}]`;
|
|
61
|
+
if (value instanceof Error) {
|
|
62
|
+
return JSON.stringify({
|
|
63
|
+
name: value.name,
|
|
64
|
+
message: value.message,
|
|
65
|
+
stack: value.stack
|
|
66
|
+
}, null, indent);
|
|
67
|
+
}
|
|
68
|
+
return JSON.stringify(value, getCircularReplacer(), indent);
|
|
69
|
+
} catch {
|
|
70
|
+
return String(value);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Safely parse a JSON string, returning null on failure. */
|
|
75
|
+
export function safeParse(str) {
|
|
76
|
+
try {
|
|
77
|
+
return JSON.parse(str);
|
|
78
|
+
} catch {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Copy text to the device clipboard. */
|
|
84
|
+
export async function copyToClipboard(text) {
|
|
85
|
+
try {
|
|
86
|
+
if (Clipboard?.setString) {
|
|
87
|
+
Clipboard.setString(text);
|
|
88
|
+
}
|
|
89
|
+
} catch {
|
|
90
|
+
// Silently fail — clipboard may not be available
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** Share text via the native share sheet. */
|
|
95
|
+
export async function shareText(text, title) {
|
|
96
|
+
try {
|
|
97
|
+
await Share.share({
|
|
98
|
+
message: text,
|
|
99
|
+
title
|
|
100
|
+
}, Platform.OS === 'ios' ? {
|
|
101
|
+
subject: title
|
|
102
|
+
} : undefined);
|
|
103
|
+
} catch {
|
|
104
|
+
// Silently fail — share may be cancelled
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** Get the HTTP status color based on the status code. */
|
|
109
|
+
export function getStatusColor(status) {
|
|
110
|
+
if (!status) return '#6B6B80';
|
|
111
|
+
if (status < 300) return '#10B981'; // green
|
|
112
|
+
if (status < 400) return '#F59E0B'; // yellow
|
|
113
|
+
return '#EF4444'; // red
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** Get the HTTP method color. */
|
|
117
|
+
export function getMethodColor(method) {
|
|
118
|
+
const colors = {
|
|
119
|
+
GET: '#3B82F6',
|
|
120
|
+
POST: '#10B981',
|
|
121
|
+
PUT: '#F59E0B',
|
|
122
|
+
PATCH: '#A78BFA',
|
|
123
|
+
DELETE: '#EF4444',
|
|
124
|
+
HEAD: '#6B6B80',
|
|
125
|
+
OPTIONS: '#6B6B80'
|
|
126
|
+
};
|
|
127
|
+
return colors[method.toUpperCase()] || '#6B6B80';
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** Get a console level color. */
|
|
131
|
+
export function getLevelColor(level) {
|
|
132
|
+
const colors = {
|
|
133
|
+
log: '#EAEAEA',
|
|
134
|
+
info: '#3B82F6',
|
|
135
|
+
warn: '#F59E0B',
|
|
136
|
+
error: '#EF4444',
|
|
137
|
+
debug: '#A78BFA'
|
|
138
|
+
};
|
|
139
|
+
return colors[level] || '#EAEAEA';
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Extract GraphQL operation name and type from request body.
|
|
144
|
+
* Returns `null` if it's not a GraphQL request.
|
|
145
|
+
*/
|
|
146
|
+
export function extractGraphQLInfo(body) {
|
|
147
|
+
if (!body) return null;
|
|
148
|
+
try {
|
|
149
|
+
const parsed = JSON.parse(body);
|
|
150
|
+
const query = parsed?.query;
|
|
151
|
+
if (!query) return null;
|
|
152
|
+
|
|
153
|
+
// Extract operation type and name
|
|
154
|
+
const match = query.match(/^\s*(query|mutation|subscription)\s+(\w+)/);
|
|
155
|
+
if (match) {
|
|
156
|
+
return {
|
|
157
|
+
type: match[1],
|
|
158
|
+
operation: match[2]
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Try named operations without explicit type
|
|
163
|
+
const nameMatch = query.match(/^\s*\{\s*(\w+)/);
|
|
164
|
+
if (nameMatch) {
|
|
165
|
+
return {
|
|
166
|
+
type: 'query',
|
|
167
|
+
operation: nameMatch[1]
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
return {
|
|
171
|
+
type: 'query',
|
|
172
|
+
operation: parsed.operationName || 'Unknown'
|
|
173
|
+
};
|
|
174
|
+
} catch {
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Convert a network request to a cURL command string.
|
|
181
|
+
*/
|
|
182
|
+
export function toCurl(request) {
|
|
183
|
+
const parts = [`curl -X ${request.method}`];
|
|
184
|
+
if (request.requestHeaders) {
|
|
185
|
+
for (const [key, value] of Object.entries(request.requestHeaders)) {
|
|
186
|
+
parts.push(`-H '${key}: ${value}'`);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
if (request.requestBody) {
|
|
190
|
+
parts.push(`-d '${request.requestBody.replace(/'/g, "\\'")}'`);
|
|
191
|
+
}
|
|
192
|
+
parts.push(`'${request.url}'`);
|
|
193
|
+
return parts.join(' \\\n ');
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/** Debounce function calls. */
|
|
197
|
+
export function debounce(fn, delay) {
|
|
198
|
+
let timer = null;
|
|
199
|
+
return (...args) => {
|
|
200
|
+
if (timer) clearTimeout(timer);
|
|
201
|
+
timer = setTimeout(() => fn(...args), delay);
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Circular reference replacer for JSON.stringify.
|
|
207
|
+
* Prevents "Converting circular structure to JSON" errors.
|
|
208
|
+
*/
|
|
209
|
+
function getCircularReplacer() {
|
|
210
|
+
const seen = new WeakSet();
|
|
211
|
+
return (_key, value) => {
|
|
212
|
+
if (typeof value === 'object' && value !== null) {
|
|
213
|
+
if (seen.has(value)) return '[Circular]';
|
|
214
|
+
seen.add(value);
|
|
215
|
+
}
|
|
216
|
+
return value;
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Clipboard","Share","Platform","generateId","Date","now","Math","random","toString","substring","formatBytes","bytes","undefined","units","i","floor","log","value","pow","toFixed","formatDuration","ms","round","formatTimestamp","ts","d","h","getHours","padStart","m","getMinutes","s","getSeconds","getMilliseconds","formatTimeAgo","diff","truncate","str","maxLength","length","slice","safeStringify","indent","name","Error","JSON","stringify","message","stack","getCircularReplacer","String","safeParse","parse","copyToClipboard","text","setString","shareText","title","share","OS","subject","getStatusColor","status","getMethodColor","method","colors","GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS","toUpperCase","getLevelColor","level","info","warn","error","debug","extractGraphQLInfo","body","parsed","query","match","type","operation","nameMatch","operationName","toCurl","request","parts","requestHeaders","key","Object","entries","push","requestBody","replace","url","join","debounce","fn","delay","timer","args","clearTimeout","setTimeout","seen","WeakSet","_key","has","add"],"sourceRoot":"../../../src","sources":["core/utils.ts"],"mappings":"AAAA,SAASA,SAAS,EAAEC,KAAK,EAAEC,QAAQ,QAAQ,cAAc;;AAEzD;AACA,OAAO,SAASC,UAAUA,CAAA,EAAW;EACnC,OAAO,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC,IAAIC,IAAI,CAACC,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,EAAE,CAAC,CAACC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;AACtE;;AAEA;AACA,OAAO,SAASC,WAAWA,CAACC,KAAyB,EAAU;EAC7D,IAAIA,KAAK,KAAKC,SAAS,IAAID,KAAK,KAAK,IAAI,EAAE,OAAO,GAAG;EACrD,IAAIA,KAAK,KAAK,CAAC,EAAE,OAAO,KAAK;EAC7B,MAAME,KAAK,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;EACrC,MAAMC,C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A2C,GAAG,IAAI;EACtD,OAAO,CAAC,GAAGC,IAAmB,KAAK;IACjC,IAAID,KAAK,EAAEE,YAAY,CAACF,KAAK,CAAC;IAC9BA,KAAK,GAAGG,UAAU,CAAC,MAAML,EAAE,CAAC,GAAGG,IAAI,CAAC,EAAEF,KAAK,CAAC;EAC9C,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA,SAAStD,mBAAmBA,CAAA,EAAG;EAC7B,MAAM2D,IAAI,GAAG,IAAIC,OAAO,CAAC,CAAC;EAC1B,OAAO,CAACC,IAAY,EAAE7F,KAAc,KAAK;IACvC,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,KAAK,IAAI,EAAE;MAC/C,IAAI2F,IAAI,CAACG,GAAG,CAAC9F,KAAK,CAAC,EAAE,OAAO,YAAY;MACxC2F,IAAI,CAACI,GAAG,CAAC/F,KAAK,CAAC;IACjB;IACA,OAAOA,KAAK;EACd,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* react-native-prod-debugger
|
|
3
|
+
*
|
|
4
|
+
* A comprehensive, in-app debugging toolkit for React Native
|
|
5
|
+
* that works in production builds.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
// ─── Core ────────────────────────────────────────────────────────────────────
|
|
11
|
+
export { DebuggerProvider } from './core/DebuggerProvider';
|
|
12
|
+
export { useDebugger } from './core/useDebugger';
|
|
13
|
+
export { PluginRegistry, registerPlugin, unregisterPlugin } from './core/PluginRegistry';
|
|
14
|
+
|
|
15
|
+
// ─── Types ───────────────────────────────────────────────────────────────────
|
|
16
|
+
|
|
17
|
+
// ─── Plugin APIs ─────────────────────────────────────────────────────────────
|
|
18
|
+
|
|
19
|
+
// Network Inspector
|
|
20
|
+
export { NetworkInterceptor } from './plugins/network/NetworkInterceptor';
|
|
21
|
+
|
|
22
|
+
// Console Viewer
|
|
23
|
+
export { ConsoleInterceptor } from './plugins/console/ConsoleInterceptor';
|
|
24
|
+
|
|
25
|
+
// Feature Flags
|
|
26
|
+
export { registerFlag, resetFlags, getFlag } from './plugins/featureFlags/flagStore';
|
|
27
|
+
|
|
28
|
+
// State Inspector
|
|
29
|
+
export { setStateAdapter, removeStateAdapter } from './plugins/stateInspector/stateAdapterRegistry';
|
|
30
|
+
// Remote Config
|
|
31
|
+
export { setRemoteConfigProvider } from './plugins/remoteConfig/remoteConfigStore';
|
|
32
|
+
|
|
33
|
+
// Storage Browser
|
|
34
|
+
export { setStorageAdapter, removeStorageAdapter } from './plugins/storageBrowser/storageAdapterRegistry';
|
|
35
|
+
|
|
36
|
+
// Navigation Inspector
|
|
37
|
+
export { setNavigationRef } from './plugins/navigationInspector/navigationStore';
|
|
38
|
+
|
|
39
|
+
// Custom Actions
|
|
40
|
+
export { registerAction, removeAction } from './plugins/customActions/actionStore';
|
|
41
|
+
|
|
42
|
+
// Timeline / Event Logger
|
|
43
|
+
export { logTimelineEvent } from './plugins/timeline/timelineStore';
|
|
44
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DebuggerProvider","useDebugger","PluginRegistry","registerPlugin","unregisterPlugin","NetworkInterceptor","ConsoleInterceptor","registerFlag","resetFlags","getFlag","setStateAdapter","removeStateAdapter","setRemoteConfigProvider","setStorageAdapter","removeStorageAdapter","setNavigationRef","registerAction","removeAction","logTimelineEvent"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAASA,gBAAgB,QAAQ,yBAAyB;AAC1D,SAASC,WAAW,QAAQ,oBAAoB;AAChD,SAASC,cAAc,EAAEC,cAAc,EAAEC,gBAAgB,QAAQ,uBAAuB;;AAExF;;AAqBA;;AAEA;AACA,SAASC,kBAAkB,QAAQ,sCAAsC;;AAEzE;AACA,SAASC,kBAAkB,QAAQ,sCAAsC;;AAEzE;AACA,SAASC,YAAY,EAAEC,UAAU,EAAEC,OAAO,QAAQ,kCAAkC;;AAEpF;AACA,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,+CAA+C;AAGnG;AACA,SAASC,uBAAuB,QAAQ,0CAA0C;;AAElF;AACA,SACEC,iBAAiB,EACjBC,oBAAoB,QACf,iDAAiD;;AAExD;AACA,SAASC,gBAAgB,QAAQ,+CAA+C;;AAEhF;AACA,SAASC,cAAc,EAAEC,YAAY,QAAQ,qCAAqC;;AAElF;AACA,SAASC,gBAAgB,QAAQ,kCAAkC","ignoreList":[]}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { generateId, safeStringify } from '../../core/utils';
|
|
2
|
+
/**
|
|
3
|
+
* ConsoleInterceptor — Captures console.log/warn/error/info/debug calls.
|
|
4
|
+
*
|
|
5
|
+
* Wraps the global console methods and stores entries in a ring buffer.
|
|
6
|
+
* Original console behavior is preserved — messages still appear in the developer console.
|
|
7
|
+
*/
|
|
8
|
+
class ConsoleInterceptorClass {
|
|
9
|
+
entries = [];
|
|
10
|
+
listeners = new Set();
|
|
11
|
+
maxEntries = 1000;
|
|
12
|
+
isActive = false;
|
|
13
|
+
originals = {
|
|
14
|
+
log: console.log,
|
|
15
|
+
info: console.info,
|
|
16
|
+
warn: console.warn,
|
|
17
|
+
error: console.error,
|
|
18
|
+
debug: console.debug
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/** Start intercepting console calls. */
|
|
22
|
+
start(maxEntries = 1000) {
|
|
23
|
+
if (this.isActive) return;
|
|
24
|
+
this.maxEntries = maxEntries;
|
|
25
|
+
this.isActive = true;
|
|
26
|
+
const levels = ['log', 'info', 'warn', 'error', 'debug'];
|
|
27
|
+
for (const level of levels) {
|
|
28
|
+
this.originals[level] = console[level].bind(console);
|
|
29
|
+
console[level] = (...args) => {
|
|
30
|
+
// Preserve original behavior
|
|
31
|
+
this.originals[level](...args);
|
|
32
|
+
// Capture entry
|
|
33
|
+
this.addEntry(level, args);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Stop intercepting and restore original console. */
|
|
39
|
+
stop() {
|
|
40
|
+
if (!this.isActive) return;
|
|
41
|
+
this.isActive = false;
|
|
42
|
+
const levels = ['log', 'info', 'warn', 'error', 'debug'];
|
|
43
|
+
for (const level of levels) {
|
|
44
|
+
console[level] = this.originals[level];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Subscribe to entry changes. Returns unsubscribe function. */
|
|
49
|
+
subscribe(listener) {
|
|
50
|
+
this.listeners.add(listener);
|
|
51
|
+
listener(this.entries);
|
|
52
|
+
return () => this.listeners.delete(listener);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Get all entries. */
|
|
56
|
+
getAll() {
|
|
57
|
+
return [...this.entries];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Clear all entries. */
|
|
61
|
+
clear() {
|
|
62
|
+
this.entries = [];
|
|
63
|
+
this.notify();
|
|
64
|
+
}
|
|
65
|
+
get active() {
|
|
66
|
+
return this.isActive;
|
|
67
|
+
}
|
|
68
|
+
addEntry(level, args) {
|
|
69
|
+
const message = args.map(arg => {
|
|
70
|
+
if (typeof arg === 'string') return arg;
|
|
71
|
+
return safeStringify(arg);
|
|
72
|
+
}).join(' ');
|
|
73
|
+
const entry = {
|
|
74
|
+
id: generateId(),
|
|
75
|
+
level,
|
|
76
|
+
timestamp: Date.now(),
|
|
77
|
+
message,
|
|
78
|
+
args
|
|
79
|
+
};
|
|
80
|
+
this.entries = [entry, ...this.entries].slice(0, this.maxEntries);
|
|
81
|
+
this.notify();
|
|
82
|
+
}
|
|
83
|
+
notify() {
|
|
84
|
+
const snapshot = this.entries;
|
|
85
|
+
for (const listener of this.listeners) {
|
|
86
|
+
try {
|
|
87
|
+
listener(snapshot);
|
|
88
|
+
} catch {
|
|
89
|
+
// Silently handle errors
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Singleton console interceptor instance. */
|
|
96
|
+
export const ConsoleInterceptor = new ConsoleInterceptorClass();
|
|
97
|
+
//# sourceMappingURL=ConsoleInterceptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["generateId","safeStringify","ConsoleInterceptorClass","entries","listeners","Set","maxEntries","isActive","originals","log","console","info","warn","error","debug","start","levels","level","bind","args","addEntry","stop","subscribe","listener","add","delete","getAll","clear","notify","active","message","map","arg","join","entry","id","timestamp","Date","now","slice","snapshot","ConsoleInterceptor"],"sourceRoot":"../../../../src","sources":["plugins/console/ConsoleInterceptor.ts"],"mappings":"AACA,SAASA,UAAU,EAAEC,aAAa,QAAQ,kBAAkB;AAI5D;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,uBAAuB,CAAC;EACpBC,OAAO,GAAmB,EAAE;EAC5BC,SAAS,GAAyB,IAAIC,GAAG,CAAC,CAAC;EAC3CC,UAAU,GAAW,IAAI;EACzBC,QAAQ,GAAY,KAAK;EAEzBC,SAAS,GAAuD;IACtEC,GAAG,EAAEC,OAAO,CAACD,GAAG;IAChBE,IAAI,EAAED,OAAO,CAACC,IAAI;IAClBC,IAAI,EAAEF,OAAO,CAACE,IAAI;IAClBC,KAAK,EAAEH,OAAO,CAACG,KAAK;IACpBC,KAAK,EAAEJ,OAAO,CAACI;EACjB,CAAC;;EAED;EACAC,KAAKA,CAACT,UAAkB,GAAG,IAAI,EAAQ;IACrC,IAAI,IAAI,CAACC,QAAQ,EAAE;IACnB,IAAI,CAACD,UAAU,GAAGA,UAAU;IAC5B,IAAI,CAACC,QAAQ,GAAG,IAAI;IAEpB,MAAMS,MAAsB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC;IACxE,KAAK,MAAMC,KAAK,IAAID,MAAM,EAAE;MAC1B,IAAI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AG,CAAEC,GAAG,IAAK;MACZ,IAAI,OAAOA,GAAG,KAAK,QAAQ,EAAE,OAAOA,GAAG;MACvC,OAAO/B,aAAa,CAAC+B,GAAG,CAAC;IAC3B,CAAC,CAAC,CACDC,IAAI,CAAC,GAAG,CAAC;IAEZ,MAAMC,KAAmB,GAAG;MAC1BC,EAAE,EAAEnC,UAAU,CAAC,CAAC;MAChBiB,KAAK;MACLmB,SAAS,EAAEC,IAAI,CAACC,GAAG,CAAC,CAAC;MACrBR,OAAO;MACPX;IACF,CAAC;IAED,IAAI,CAAChB,OAAO,GAAG,CAAC+B,KAAK,EAAE,GAAG,IAAI,CAAC/B,OAAO,CAAC,CAACoC,KAAK,CAAC,CAAC,EAAE,IAAI,CAACjC,UAAU,CAAC;IACjE,IAAI,CAACsB,MAAM,CAAC,CAAC;EACf;EAEQA,MAAMA,CAAA,EAAS;IACrB,MAAMY,QAAQ,GAAG,IAAI,CAACrC,OAAO;IAC7B,KAAK,MAAMoB,QAAQ,IAAI,IAAI,CAACnB,SAAS,EAAE;MACrC,IAAI;QACFmB,QAAQ,CAACiB,QAAQ,CAAC;MACpB,CAAC,CAAC,MAAM;QACN;MAAA;IAEJ;EACF;AACF;;AAEA;AACA,OAAO,MAAMC,kBAAkB,GAAG,IAAIvC,uBAAuB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import React, { useState, useEffect, useCallback, useMemo } from 'react';
|
|
2
|
+
import { View, Text, FlatList, TouchableOpacity, TextInput, StyleSheet, ScrollView } from 'react-native';
|
|
3
|
+
import { ConsoleInterceptor } from './ConsoleInterceptor';
|
|
4
|
+
import { formatTimestamp, getLevelColor, copyToClipboard } from '../../core/utils';
|
|
5
|
+
const ConsoleViewerPanel = ({
|
|
6
|
+
theme
|
|
7
|
+
}) => {
|
|
8
|
+
const [entries, setEntries] = useState([]);
|
|
9
|
+
const [searchQuery, setSearchQuery] = useState('');
|
|
10
|
+
const [levelFilter, setLevelFilter] = useState(null);
|
|
11
|
+
const [expandedId, setExpandedId] = useState(null);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const unsubscribe = ConsoleInterceptor.subscribe(setEntries);
|
|
14
|
+
return unsubscribe;
|
|
15
|
+
}, []);
|
|
16
|
+
const filteredEntries = useMemo(() => {
|
|
17
|
+
let filtered = entries;
|
|
18
|
+
if (levelFilter) {
|
|
19
|
+
filtered = filtered.filter(e => e.level === levelFilter);
|
|
20
|
+
}
|
|
21
|
+
if (searchQuery) {
|
|
22
|
+
const q = searchQuery.toLowerCase();
|
|
23
|
+
filtered = filtered.filter(e => e.message.toLowerCase().includes(q));
|
|
24
|
+
}
|
|
25
|
+
return filtered;
|
|
26
|
+
}, [entries, searchQuery, levelFilter]);
|
|
27
|
+
const levelCounts = useMemo(() => {
|
|
28
|
+
const counts = {
|
|
29
|
+
log: 0,
|
|
30
|
+
info: 0,
|
|
31
|
+
warn: 0,
|
|
32
|
+
error: 0,
|
|
33
|
+
debug: 0
|
|
34
|
+
};
|
|
35
|
+
for (const entry of entries) {
|
|
36
|
+
counts[entry.level]++;
|
|
37
|
+
}
|
|
38
|
+
return counts;
|
|
39
|
+
}, [entries]);
|
|
40
|
+
const handleClear = useCallback(() => {
|
|
41
|
+
ConsoleInterceptor.clear();
|
|
42
|
+
setExpandedId(null);
|
|
43
|
+
}, []);
|
|
44
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
45
|
+
style: styles.container
|
|
46
|
+
}, /*#__PURE__*/React.createElement(ScrollView, {
|
|
47
|
+
horizontal: true,
|
|
48
|
+
showsHorizontalScrollIndicator: false,
|
|
49
|
+
style: [styles.filterBar, {
|
|
50
|
+
backgroundColor: theme.surface
|
|
51
|
+
}],
|
|
52
|
+
contentContainerStyle: styles.filterContent
|
|
53
|
+
}, /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
54
|
+
style: [styles.filterChip, {
|
|
55
|
+
backgroundColor: !levelFilter ? theme.accent : theme.surfaceAlt,
|
|
56
|
+
borderColor: theme.border
|
|
57
|
+
}],
|
|
58
|
+
onPress: () => setLevelFilter(null),
|
|
59
|
+
activeOpacity: 0.7
|
|
60
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
61
|
+
style: [styles.filterText, {
|
|
62
|
+
color: !levelFilter ? '#FFF' : theme.textSecondary
|
|
63
|
+
}]
|
|
64
|
+
}, "All (", entries.length, ")")), ['error', 'warn', 'info', 'log', 'debug'].map(level => /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
65
|
+
key: level,
|
|
66
|
+
style: [styles.filterChip, {
|
|
67
|
+
backgroundColor: levelFilter === level ? getLevelColor(level) : theme.surfaceAlt,
|
|
68
|
+
borderColor: theme.border
|
|
69
|
+
}],
|
|
70
|
+
onPress: () => setLevelFilter(levelFilter === level ? null : level),
|
|
71
|
+
activeOpacity: 0.7
|
|
72
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
73
|
+
style: [styles.filterText, {
|
|
74
|
+
color: levelFilter === level ? '#FFF' : getLevelColor(level)
|
|
75
|
+
}]
|
|
76
|
+
}, level, " (", levelCounts[level], ")"))), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
77
|
+
onPress: handleClear,
|
|
78
|
+
style: [styles.filterChip, {
|
|
79
|
+
backgroundColor: theme.surfaceAlt,
|
|
80
|
+
borderColor: theme.error
|
|
81
|
+
}],
|
|
82
|
+
activeOpacity: 0.7
|
|
83
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
84
|
+
style: [styles.filterText, {
|
|
85
|
+
color: theme.error
|
|
86
|
+
}]
|
|
87
|
+
}, "Clear"))), /*#__PURE__*/React.createElement(View, {
|
|
88
|
+
style: [styles.searchContainer, {
|
|
89
|
+
backgroundColor: theme.surface
|
|
90
|
+
}]
|
|
91
|
+
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
92
|
+
style: [styles.searchInput, {
|
|
93
|
+
color: theme.text,
|
|
94
|
+
backgroundColor: theme.surfaceAlt,
|
|
95
|
+
borderColor: theme.border
|
|
96
|
+
}],
|
|
97
|
+
placeholder: "Search logs...",
|
|
98
|
+
placeholderTextColor: theme.textMuted,
|
|
99
|
+
value: searchQuery,
|
|
100
|
+
onChangeText: setSearchQuery,
|
|
101
|
+
autoCapitalize: "none"
|
|
102
|
+
})), /*#__PURE__*/React.createElement(FlatList, {
|
|
103
|
+
data: filteredEntries,
|
|
104
|
+
keyExtractor: item => item.id,
|
|
105
|
+
renderItem: ({
|
|
106
|
+
item
|
|
107
|
+
}) => /*#__PURE__*/React.createElement(ConsoleRow, {
|
|
108
|
+
entry: item,
|
|
109
|
+
theme: theme,
|
|
110
|
+
isExpanded: expandedId === item.id,
|
|
111
|
+
onToggle: () => setExpandedId(expandedId === item.id ? null : item.id)
|
|
112
|
+
}),
|
|
113
|
+
ListEmptyComponent: /*#__PURE__*/React.createElement(View, {
|
|
114
|
+
style: styles.emptyContainer
|
|
115
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
116
|
+
style: [styles.emptyText, {
|
|
117
|
+
color: theme.textMuted
|
|
118
|
+
}]
|
|
119
|
+
}, "No console output")),
|
|
120
|
+
initialNumToRender: 30,
|
|
121
|
+
maxToRenderPerBatch: 15
|
|
122
|
+
}));
|
|
123
|
+
};
|
|
124
|
+
const ConsoleRow = /*#__PURE__*/React.memo(({
|
|
125
|
+
entry,
|
|
126
|
+
theme,
|
|
127
|
+
isExpanded,
|
|
128
|
+
onToggle
|
|
129
|
+
}) => {
|
|
130
|
+
const levelColor = getLevelColor(entry.level);
|
|
131
|
+
const levelBg = `${levelColor}15`;
|
|
132
|
+
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
133
|
+
style: [styles.logRow, {
|
|
134
|
+
backgroundColor: levelBg,
|
|
135
|
+
borderBottomColor: theme.border
|
|
136
|
+
}],
|
|
137
|
+
onPress: onToggle,
|
|
138
|
+
onLongPress: () => copyToClipboard(entry.message),
|
|
139
|
+
activeOpacity: 0.7
|
|
140
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
141
|
+
style: styles.logHeader
|
|
142
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
143
|
+
style: [styles.levelBadge, {
|
|
144
|
+
backgroundColor: levelColor
|
|
145
|
+
}]
|
|
146
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
147
|
+
style: styles.levelText
|
|
148
|
+
}, entry.level.toUpperCase())), /*#__PURE__*/React.createElement(Text, {
|
|
149
|
+
style: [styles.logTimestamp, {
|
|
150
|
+
color: theme.textMuted
|
|
151
|
+
}]
|
|
152
|
+
}, formatTimestamp(entry.timestamp))), /*#__PURE__*/React.createElement(Text, {
|
|
153
|
+
style: [styles.logMessage, {
|
|
154
|
+
color: theme.text
|
|
155
|
+
}],
|
|
156
|
+
numberOfLines: isExpanded ? undefined : 3
|
|
157
|
+
}, entry.message), isExpanded && entry.message.length > 100 && /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
158
|
+
onPress: () => copyToClipboard(entry.message),
|
|
159
|
+
style: [styles.copyLogButton, {
|
|
160
|
+
backgroundColor: theme.surfaceAlt
|
|
161
|
+
}],
|
|
162
|
+
activeOpacity: 0.7
|
|
163
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
164
|
+
style: [styles.copyLogText, {
|
|
165
|
+
color: theme.accent
|
|
166
|
+
}]
|
|
167
|
+
}, "Copy")));
|
|
168
|
+
});
|
|
169
|
+
const styles = StyleSheet.create({
|
|
170
|
+
container: {
|
|
171
|
+
flex: 1
|
|
172
|
+
},
|
|
173
|
+
filterBar: {
|
|
174
|
+
maxHeight: 44
|
|
175
|
+
},
|
|
176
|
+
filterContent: {
|
|
177
|
+
paddingHorizontal: 12,
|
|
178
|
+
paddingVertical: 8,
|
|
179
|
+
gap: 6
|
|
180
|
+
},
|
|
181
|
+
filterChip: {
|
|
182
|
+
paddingHorizontal: 10,
|
|
183
|
+
paddingVertical: 4,
|
|
184
|
+
borderRadius: 12,
|
|
185
|
+
borderWidth: 1
|
|
186
|
+
},
|
|
187
|
+
filterText: {
|
|
188
|
+
fontSize: 11,
|
|
189
|
+
fontWeight: '600'
|
|
190
|
+
},
|
|
191
|
+
searchContainer: {
|
|
192
|
+
paddingHorizontal: 12,
|
|
193
|
+
paddingBottom: 8
|
|
194
|
+
},
|
|
195
|
+
searchInput: {
|
|
196
|
+
height: 36,
|
|
197
|
+
borderRadius: 8,
|
|
198
|
+
paddingHorizontal: 12,
|
|
199
|
+
fontSize: 13,
|
|
200
|
+
borderWidth: 1
|
|
201
|
+
},
|
|
202
|
+
logRow: {
|
|
203
|
+
paddingHorizontal: 12,
|
|
204
|
+
paddingVertical: 8,
|
|
205
|
+
borderBottomWidth: StyleSheet.hairlineWidth
|
|
206
|
+
},
|
|
207
|
+
logHeader: {
|
|
208
|
+
flexDirection: 'row',
|
|
209
|
+
alignItems: 'center',
|
|
210
|
+
gap: 8,
|
|
211
|
+
marginBottom: 4
|
|
212
|
+
},
|
|
213
|
+
levelBadge: {
|
|
214
|
+
paddingHorizontal: 6,
|
|
215
|
+
paddingVertical: 1,
|
|
216
|
+
borderRadius: 4
|
|
217
|
+
},
|
|
218
|
+
levelText: {
|
|
219
|
+
fontSize: 9,
|
|
220
|
+
fontWeight: '800',
|
|
221
|
+
color: '#FFF',
|
|
222
|
+
letterSpacing: 0.5
|
|
223
|
+
},
|
|
224
|
+
logTimestamp: {
|
|
225
|
+
fontSize: 10
|
|
226
|
+
},
|
|
227
|
+
logMessage: {
|
|
228
|
+
fontSize: 12,
|
|
229
|
+
fontFamily: 'monospace',
|
|
230
|
+
lineHeight: 18
|
|
231
|
+
},
|
|
232
|
+
copyLogButton: {
|
|
233
|
+
marginTop: 8,
|
|
234
|
+
alignSelf: 'flex-start',
|
|
235
|
+
paddingHorizontal: 10,
|
|
236
|
+
paddingVertical: 4,
|
|
237
|
+
borderRadius: 6
|
|
238
|
+
},
|
|
239
|
+
copyLogText: {
|
|
240
|
+
fontSize: 11,
|
|
241
|
+
fontWeight: '600'
|
|
242
|
+
},
|
|
243
|
+
emptyContainer: {
|
|
244
|
+
alignItems: 'center',
|
|
245
|
+
paddingVertical: 40
|
|
246
|
+
},
|
|
247
|
+
emptyText: {
|
|
248
|
+
fontSize: 13
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
export function createConsoleViewerPlugin() {
|
|
252
|
+
return {
|
|
253
|
+
id: 'console-viewer',
|
|
254
|
+
name: 'Console',
|
|
255
|
+
icon: '📋',
|
|
256
|
+
component: ConsoleViewerPanel,
|
|
257
|
+
order: 20,
|
|
258
|
+
onInit: () => ConsoleInterceptor.start(),
|
|
259
|
+
onDestroy: () => ConsoleInterceptor.stop()
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
//# sourceMappingURL=ConsoleViewerPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useState","useEffect","useCallback","useMemo","View","Text","FlatList","TouchableOpacity","TextInput","StyleSheet","ScrollView","ConsoleInterceptor","formatTimestamp","getLevelColor","copyToClipboard","ConsoleViewerPanel","theme","entries","setEntries","searchQuery","setSearchQuery","levelFilter","setLevelFilter","expandedId","setExpandedId","unsubscribe","subscribe","filteredEntries","filtered","filter","e","level","q","toLowerCase","message","includes","levelCounts","counts","log","info","warn","error","debug","entry","handleClear","clear","createElement","style","styles","container","horizontal","showsHorizontalScrollIndicator","filterBar","backgroundColor","surface","contentContainerStyle","filterContent","filterChip","accent","surfaceAlt","borderColor","border","onPress","activeOpacity","filterText","color","textSecondary","length","map","key","searchContainer","searchInput","text","placeholder","placeholderTextColor","textMuted","value","onChangeText","autoCapitalize","data","keyExtractor","item","id","renderItem","ConsoleRow","isExpanded","onToggle","ListEmptyComponent","emptyContainer","emptyText","initialNumToRender","maxToRenderPerBatch","memo","levelColor","levelBg","logRow","borderBottomColor","onLongPress","logHeader","levelBadge","levelText","toUpperCase","logTimestamp","timestamp","logMessage","numberOfLines","undefined","copyLogButton","copyLogText","create","flex","maxHeight","paddingHorizontal","paddingVertical","gap","borderRadius","borderWidth","fontSize","fontWeight","paddingBottom","height","borderBottomWidth","hairlineWidth","flexDirection","alignItems","marginBottom","letterSpacing","fontFamily","lineHeight","marginTop","alignSelf","createConsoleViewerPlugin","name","icon","component","order","onInit","start","onDestroy","stop"],"sourceRoot":"../../../../src","sources":["plugins/console/ConsoleViewerPlugin.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,EAAEC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AACxE,SACEC,IAAI,EACJC,IAAI,EACJC,QAAQ,EACRC,gBAAgB,EAChBC,SAAS,EACTC,UAAU,EACVC,UAAU,QACL,cAAc;AAOrB,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,SAASC,eAAe,EAAEC,aAAa,EAAEC,eAAe,QAAQ,kBAAkB;AAElF,MAAMC,kBAAkD,GAAGA,CAAC;EAAEC;AAAM,CAAC,KAAK;EACxE,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGlB,QAAQ,CAAiB,EAAE,CAAC;EAC1D,MAAM,CAACmB,WAAW,EAAEC,cAAc,CAAC,GAAGpB,QAAQ,CAAC,EAAE,CAAC;EAClD,MAAM,CAACqB,WAAW,EAAEC,cAAc,CAAC,GAAGtB,QAAQ,CAAsB,IAAI,CAAC;EACzE,MAAM,CAACuB,UAAU,EAAEC,aAAa,CAAC,GAAGxB,QAAQ,CAAgB,IAAI,CAAC;EAEjEC,SAAS,CAAC,MAAM;IACd,MAAMwB,WAAW,GAAGd,kBAAkB,CAACe,SAAS,CAACR,UAAU,CAAC;IAC5D,OAAOO,WAAW;EACpB,CAAC,EAAE,EAAE,CAAC;EAEN,MAAME,eAAe,GAAGxB,OAAO,CAAC,MAAM;IACpC,IAAIyB,QAAQ,GAAGX,OAAO;IACtB,IAAII,WAAW,EAAE;MACfO,QAAQ,GAAGA,QAAQ,CAACC,MAAM,CAAEC,CAAC,IAAKA,CAAC,CAACC,KAAK,KAAKV,WAAW,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