react-native-debug-toolkit 0.6.4 → 2.1.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 +149 -211
- package/README.zh-CN.md +150 -171
- package/lib/commonjs/components/ClipboardTab.js +91 -0
- package/lib/commonjs/components/ClipboardTab.js.map +1 -0
- package/lib/commonjs/components/ConsoleLogTab.js +162 -0
- package/lib/commonjs/components/ConsoleLogTab.js.map +1 -0
- package/lib/commonjs/components/DebugPanel.js +230 -0
- package/lib/commonjs/components/DebugPanel.js.map +1 -0
- package/lib/commonjs/components/DebugView.js +66 -0
- package/lib/commonjs/components/DebugView.js.map +1 -0
- package/lib/commonjs/components/EnvironmentTab.js +287 -0
- package/lib/commonjs/components/EnvironmentTab.js.map +1 -0
- package/lib/commonjs/components/FeatureTabBar.js +182 -0
- package/lib/commonjs/components/FeatureTabBar.js.map +1 -0
- package/lib/commonjs/components/FloatIcon.js +187 -0
- package/lib/commonjs/components/FloatIcon.js.map +1 -0
- package/lib/commonjs/components/FloatPanelView.js +214 -0
- package/lib/commonjs/components/FloatPanelView.js.map +1 -0
- package/lib/commonjs/components/NavigationLogTab.js +131 -0
- package/lib/commonjs/components/NavigationLogTab.js.map +1 -0
- package/lib/commonjs/components/NetworkLogTab.js +404 -0
- package/lib/commonjs/components/NetworkLogTab.js.map +1 -0
- package/lib/commonjs/components/ThirdPartyLibsTab.js +97 -0
- package/lib/commonjs/components/ThirdPartyLibsTab.js.map +1 -0
- package/lib/commonjs/components/TrackLogTab.js +230 -0
- package/lib/commonjs/components/TrackLogTab.js.map +1 -0
- package/lib/commonjs/components/ZustandLogTab.js +311 -0
- package/lib/commonjs/components/ZustandLogTab.js.map +1 -0
- package/lib/commonjs/components/shared/CollapsibleSection.js +84 -0
- package/lib/commonjs/components/shared/CollapsibleSection.js.map +1 -0
- package/lib/commonjs/components/shared/CopyButton.js +64 -0
- package/lib/commonjs/components/shared/CopyButton.js.map +1 -0
- package/lib/commonjs/components/shared/JsonView.js +157 -0
- package/lib/commonjs/components/shared/JsonView.js.map +1 -0
- package/lib/commonjs/components/shared/LogListScreen.js +174 -0
- package/lib/commonjs/components/shared/LogListScreen.js.map +1 -0
- package/lib/commonjs/core/DebugToolkit.js +122 -0
- package/lib/commonjs/core/DebugToolkit.js.map +1 -0
- package/lib/commonjs/core/DebugToolkitProvider.js +66 -0
- package/lib/commonjs/core/DebugToolkitProvider.js.map +1 -0
- package/lib/commonjs/features/ClipboardFeature.js +21 -0
- package/lib/commonjs/features/ClipboardFeature.js.map +1 -0
- package/lib/commonjs/features/ConsoleLogFeature.js +115 -0
- package/lib/commonjs/features/ConsoleLogFeature.js.map +1 -0
- package/lib/commonjs/features/EnvironmentFeature.js +160 -0
- package/lib/commonjs/features/EnvironmentFeature.js.map +1 -0
- package/lib/commonjs/features/NavigationLogFeature.js +39 -0
- package/lib/commonjs/features/NavigationLogFeature.js.map +1 -0
- package/lib/commonjs/features/NetworkFeature.js +107 -0
- package/lib/commonjs/features/NetworkFeature.js.map +1 -0
- package/lib/commonjs/features/ThirdPartyLibsFeature.js +51 -0
- package/lib/commonjs/features/ThirdPartyLibsFeature.js.map +1 -0
- package/lib/commonjs/features/TrackFeature.js +34 -0
- package/lib/commonjs/features/TrackFeature.js.map +1 -0
- package/lib/commonjs/features/ZustandLogFeature.js +59 -0
- package/lib/commonjs/features/ZustandLogFeature.js.map +1 -0
- package/lib/commonjs/hooks/useNavigationLogger.js +78 -0
- package/lib/commonjs/hooks/useNavigationLogger.js.map +1 -0
- package/lib/commonjs/hooks/useSlideDetailAnimation.js +53 -0
- package/lib/commonjs/hooks/useSlideDetailAnimation.js.map +1 -0
- package/lib/commonjs/index.js +152 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/initialize.js +84 -0
- package/lib/commonjs/initialize.js.map +1 -0
- package/lib/commonjs/interceptors/networkInterceptor.js +466 -0
- package/lib/commonjs/interceptors/networkInterceptor.js.map +1 -0
- package/lib/commonjs/native/NativeDebugLibs.js +58 -0
- package/lib/commonjs/native/NativeDebugLibs.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/types/index.js +6 -0
- package/lib/commonjs/types/index.js.map +1 -0
- package/lib/commonjs/utils/colors.js +48 -0
- package/lib/commonjs/utils/colors.js.map +1 -0
- package/lib/commonjs/utils/copyToComputer.js +97 -0
- package/lib/commonjs/utils/copyToComputer.js.map +1 -0
- package/lib/commonjs/utils/createChannelFeature.js +48 -0
- package/lib/commonjs/utils/createChannelFeature.js.map +1 -0
- package/lib/commonjs/utils/createEventChannel.js +21 -0
- package/lib/commonjs/utils/createEventChannel.js.map +1 -0
- package/lib/commonjs/utils/createObservableStore.js +38 -0
- package/lib/commonjs/utils/createObservableStore.js.map +1 -0
- package/lib/commonjs/utils/layout.js +8 -0
- package/lib/commonjs/utils/layout.js.map +1 -0
- package/lib/commonjs/utils/safeStringify.js +27 -0
- package/lib/commonjs/utils/safeStringify.js.map +1 -0
- package/lib/commonjs/utils/urlRewriterRegistry.js +14 -0
- package/lib/commonjs/utils/urlRewriterRegistry.js.map +1 -0
- package/lib/module/components/ClipboardTab.js +86 -0
- package/lib/module/components/ClipboardTab.js.map +1 -0
- package/lib/module/components/ConsoleLogTab.js +157 -0
- package/lib/module/components/ConsoleLogTab.js.map +1 -0
- package/lib/module/components/DebugPanel.js +225 -0
- package/lib/module/components/DebugPanel.js.map +1 -0
- package/lib/module/components/DebugView.js +61 -0
- package/lib/module/components/DebugView.js.map +1 -0
- package/lib/module/components/EnvironmentTab.js +282 -0
- package/lib/module/components/EnvironmentTab.js.map +1 -0
- package/lib/module/components/FeatureTabBar.js +177 -0
- package/lib/module/components/FeatureTabBar.js.map +1 -0
- package/lib/module/components/FloatIcon.js +182 -0
- package/lib/module/components/FloatIcon.js.map +1 -0
- package/lib/module/components/FloatPanelView.js +209 -0
- package/lib/module/components/FloatPanelView.js.map +1 -0
- package/lib/module/components/NavigationLogTab.js +126 -0
- package/lib/module/components/NavigationLogTab.js.map +1 -0
- package/lib/module/components/NetworkLogTab.js +399 -0
- package/lib/module/components/NetworkLogTab.js.map +1 -0
- package/lib/module/components/ThirdPartyLibsTab.js +91 -0
- package/lib/module/components/ThirdPartyLibsTab.js.map +1 -0
- package/lib/module/components/TrackLogTab.js +225 -0
- package/lib/module/components/TrackLogTab.js.map +1 -0
- package/lib/module/components/ZustandLogTab.js +306 -0
- package/lib/module/components/ZustandLogTab.js.map +1 -0
- package/lib/module/components/shared/CollapsibleSection.js +78 -0
- package/lib/module/components/shared/CollapsibleSection.js.map +1 -0
- package/lib/module/components/shared/CopyButton.js +58 -0
- package/lib/module/components/shared/CopyButton.js.map +1 -0
- package/lib/module/components/shared/JsonView.js +152 -0
- package/lib/module/components/shared/JsonView.js.map +1 -0
- package/lib/module/components/shared/LogListScreen.js +169 -0
- package/lib/module/components/shared/LogListScreen.js.map +1 -0
- package/lib/module/core/DebugToolkit.js +118 -0
- package/lib/module/core/DebugToolkit.js.map +1 -0
- package/lib/module/core/DebugToolkitProvider.js +60 -0
- package/lib/module/core/DebugToolkitProvider.js.map +1 -0
- package/lib/module/features/ClipboardFeature.js +16 -0
- package/lib/module/features/ClipboardFeature.js.map +1 -0
- package/lib/module/features/ConsoleLogFeature.js +109 -0
- package/lib/module/features/ConsoleLogFeature.js.map +1 -0
- package/lib/module/features/EnvironmentFeature.js +156 -0
- package/lib/module/features/EnvironmentFeature.js.map +1 -0
- package/lib/module/features/NavigationLogFeature.js +32 -0
- package/lib/module/features/NavigationLogFeature.js.map +1 -0
- package/lib/module/features/NetworkFeature.js +101 -0
- package/lib/module/features/NetworkFeature.js.map +1 -0
- package/lib/module/features/ThirdPartyLibsFeature.js +46 -0
- package/lib/module/features/ThirdPartyLibsFeature.js.map +1 -0
- package/lib/module/features/TrackFeature.js +27 -0
- package/lib/module/features/TrackFeature.js.map +1 -0
- package/lib/module/features/ZustandLogFeature.js +53 -0
- package/lib/module/features/ZustandLogFeature.js.map +1 -0
- package/lib/module/hooks/useNavigationLogger.js +74 -0
- package/lib/module/hooks/useNavigationLogger.js.map +1 -0
- package/lib/module/hooks/useSlideDetailAnimation.js +50 -0
- package/lib/module/hooks/useSlideDetailAnimation.js.map +1 -0
- package/lib/module/index.js +28 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/initialize.js +80 -0
- package/lib/module/initialize.js.map +1 -0
- package/lib/module/interceptors/networkInterceptor.js +460 -0
- package/lib/module/interceptors/networkInterceptor.js.map +1 -0
- package/lib/module/native/NativeDebugLibs.js +54 -0
- package/lib/module/native/NativeDebugLibs.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/types/index.js +4 -0
- package/lib/module/types/index.js.map +1 -0
- package/lib/module/utils/colors.js +43 -0
- package/lib/module/utils/colors.js.map +1 -0
- package/lib/module/utils/copyToComputer.js +91 -0
- package/lib/module/utils/copyToComputer.js.map +1 -0
- package/lib/module/utils/createChannelFeature.js +44 -0
- package/lib/module/utils/createChannelFeature.js.map +1 -0
- package/lib/module/utils/createEventChannel.js +17 -0
- package/lib/module/utils/createEventChannel.js.map +1 -0
- package/lib/module/utils/createObservableStore.js +34 -0
- package/lib/module/utils/createObservableStore.js.map +1 -0
- package/lib/module/utils/layout.js +4 -0
- package/lib/module/utils/layout.js.map +1 -0
- package/lib/module/utils/safeStringify.js +23 -0
- package/lib/module/utils/safeStringify.js.map +1 -0
- package/lib/module/utils/urlRewriterRegistry.js +10 -0
- package/lib/module/utils/urlRewriterRegistry.js.map +1 -0
- package/lib/typescript/src/components/ClipboardTab.d.ts +4 -0
- package/lib/typescript/src/components/ClipboardTab.d.ts.map +1 -0
- package/lib/typescript/src/components/ConsoleLogTab.d.ts +4 -0
- package/lib/typescript/src/components/ConsoleLogTab.d.ts.map +1 -0
- package/lib/typescript/src/components/DebugPanel.d.ts +9 -0
- package/lib/typescript/src/components/DebugPanel.d.ts.map +1 -0
- package/lib/typescript/src/components/DebugView.d.ts +19 -0
- package/lib/typescript/src/components/DebugView.d.ts.map +1 -0
- package/lib/typescript/src/components/EnvironmentTab.d.ts +4 -0
- package/lib/typescript/src/components/EnvironmentTab.d.ts.map +1 -0
- package/lib/typescript/src/components/FeatureTabBar.d.ts +13 -0
- package/lib/typescript/src/components/FeatureTabBar.d.ts.map +1 -0
- package/lib/typescript/src/components/FloatIcon.d.ts +12 -0
- package/lib/typescript/src/components/FloatIcon.d.ts.map +1 -0
- package/lib/typescript/src/components/FloatPanelView.d.ts +9 -0
- package/lib/typescript/src/components/FloatPanelView.d.ts.map +1 -0
- package/lib/typescript/src/components/NavigationLogTab.d.ts +4 -0
- package/lib/typescript/src/components/NavigationLogTab.d.ts.map +1 -0
- package/lib/typescript/src/components/NetworkLogTab.d.ts +4 -0
- package/lib/typescript/src/components/NetworkLogTab.d.ts.map +1 -0
- package/lib/typescript/src/components/ThirdPartyLibsTab.d.ts +4 -0
- package/lib/typescript/src/components/ThirdPartyLibsTab.d.ts.map +1 -0
- package/lib/typescript/src/components/TrackLogTab.d.ts +4 -0
- package/lib/typescript/src/components/TrackLogTab.d.ts.map +1 -0
- package/lib/typescript/src/components/ZustandLogTab.d.ts +4 -0
- package/lib/typescript/src/components/ZustandLogTab.d.ts.map +1 -0
- package/lib/typescript/src/components/shared/CollapsibleSection.d.ts +9 -0
- package/lib/typescript/src/components/shared/CollapsibleSection.d.ts.map +1 -0
- package/lib/typescript/src/components/shared/CopyButton.d.ts +12 -0
- package/lib/typescript/src/components/shared/CopyButton.d.ts.map +1 -0
- package/lib/typescript/src/components/shared/JsonView.d.ts +6 -0
- package/lib/typescript/src/components/shared/JsonView.d.ts.map +1 -0
- package/lib/typescript/src/components/shared/LogListScreen.d.ts +21 -0
- package/lib/typescript/src/components/shared/LogListScreen.d.ts.map +1 -0
- package/lib/typescript/src/core/DebugToolkit.d.ts +20 -0
- package/lib/typescript/src/core/DebugToolkit.d.ts.map +1 -0
- package/lib/typescript/src/core/DebugToolkitProvider.d.ts +15 -0
- package/lib/typescript/src/core/DebugToolkitProvider.d.ts.map +1 -0
- package/lib/typescript/src/features/ClipboardFeature.d.ts +7 -0
- package/lib/typescript/src/features/ClipboardFeature.d.ts.map +1 -0
- package/lib/typescript/src/features/ConsoleLogFeature.d.ts +9 -0
- package/lib/typescript/src/features/ConsoleLogFeature.d.ts.map +1 -0
- package/lib/typescript/src/features/EnvironmentFeature.d.ts +8 -0
- package/lib/typescript/src/features/EnvironmentFeature.d.ts.map +1 -0
- package/lib/typescript/src/features/NavigationLogFeature.d.ts +10 -0
- package/lib/typescript/src/features/NavigationLogFeature.d.ts.map +1 -0
- package/lib/typescript/src/features/NetworkFeature.d.ts +15 -0
- package/lib/typescript/src/features/NetworkFeature.d.ts.map +1 -0
- package/lib/typescript/src/features/ThirdPartyLibsFeature.d.ts +3 -0
- package/lib/typescript/src/features/ThirdPartyLibsFeature.d.ts.map +1 -0
- package/lib/typescript/src/features/TrackFeature.d.ts +14 -0
- package/lib/typescript/src/features/TrackFeature.d.ts.map +1 -0
- package/lib/typescript/src/features/ZustandLogFeature.d.ts +31 -0
- package/lib/typescript/src/features/ZustandLogFeature.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useNavigationLogger.d.ts +13 -0
- package/lib/typescript/src/hooks/useNavigationLogger.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useSlideDetailAnimation.d.ts +11 -0
- package/lib/typescript/src/hooks/useSlideDetailAnimation.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +26 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/initialize.d.ts +32 -0
- package/lib/typescript/src/initialize.d.ts.map +1 -0
- package/lib/typescript/src/interceptors/networkInterceptor.d.ts +18 -0
- package/lib/typescript/src/interceptors/networkInterceptor.d.ts.map +1 -0
- package/lib/typescript/src/native/NativeDebugLibs.d.ts +11 -0
- package/lib/typescript/src/native/NativeDebugLibs.d.ts.map +1 -0
- package/lib/typescript/src/types/index.d.ts +109 -0
- package/lib/typescript/src/types/index.d.ts.map +1 -0
- package/lib/typescript/src/utils/colors.d.ts +21 -0
- package/lib/typescript/src/utils/colors.d.ts.map +1 -0
- package/lib/typescript/src/utils/copyToComputer.d.ts +30 -0
- package/lib/typescript/src/utils/copyToComputer.d.ts.map +1 -0
- package/lib/typescript/src/utils/createChannelFeature.d.ts +18 -0
- package/lib/typescript/src/utils/createChannelFeature.d.ts.map +1 -0
- package/lib/typescript/src/utils/createEventChannel.d.ts +7 -0
- package/lib/typescript/src/utils/createEventChannel.d.ts.map +1 -0
- package/lib/typescript/src/utils/createObservableStore.d.ts +9 -0
- package/lib/typescript/src/utils/createObservableStore.d.ts.map +1 -0
- package/lib/typescript/src/utils/layout.d.ts +2 -0
- package/lib/typescript/src/utils/layout.d.ts.map +1 -0
- package/lib/typescript/src/utils/safeStringify.d.ts +6 -0
- package/lib/typescript/src/utils/safeStringify.d.ts.map +1 -0
- package/lib/typescript/src/utils/urlRewriterRegistry.d.ts +7 -0
- package/lib/typescript/src/utils/urlRewriterRegistry.d.ts.map +1 -0
- package/package.json +67 -24
- package/src/components/ClipboardTab.tsx +81 -0
- package/src/components/ConsoleLogTab.tsx +95 -0
- package/src/components/DebugPanel.tsx +215 -0
- package/src/components/DebugView.tsx +80 -0
- package/src/components/EnvironmentTab.tsx +276 -0
- package/src/components/FeatureTabBar.tsx +204 -0
- package/src/components/FloatIcon.tsx +171 -0
- package/src/components/FloatPanelView.tsx +202 -0
- package/src/components/NavigationLogTab.tsx +66 -0
- package/src/components/NetworkLogTab.tsx +270 -0
- package/src/components/ThirdPartyLibsTab.tsx +63 -0
- package/src/components/TrackLogTab.tsx +110 -0
- package/src/components/ZustandLogTab.tsx +203 -0
- package/src/components/shared/CollapsibleSection.tsx +78 -0
- package/src/components/shared/CopyButton.tsx +68 -0
- package/src/components/shared/JsonView.tsx +125 -0
- package/src/components/shared/LogListScreen.tsx +164 -0
- package/src/core/DebugToolkit.tsx +150 -0
- package/src/core/DebugToolkitProvider.tsx +83 -0
- package/src/features/ClipboardFeature.ts +15 -0
- package/src/features/ConsoleLogFeature.ts +116 -0
- package/src/features/EnvironmentFeature.ts +186 -0
- package/src/features/NavigationLogFeature.ts +44 -0
- package/src/features/NetworkFeature.ts +126 -0
- package/src/features/ThirdPartyLibsFeature.ts +42 -0
- package/src/features/TrackFeature.ts +34 -0
- package/src/features/ZustandLogFeature.ts +101 -0
- package/src/hooks/useNavigationLogger.ts +102 -0
- package/src/hooks/useSlideDetailAnimation.ts +45 -0
- package/src/index.ts +48 -0
- package/src/initialize.ts +122 -0
- package/src/interceptors/networkInterceptor.ts +646 -0
- package/src/native/NativeDebugLibs.ts +74 -0
- package/src/types/index.ts +127 -0
- package/src/utils/colors.ts +38 -0
- package/src/utils/copyToComputer.ts +104 -0
- package/src/utils/createChannelFeature.ts +55 -0
- package/src/utils/createEventChannel.ts +22 -0
- package/src/utils/createObservableStore.ts +42 -0
- package/src/utils/layout.ts +1 -0
- package/src/utils/safeStringify.ts +25 -0
- package/src/utils/urlRewriterRegistry.ts +10 -0
- package/.cursor/rules/react-native.mdc +0 -41
- package/index.js +0 -41
- package/ios/BuildTypeModule.h +0 -9
- package/ios/BuildTypeModule.m +0 -42
- package/ios/RNDebugLibs.h +0 -10
- package/ios/RNDebugLibs.m +0 -79
- package/lib/DebugToolKit.js +0 -126
- package/lib/EnvironmentManager.ts +0 -80
- package/lib/NativeDebugLibs.js +0 -67
- package/lib/features/ConsoleLogFeature.js +0 -70
- package/lib/features/NavigationLogFeature.js +0 -45
- package/lib/features/NetworkFeature.js +0 -389
- package/lib/features/PerformanceFeature.js +0 -390
- package/lib/features/ThirdPartyLibsFeature.js +0 -63
- package/lib/features/TrackFeature.js +0 -94
- package/lib/features/ZustandLogFeature.js +0 -44
- package/lib/hooks/useNavigationLogger.js +0 -92
- package/lib/index.js +0 -114
- package/lib/navigation/NavigationLogger.js +0 -1
- package/lib/types/TrackTypes.ts +0 -92
- package/lib/utils/DebugConst.js +0 -67
- package/lib/utils/StorageUtils.js +0 -80
- package/lib/views/ConsoleLogDetails.js +0 -314
- package/lib/views/FloatPanelView.js +0 -697
- package/lib/views/HttpLogDetails.js +0 -648
- package/lib/views/NavigationLogDetails.js +0 -302
- package/lib/views/RestartModal.js +0 -75
- package/lib/views/SubViewConsoleLogs.js +0 -209
- package/lib/views/SubViewEnvironment.js +0 -73
- package/lib/views/SubViewHTTPLogs.js +0 -235
- package/lib/views/SubViewNavigationLogs.js +0 -199
- package/lib/views/SubViewPerformance.js +0 -515
- package/lib/views/SubViewThirdPartyLibs.js +0 -239
- package/lib/views/SubViewTrackLogs.js +0 -318
- package/lib/views/SubViewZustandLogs.js +0 -279
- package/lib/views/TabView.js +0 -66
- package/lib/views/TrackLogDetails.js +0 -481
- package/lib/views/ZustandLogDetails.js +0 -355
- package/react-native-debug-toolkit.podspec +0 -25
- package/react-native.config.js +0 -18
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 zcj
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,271 +1,209 @@
|
|
|
1
1
|
# React Native Debug Toolkit
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[中文文档](README.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install react-native-debug-toolkit
|
|
9
|
-
# or
|
|
10
|
-
yarn add react-native-debug-toolkit
|
|
11
|
-
```
|
|
5
|
+
A dev-only floating debug panel for React Native — inspect network, console, state, navigation and more, right on your device.
|
|
12
6
|
|
|
13
|
-
|
|
7
|
+
> Zero impact on production builds (`__DEV__` only).
|
|
14
8
|
|
|
15
|
-
|
|
9
|
+
## Features
|
|
16
10
|
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
- **Network** — Auto-intercepts fetch / XMLHttpRequest, inspect requests & responses, copy as cURL
|
|
12
|
+
- **Console** — Capture `console.log / info / warn / error`
|
|
13
|
+
- **Zustand** — Log state transitions via middleware
|
|
14
|
+
- **Navigation** — Track route changes
|
|
15
|
+
- **Track** — Record custom analytics events
|
|
16
|
+
- **Environment** — Switch API hosts on the fly
|
|
17
|
+
- **Clipboard** — Paste text and copy to computer
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
pod 'FLEX', :configurations => ['Debug']
|
|
22
|
-
pod 'DoraemonKit/Core', :configurations => ['Debug']
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
3. Add the following code to your AppDelegate.m in the `didFinishLaunchingWithOptions` method:
|
|
26
|
-
|
|
27
|
-
```objc
|
|
28
|
-
#ifdef DEBUG
|
|
29
|
-
#import <DoraemonKit/DoraemonManager.h>
|
|
30
|
-
#endif
|
|
19
|
+
## Installation
|
|
31
20
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
doKit.autoDock = false;
|
|
35
|
-
[doKit install];
|
|
36
|
-
[doKit hiddenDoraemon];
|
|
37
|
-
#endif
|
|
21
|
+
```bash
|
|
22
|
+
npm install react-native-debug-toolkit
|
|
38
23
|
```
|
|
39
24
|
|
|
40
|
-
|
|
25
|
+
Optional — clipboard copy support:
|
|
41
26
|
|
|
42
27
|
```bash
|
|
43
|
-
|
|
28
|
+
npm install @react-native-clipboard/clipboard
|
|
44
29
|
```
|
|
45
30
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
1. Add the following to your `android/settings.gradle`:
|
|
31
|
+
## Quick Start
|
|
49
32
|
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
project(':react-native-debug-toolkit').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-debug-toolkit/android')
|
|
53
|
-
```
|
|
33
|
+
```tsx
|
|
34
|
+
import { DebugView } from 'react-native-debug-toolkit';
|
|
54
35
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
debugImplementation 'io.github.didi.dokit:dokitx:3.7.1'
|
|
62
|
-
releaseImplementation 'io.github.didi.dokit:dokitx-no-op:3.7.1'
|
|
63
|
-
debugImplementation 'com.android.volley:volley:1.2.0'
|
|
64
|
-
|
|
65
|
-
implementation project(':react-native-debug-toolkit')
|
|
36
|
+
function App() {
|
|
37
|
+
return (
|
|
38
|
+
<DebugView>
|
|
39
|
+
<AppContent />
|
|
40
|
+
</DebugView>
|
|
41
|
+
);
|
|
66
42
|
}
|
|
67
43
|
```
|
|
68
44
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
```kotlin
|
|
72
|
-
import com.didichuxing.doraemonkit.DoKit
|
|
73
|
-
|
|
74
|
-
// Inside onCreate method
|
|
75
|
-
if (BuildConfig.DEBUG) {
|
|
76
|
-
DoKit.Builder(this)
|
|
77
|
-
.build()
|
|
78
|
-
DoKit.hide()
|
|
79
|
-
}
|
|
80
|
-
```
|
|
45
|
+
That's it. A floating debug button appears in dev mode. Tap to open the panel.
|
|
81
46
|
|
|
82
|
-
|
|
47
|
+
Network (fetch and XMLHttpRequest), console, navigation, track, and clipboard features are enabled by default. In React Native and Expo, Axios is covered through the XMLHttpRequest layer, so no Axios setup is required.
|
|
83
48
|
|
|
84
|
-
|
|
49
|
+
### With Navigation Tracking
|
|
85
50
|
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
import
|
|
89
|
-
import {
|
|
51
|
+
```tsx
|
|
52
|
+
import { useRef } from 'react';
|
|
53
|
+
import { DebugView } from 'react-native-debug-toolkit';
|
|
54
|
+
import { NavigationContainer } from '@react-navigation/native';
|
|
90
55
|
|
|
91
56
|
function App() {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
return () => {
|
|
102
|
-
// Cleanup happens automatically
|
|
103
|
-
};
|
|
104
|
-
}, []);
|
|
105
|
-
|
|
106
|
-
return <YourApp />;
|
|
57
|
+
const navRef = useRef(null);
|
|
58
|
+
return (
|
|
59
|
+
<DebugView navigationRef={navRef}>
|
|
60
|
+
<NavigationContainer ref={navRef}>
|
|
61
|
+
<AppContent />
|
|
62
|
+
</NavigationContainer>
|
|
63
|
+
</DebugView>
|
|
64
|
+
);
|
|
107
65
|
}
|
|
108
66
|
```
|
|
109
67
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
68
|
+
### With Environment Switching
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
<DebugView
|
|
72
|
+
environments={[
|
|
73
|
+
{ id: 'dev', label: 'Dev', host: 'dev-api.example.com', color: '#34C759' },
|
|
74
|
+
{ id: 'prod', label: 'Prod', host: 'api.example.com', color: '#FF3B30' },
|
|
75
|
+
]}
|
|
76
|
+
>
|
|
77
|
+
<AppContent />
|
|
78
|
+
</DebugView>
|
|
79
|
+
```
|
|
113
80
|
|
|
114
|
-
|
|
81
|
+
### Disable Specific Features
|
|
115
82
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
83
|
+
```tsx
|
|
84
|
+
<DebugView features={{ clipboard: false, zustand: false }}>
|
|
85
|
+
<AppContent />
|
|
86
|
+
</DebugView>
|
|
87
|
+
```
|
|
121
88
|
|
|
122
|
-
##
|
|
89
|
+
## `<DebugView>` Props
|
|
123
90
|
|
|
124
|
-
|
|
91
|
+
| Prop | Type | Default | Description |
|
|
92
|
+
|------|------|---------|-------------|
|
|
93
|
+
| `children` | `ReactNode` | — | App content |
|
|
94
|
+
| `features` | `Partial<FeatureConfigs>` | all enabled | Enable/disable features |
|
|
95
|
+
| `navigationRef` | `RefObject` | — | Navigation container ref |
|
|
96
|
+
| `environments` | `EnvironmentConfig[]` | — | Environment configs |
|
|
97
|
+
| `enabled` | `boolean` | `__DEV__` | Force enable/disable |
|
|
125
98
|
|
|
126
|
-
|
|
99
|
+
### Per-feature options
|
|
127
100
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
101
|
+
| Feature | Options |
|
|
102
|
+
|---------|---------|
|
|
103
|
+
| `network` | `maxLogs`, `blacklist` |
|
|
104
|
+
| `console` | `maxLogs` |
|
|
105
|
+
| `zustand` | `maxLogs` |
|
|
106
|
+
| `navigation` | `maxLogs` |
|
|
107
|
+
| `track` | `maxLogs` |
|
|
108
|
+
| `environment` | `EnvironmentConfig[]` |
|
|
109
|
+
| `clipboard` | — |
|
|
131
110
|
|
|
132
|
-
|
|
133
|
-
if (isDebugMode) {
|
|
134
|
-
const networkFeature = createNetworkFeature();
|
|
135
|
-
networkFeature.setupAxiosInterceptors(axios);
|
|
136
|
-
|
|
137
|
-
// Optional: exclude sensitive URLs (like authentication endpoints)
|
|
138
|
-
networkFeature.addUrlToBlacklist('api.example.com/auth');
|
|
139
|
-
networkFeature.addUrlToBlacklist(/password/i); // Regex patterns supported
|
|
140
|
-
}
|
|
141
|
-
```
|
|
111
|
+
All `maxLogs` default to **200**.
|
|
142
112
|
|
|
143
|
-
|
|
113
|
+
## Usage Examples
|
|
144
114
|
|
|
145
|
-
|
|
115
|
+
### Zustand middleware
|
|
146
116
|
|
|
147
|
-
```
|
|
148
|
-
import { create } from 'zustand';
|
|
117
|
+
```tsx
|
|
149
118
|
import { zustandLogMiddleware } from 'react-native-debug-toolkit';
|
|
150
119
|
|
|
151
|
-
// Simply add zustandLogMiddleware to wrap your store
|
|
152
120
|
const useStore = create(
|
|
153
|
-
zustandLogMiddleware(
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
decrement: () => set((state) => ({ count: state.count - 1 })),
|
|
158
|
-
})
|
|
159
|
-
)
|
|
121
|
+
zustandLogMiddleware((set) => ({
|
|
122
|
+
count: 0,
|
|
123
|
+
increment: () => set((s) => ({ count: s.count + 1 }), false, 'increment'),
|
|
124
|
+
}))
|
|
160
125
|
);
|
|
161
126
|
```
|
|
162
127
|
|
|
163
|
-
###
|
|
128
|
+
### Custom events
|
|
164
129
|
|
|
165
|
-
|
|
130
|
+
```tsx
|
|
131
|
+
import { addTrackLog } from 'react-native-debug-toolkit';
|
|
166
132
|
|
|
167
|
-
|
|
168
|
-
import React, { useRef } from 'react';
|
|
169
|
-
import { NavigationContainer } from '@react-navigation/native';
|
|
170
|
-
import { useNavigationLogger } from 'react-native-debug-toolkit';
|
|
171
|
-
|
|
172
|
-
function AppNavigator() {
|
|
173
|
-
const navigationRef = useRef(null);
|
|
174
|
-
|
|
175
|
-
// Add this line to enable navigation logging
|
|
176
|
-
useNavigationLogger(navigationRef);
|
|
177
|
-
|
|
178
|
-
return (
|
|
179
|
-
<NavigationContainer ref={navigationRef}>
|
|
180
|
-
{/* Your navigation configuration */}
|
|
181
|
-
</NavigationContainer>
|
|
182
|
-
);
|
|
183
|
-
}
|
|
133
|
+
addTrackLog({ eventName: 'button_click', buttonId: 'submit' });
|
|
184
134
|
```
|
|
185
135
|
|
|
186
|
-
|
|
136
|
+
### Copy to computer
|
|
187
137
|
|
|
188
|
-
|
|
138
|
+
```tsx
|
|
139
|
+
import { copyToComputer } from 'react-native-debug-toolkit';
|
|
140
|
+
|
|
141
|
+
await copyToComputer(jsonString);
|
|
142
|
+
```
|
|
189
143
|
|
|
190
|
-
|
|
191
|
-
// Only enable network and console logging features
|
|
192
|
-
initializeDebugToolkit(['network', 'console']);
|
|
144
|
+
## Advanced: Imperative API
|
|
193
145
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
146
|
+
For programmatic control outside React components:
|
|
147
|
+
|
|
148
|
+
```tsx
|
|
149
|
+
import { initializeDebugToolkit } from 'react-native-debug-toolkit';
|
|
150
|
+
|
|
151
|
+
const toolkit = initializeDebugToolkit({
|
|
152
|
+
features: { network: { maxLogs: 100 }, console: true },
|
|
153
|
+
enabled: true,
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
toolkit?.showPanel();
|
|
157
|
+
toolkit?.clearAll();
|
|
158
|
+
toolkit?.destroy();
|
|
202
159
|
```
|
|
203
160
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
// Limit the amount of data stored
|
|
229
|
-
if (customData.length > 100) {
|
|
230
|
-
customData.shift();
|
|
231
|
-
}
|
|
232
|
-
}, 1000);
|
|
233
|
-
|
|
234
|
-
// Return cleanup function if needed
|
|
235
|
-
return () => clearInterval(interval);
|
|
236
|
-
},
|
|
237
|
-
|
|
238
|
-
getData: () => {
|
|
239
|
-
// Return data to display in the panel
|
|
240
|
-
return customData;
|
|
241
|
-
},
|
|
242
|
-
|
|
243
|
-
cleanup: () => {
|
|
244
|
-
// Clean up any listeners or resources
|
|
245
|
-
customData = [];
|
|
246
|
-
}
|
|
247
|
-
};
|
|
161
|
+
### `DebugToolkit` methods
|
|
162
|
+
|
|
163
|
+
| Method | Description |
|
|
164
|
+
|--------|-------------|
|
|
165
|
+
| `showPanel()` / `hidePanel()` | Toggle visibility |
|
|
166
|
+
| `clearAll()` | Clear all data |
|
|
167
|
+
| `addFeature(f)` / `removeFeature(name)` | Manage features at runtime |
|
|
168
|
+
| `destroy()` | Full teardown |
|
|
169
|
+
| `features` | Active features (read-only) |
|
|
170
|
+
|
|
171
|
+
### Custom feature
|
|
172
|
+
|
|
173
|
+
```tsx
|
|
174
|
+
import type { DebugFeature } from 'react-native-debug-toolkit';
|
|
175
|
+
|
|
176
|
+
const myFeature: DebugFeature<MyData> = {
|
|
177
|
+
name: 'myFeature',
|
|
178
|
+
label: 'My Feature',
|
|
179
|
+
setup: () => { /* start capturing */ },
|
|
180
|
+
getData: () => myDataArray,
|
|
181
|
+
cleanup: () => { /* stop capturing */ },
|
|
182
|
+
clear: () => { /* reset data */ },
|
|
183
|
+
subscribe: (cb) => { emitter.on('change', cb); return () => emitter.off('change', cb); },
|
|
184
|
+
renderContent: MyFeatureTab,
|
|
248
185
|
};
|
|
249
186
|
|
|
250
|
-
|
|
251
|
-
|
|
187
|
+
const toolkit = initializeDebugToolkit();
|
|
188
|
+
toolkit?.addFeature(myFeature);
|
|
252
189
|
```
|
|
253
190
|
|
|
254
|
-
|
|
191
|
+
### Utilities
|
|
192
|
+
|
|
193
|
+
| Export | Description |
|
|
194
|
+
|--------|-------------|
|
|
195
|
+
| `safeStringify(value, space?)` | JSON stringify with circular-ref protection |
|
|
196
|
+
| `copyToComputer(content, options?)` | Copy content to computer |
|
|
197
|
+
| `logToComputer(...args)` | Log to computer console |
|
|
255
198
|
|
|
256
|
-
|
|
257
|
-
- Make sure you're in development mode (`isDebugMode` is true)
|
|
258
|
-
- Check that you've correctly called `initializeDebugToolkit()`
|
|
199
|
+
## Peer Dependencies
|
|
259
200
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
-
|
|
201
|
+
| Package | Version | Required |
|
|
202
|
+
|---------|---------|----------|
|
|
203
|
+
| react | >= 18.0.0 | Yes |
|
|
204
|
+
| react-native | >= 0.72.0 | Yes |
|
|
205
|
+
| @react-native-clipboard/clipboard | >= 1.0.0 | No |
|
|
264
206
|
|
|
265
|
-
|
|
266
|
-
- For Axios, ensure you've called `setupAxiosInterceptors(axios)`
|
|
267
|
-
- For fetch requests, the toolkit should automatically intercept them without additional configuration
|
|
207
|
+
## License
|
|
268
208
|
|
|
269
|
-
|
|
270
|
-
- This debug toolkit is meant for development only, ensure it's not included in production builds
|
|
271
|
-
- If performance is affected in development mode, try enabling only specific features
|
|
209
|
+
MIT
|