react-native-debug-toolkit 0.6.4 → 2.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.
Files changed (277) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +150 -212
  3. package/lib/commonjs/components/ClipboardTab.js +92 -0
  4. package/lib/commonjs/components/ClipboardTab.js.map +1 -0
  5. package/lib/commonjs/components/ConsoleLogTab.js +295 -0
  6. package/lib/commonjs/components/ConsoleLogTab.js.map +1 -0
  7. package/lib/commonjs/components/EnvironmentTab.js +288 -0
  8. package/lib/commonjs/components/EnvironmentTab.js.map +1 -0
  9. package/lib/commonjs/components/FloatPanelView.js +797 -0
  10. package/lib/commonjs/components/FloatPanelView.js.map +1 -0
  11. package/lib/commonjs/components/NavigationLogTab.js +131 -0
  12. package/lib/commonjs/components/NavigationLogTab.js.map +1 -0
  13. package/lib/commonjs/components/NetworkLogTab.js +575 -0
  14. package/lib/commonjs/components/NetworkLogTab.js.map +1 -0
  15. package/lib/commonjs/components/ThirdPartyLibsTab.js +97 -0
  16. package/lib/commonjs/components/ThirdPartyLibsTab.js.map +1 -0
  17. package/lib/commonjs/components/TrackLogTab.js +372 -0
  18. package/lib/commonjs/components/TrackLogTab.js.map +1 -0
  19. package/lib/commonjs/components/ZustandLogTab.js +451 -0
  20. package/lib/commonjs/components/ZustandLogTab.js.map +1 -0
  21. package/lib/commonjs/components/shared/CollapsibleSection.js +84 -0
  22. package/lib/commonjs/components/shared/CollapsibleSection.js.map +1 -0
  23. package/lib/commonjs/components/shared/CopyButton.js +64 -0
  24. package/lib/commonjs/components/shared/CopyButton.js.map +1 -0
  25. package/lib/commonjs/components/shared/JsonView.js +157 -0
  26. package/lib/commonjs/components/shared/JsonView.js.map +1 -0
  27. package/lib/commonjs/core/DebugToolkit.js +142 -0
  28. package/lib/commonjs/core/DebugToolkit.js.map +1 -0
  29. package/lib/commonjs/core/DebugToolkitProvider.js +64 -0
  30. package/lib/commonjs/core/DebugToolkitProvider.js.map +1 -0
  31. package/lib/commonjs/features/ClipboardFeature.js +17 -0
  32. package/lib/commonjs/features/ClipboardFeature.js.map +1 -0
  33. package/lib/commonjs/features/ConsoleLogFeature.js +98 -0
  34. package/lib/commonjs/features/ConsoleLogFeature.js.map +1 -0
  35. package/lib/commonjs/features/EnvironmentFeature.js +168 -0
  36. package/lib/commonjs/features/EnvironmentFeature.js.map +1 -0
  37. package/lib/commonjs/features/NavigationLogFeature.js +60 -0
  38. package/lib/commonjs/features/NavigationLogFeature.js.map +1 -0
  39. package/lib/commonjs/features/NetworkFeature.js +328 -0
  40. package/lib/commonjs/features/NetworkFeature.js.map +1 -0
  41. package/lib/commonjs/features/ThirdPartyLibsFeature.js +51 -0
  42. package/lib/commonjs/features/ThirdPartyLibsFeature.js.map +1 -0
  43. package/lib/commonjs/features/TrackFeature.js +55 -0
  44. package/lib/commonjs/features/TrackFeature.js.map +1 -0
  45. package/lib/commonjs/features/ZustandLogFeature.js +76 -0
  46. package/lib/commonjs/features/ZustandLogFeature.js.map +1 -0
  47. package/lib/commonjs/hooks/useNavigationLogger.js +78 -0
  48. package/lib/commonjs/hooks/useNavigationLogger.js.map +1 -0
  49. package/lib/commonjs/hooks/useSlideDetailAnimation.js +53 -0
  50. package/lib/commonjs/hooks/useSlideDetailAnimation.js.map +1 -0
  51. package/lib/commonjs/index.js +165 -0
  52. package/lib/commonjs/index.js.map +1 -0
  53. package/lib/commonjs/initialize.js +161 -0
  54. package/lib/commonjs/initialize.js.map +1 -0
  55. package/lib/commonjs/native/NativeDebugLibs.js +58 -0
  56. package/lib/commonjs/native/NativeDebugLibs.js.map +1 -0
  57. package/lib/commonjs/package.json +1 -0
  58. package/lib/commonjs/types/index.js +6 -0
  59. package/lib/commonjs/types/index.js.map +1 -0
  60. package/lib/commonjs/utils/constants.js +135 -0
  61. package/lib/commonjs/utils/constants.js.map +1 -0
  62. package/lib/commonjs/utils/copyToComputer.js +97 -0
  63. package/lib/commonjs/utils/copyToComputer.js.map +1 -0
  64. package/lib/commonjs/utils/createEventChannel.js +21 -0
  65. package/lib/commonjs/utils/createEventChannel.js.map +1 -0
  66. package/lib/commonjs/utils/createObservableStore.js +38 -0
  67. package/lib/commonjs/utils/createObservableStore.js.map +1 -0
  68. package/lib/commonjs/utils/safeStringify.js +27 -0
  69. package/lib/commonjs/utils/safeStringify.js.map +1 -0
  70. package/lib/module/components/ClipboardTab.js +86 -0
  71. package/lib/module/components/ClipboardTab.js.map +1 -0
  72. package/lib/module/components/ConsoleLogTab.js +290 -0
  73. package/lib/module/components/ConsoleLogTab.js.map +1 -0
  74. package/lib/module/components/EnvironmentTab.js +282 -0
  75. package/lib/module/components/EnvironmentTab.js.map +1 -0
  76. package/lib/module/components/FloatPanelView.js +791 -0
  77. package/lib/module/components/FloatPanelView.js.map +1 -0
  78. package/lib/module/components/NavigationLogTab.js +126 -0
  79. package/lib/module/components/NavigationLogTab.js.map +1 -0
  80. package/lib/module/components/NetworkLogTab.js +570 -0
  81. package/lib/module/components/NetworkLogTab.js.map +1 -0
  82. package/lib/module/components/ThirdPartyLibsTab.js +91 -0
  83. package/lib/module/components/ThirdPartyLibsTab.js.map +1 -0
  84. package/lib/module/components/TrackLogTab.js +367 -0
  85. package/lib/module/components/TrackLogTab.js.map +1 -0
  86. package/lib/module/components/ZustandLogTab.js +446 -0
  87. package/lib/module/components/ZustandLogTab.js.map +1 -0
  88. package/lib/module/components/shared/CollapsibleSection.js +78 -0
  89. package/lib/module/components/shared/CollapsibleSection.js.map +1 -0
  90. package/lib/module/components/shared/CopyButton.js +58 -0
  91. package/lib/module/components/shared/CopyButton.js.map +1 -0
  92. package/lib/module/components/shared/JsonView.js +152 -0
  93. package/lib/module/components/shared/JsonView.js.map +1 -0
  94. package/lib/module/core/DebugToolkit.js +137 -0
  95. package/lib/module/core/DebugToolkit.js.map +1 -0
  96. package/lib/module/core/DebugToolkitProvider.js +58 -0
  97. package/lib/module/core/DebugToolkitProvider.js.map +1 -0
  98. package/lib/module/features/ClipboardFeature.js +12 -0
  99. package/lib/module/features/ClipboardFeature.js.map +1 -0
  100. package/lib/module/features/ConsoleLogFeature.js +93 -0
  101. package/lib/module/features/ConsoleLogFeature.js.map +1 -0
  102. package/lib/module/features/EnvironmentFeature.js +164 -0
  103. package/lib/module/features/EnvironmentFeature.js.map +1 -0
  104. package/lib/module/features/NavigationLogFeature.js +54 -0
  105. package/lib/module/features/NavigationLogFeature.js.map +1 -0
  106. package/lib/module/features/NetworkFeature.js +322 -0
  107. package/lib/module/features/NetworkFeature.js.map +1 -0
  108. package/lib/module/features/ThirdPartyLibsFeature.js +46 -0
  109. package/lib/module/features/ThirdPartyLibsFeature.js.map +1 -0
  110. package/lib/module/features/TrackFeature.js +49 -0
  111. package/lib/module/features/TrackFeature.js.map +1 -0
  112. package/lib/module/features/ZustandLogFeature.js +69 -0
  113. package/lib/module/features/ZustandLogFeature.js.map +1 -0
  114. package/lib/module/hooks/useNavigationLogger.js +74 -0
  115. package/lib/module/hooks/useNavigationLogger.js.map +1 -0
  116. package/lib/module/hooks/useSlideDetailAnimation.js +50 -0
  117. package/lib/module/hooks/useSlideDetailAnimation.js.map +1 -0
  118. package/lib/module/index.js +29 -0
  119. package/lib/module/index.js.map +1 -0
  120. package/lib/module/initialize.js +156 -0
  121. package/lib/module/initialize.js.map +1 -0
  122. package/lib/module/native/NativeDebugLibs.js +54 -0
  123. package/lib/module/native/NativeDebugLibs.js.map +1 -0
  124. package/lib/module/package.json +1 -0
  125. package/lib/module/types/index.js +4 -0
  126. package/lib/module/types/index.js.map +1 -0
  127. package/lib/module/utils/constants.js +130 -0
  128. package/lib/module/utils/constants.js.map +1 -0
  129. package/lib/module/utils/copyToComputer.js +91 -0
  130. package/lib/module/utils/copyToComputer.js.map +1 -0
  131. package/lib/module/utils/createEventChannel.js +17 -0
  132. package/lib/module/utils/createEventChannel.js.map +1 -0
  133. package/lib/module/utils/createObservableStore.js +34 -0
  134. package/lib/module/utils/createObservableStore.js.map +1 -0
  135. package/lib/module/utils/safeStringify.js +23 -0
  136. package/lib/module/utils/safeStringify.js.map +1 -0
  137. package/lib/typescript/src/components/ClipboardTab.d.ts +4 -0
  138. package/lib/typescript/src/components/ClipboardTab.d.ts.map +1 -0
  139. package/lib/typescript/src/components/ConsoleLogTab.d.ts +4 -0
  140. package/lib/typescript/src/components/ConsoleLogTab.d.ts.map +1 -0
  141. package/lib/typescript/src/components/EnvironmentTab.d.ts +4 -0
  142. package/lib/typescript/src/components/EnvironmentTab.d.ts.map +1 -0
  143. package/lib/typescript/src/components/FloatPanelView.d.ts +64 -0
  144. package/lib/typescript/src/components/FloatPanelView.d.ts.map +1 -0
  145. package/lib/typescript/src/components/NavigationLogTab.d.ts +4 -0
  146. package/lib/typescript/src/components/NavigationLogTab.d.ts.map +1 -0
  147. package/lib/typescript/src/components/NetworkLogTab.d.ts +4 -0
  148. package/lib/typescript/src/components/NetworkLogTab.d.ts.map +1 -0
  149. package/lib/typescript/src/components/ThirdPartyLibsTab.d.ts +4 -0
  150. package/lib/typescript/src/components/ThirdPartyLibsTab.d.ts.map +1 -0
  151. package/lib/typescript/src/components/TrackLogTab.d.ts +4 -0
  152. package/lib/typescript/src/components/TrackLogTab.d.ts.map +1 -0
  153. package/lib/typescript/src/components/ZustandLogTab.d.ts +4 -0
  154. package/lib/typescript/src/components/ZustandLogTab.d.ts.map +1 -0
  155. package/lib/typescript/src/components/shared/CollapsibleSection.d.ts +9 -0
  156. package/lib/typescript/src/components/shared/CollapsibleSection.d.ts.map +1 -0
  157. package/lib/typescript/src/components/shared/CopyButton.d.ts +12 -0
  158. package/lib/typescript/src/components/shared/CopyButton.d.ts.map +1 -0
  159. package/lib/typescript/src/components/shared/JsonView.d.ts +6 -0
  160. package/lib/typescript/src/components/shared/JsonView.d.ts.map +1 -0
  161. package/lib/typescript/src/core/DebugToolkit.d.ts +27 -0
  162. package/lib/typescript/src/core/DebugToolkit.d.ts.map +1 -0
  163. package/lib/typescript/src/core/DebugToolkitProvider.d.ts +18 -0
  164. package/lib/typescript/src/core/DebugToolkitProvider.d.ts.map +1 -0
  165. package/lib/typescript/src/features/ClipboardFeature.d.ts +3 -0
  166. package/lib/typescript/src/features/ClipboardFeature.d.ts.map +1 -0
  167. package/lib/typescript/src/features/ConsoleLogFeature.d.ts +7 -0
  168. package/lib/typescript/src/features/ConsoleLogFeature.d.ts.map +1 -0
  169. package/lib/typescript/src/features/EnvironmentFeature.d.ts +8 -0
  170. package/lib/typescript/src/features/EnvironmentFeature.d.ts.map +1 -0
  171. package/lib/typescript/src/features/NavigationLogFeature.d.ts +8 -0
  172. package/lib/typescript/src/features/NavigationLogFeature.d.ts.map +1 -0
  173. package/lib/typescript/src/features/NetworkFeature.d.ts +28 -0
  174. package/lib/typescript/src/features/NetworkFeature.d.ts.map +1 -0
  175. package/lib/typescript/src/features/ThirdPartyLibsFeature.d.ts +3 -0
  176. package/lib/typescript/src/features/ThirdPartyLibsFeature.d.ts.map +1 -0
  177. package/lib/typescript/src/features/TrackFeature.d.ts +12 -0
  178. package/lib/typescript/src/features/TrackFeature.d.ts.map +1 -0
  179. package/lib/typescript/src/features/ZustandLogFeature.d.ts +29 -0
  180. package/lib/typescript/src/features/ZustandLogFeature.d.ts.map +1 -0
  181. package/lib/typescript/src/hooks/useNavigationLogger.d.ts +20 -0
  182. package/lib/typescript/src/hooks/useNavigationLogger.d.ts.map +1 -0
  183. package/lib/typescript/src/hooks/useSlideDetailAnimation.d.ts +11 -0
  184. package/lib/typescript/src/hooks/useSlideDetailAnimation.d.ts.map +1 -0
  185. package/lib/typescript/src/index.d.ts +26 -0
  186. package/lib/typescript/src/index.d.ts.map +1 -0
  187. package/lib/typescript/src/initialize.d.ts +51 -0
  188. package/lib/typescript/src/initialize.d.ts.map +1 -0
  189. package/lib/typescript/src/native/NativeDebugLibs.d.ts +11 -0
  190. package/lib/typescript/src/native/NativeDebugLibs.d.ts.map +1 -0
  191. package/lib/typescript/src/types/index.d.ts +112 -0
  192. package/lib/typescript/src/types/index.d.ts.map +1 -0
  193. package/lib/typescript/src/utils/constants.d.ts +96 -0
  194. package/lib/typescript/src/utils/constants.d.ts.map +1 -0
  195. package/lib/typescript/src/utils/copyToComputer.d.ts +30 -0
  196. package/lib/typescript/src/utils/copyToComputer.d.ts.map +1 -0
  197. package/lib/typescript/src/utils/createEventChannel.d.ts +7 -0
  198. package/lib/typescript/src/utils/createEventChannel.d.ts.map +1 -0
  199. package/lib/typescript/src/utils/createObservableStore.d.ts +9 -0
  200. package/lib/typescript/src/utils/createObservableStore.d.ts.map +1 -0
  201. package/lib/typescript/src/utils/safeStringify.d.ts +6 -0
  202. package/lib/typescript/src/utils/safeStringify.d.ts.map +1 -0
  203. package/package.json +63 -24
  204. package/src/components/ClipboardTab.tsx +81 -0
  205. package/src/components/ConsoleLogTab.tsx +209 -0
  206. package/src/components/EnvironmentTab.tsx +276 -0
  207. package/src/components/FloatPanelView.tsx +714 -0
  208. package/src/components/NavigationLogTab.tsx +66 -0
  209. package/src/components/NetworkLogTab.tsx +411 -0
  210. package/src/components/ThirdPartyLibsTab.tsx +63 -0
  211. package/src/components/TrackLogTab.tsx +245 -0
  212. package/src/components/ZustandLogTab.tsx +305 -0
  213. package/src/components/shared/CollapsibleSection.tsx +78 -0
  214. package/src/components/shared/CopyButton.tsx +68 -0
  215. package/src/components/shared/JsonView.tsx +125 -0
  216. package/src/core/DebugToolkit.tsx +174 -0
  217. package/src/core/DebugToolkitProvider.tsx +89 -0
  218. package/src/features/ClipboardFeature.ts +11 -0
  219. package/src/features/ConsoleLogFeature.ts +118 -0
  220. package/src/features/EnvironmentFeature.ts +194 -0
  221. package/src/features/NavigationLogFeature.ts +74 -0
  222. package/src/features/NetworkFeature.ts +488 -0
  223. package/src/features/ThirdPartyLibsFeature.ts +42 -0
  224. package/src/features/TrackFeature.ts +69 -0
  225. package/src/features/ZustandLogFeature.ts +127 -0
  226. package/src/hooks/useNavigationLogger.ts +107 -0
  227. package/src/hooks/useSlideDetailAnimation.ts +45 -0
  228. package/src/index.ts +52 -0
  229. package/src/initialize.ts +214 -0
  230. package/src/native/NativeDebugLibs.ts +74 -0
  231. package/src/types/index.ts +138 -0
  232. package/src/utils/constants.ts +91 -0
  233. package/src/utils/copyToComputer.ts +104 -0
  234. package/src/utils/createEventChannel.ts +22 -0
  235. package/src/utils/createObservableStore.ts +42 -0
  236. package/src/utils/safeStringify.ts +25 -0
  237. package/.cursor/rules/react-native.mdc +0 -41
  238. package/README.zh-CN.md +0 -230
  239. package/index.js +0 -41
  240. package/ios/BuildTypeModule.h +0 -9
  241. package/ios/BuildTypeModule.m +0 -42
  242. package/ios/RNDebugLibs.h +0 -10
  243. package/ios/RNDebugLibs.m +0 -79
  244. package/lib/DebugToolKit.js +0 -126
  245. package/lib/EnvironmentManager.ts +0 -80
  246. package/lib/NativeDebugLibs.js +0 -67
  247. package/lib/features/ConsoleLogFeature.js +0 -70
  248. package/lib/features/NavigationLogFeature.js +0 -45
  249. package/lib/features/NetworkFeature.js +0 -389
  250. package/lib/features/PerformanceFeature.js +0 -390
  251. package/lib/features/ThirdPartyLibsFeature.js +0 -63
  252. package/lib/features/TrackFeature.js +0 -94
  253. package/lib/features/ZustandLogFeature.js +0 -44
  254. package/lib/hooks/useNavigationLogger.js +0 -92
  255. package/lib/index.js +0 -114
  256. package/lib/navigation/NavigationLogger.js +0 -1
  257. package/lib/types/TrackTypes.ts +0 -92
  258. package/lib/utils/DebugConst.js +0 -67
  259. package/lib/utils/StorageUtils.js +0 -80
  260. package/lib/views/ConsoleLogDetails.js +0 -314
  261. package/lib/views/FloatPanelView.js +0 -697
  262. package/lib/views/HttpLogDetails.js +0 -648
  263. package/lib/views/NavigationLogDetails.js +0 -302
  264. package/lib/views/RestartModal.js +0 -75
  265. package/lib/views/SubViewConsoleLogs.js +0 -209
  266. package/lib/views/SubViewEnvironment.js +0 -73
  267. package/lib/views/SubViewHTTPLogs.js +0 -235
  268. package/lib/views/SubViewNavigationLogs.js +0 -199
  269. package/lib/views/SubViewPerformance.js +0 -515
  270. package/lib/views/SubViewThirdPartyLibs.js +0 -239
  271. package/lib/views/SubViewTrackLogs.js +0 -318
  272. package/lib/views/SubViewZustandLogs.js +0 -279
  273. package/lib/views/TabView.js +0 -66
  274. package/lib/views/TrackLogDetails.js +0 -481
  275. package/lib/views/ZustandLogDetails.js +0 -355
  276. package/react-native-debug-toolkit.podspec +0 -25
  277. package/react-native.config.js +0 -18
package/index.js DELETED
@@ -1,41 +0,0 @@
1
- /**
2
- * React Native Debug Toolkit
3
- * A comprehensive debugging toolkit for React Native
4
- */
5
- import DebugToolKit from './lib/DebugToolKit'
6
- import { initializeDebugToolkit, isDebugMode } from './lib'
7
-
8
- import { createNetworkFeature } from './lib/features/NetworkFeature'
9
- import { createPerformanceFeature } from './lib/features/PerformanceFeature'
10
- import { createConsoleLogFeature } from './lib/features/ConsoleLogFeature'
11
- import { createZustandLogFeature, addZustandLog } from './lib/features/ZustandLogFeature'
12
- import { createNavigationLogFeature, addNavigationLog } from './lib/features/NavigationLogFeature'
13
- import { useNavigationLogger } from './lib/hooks/useNavigationLogger'
14
- import { createTrackFeature, addTrackLog } from './lib/features/TrackFeature'
15
-
16
- // Function to clear all logs and close the panel
17
- const clearAll = () => {
18
- const instance = DebugToolKit.instance;
19
- if (instance && typeof instance.clearAll === 'function') {
20
- instance.clearAll();
21
- }
22
- };
23
-
24
- export {
25
- DebugToolKit,
26
- initializeDebugToolkit,
27
- createNetworkFeature,
28
- createPerformanceFeature,
29
- createConsoleLogFeature,
30
- createZustandLogFeature,
31
- addZustandLog,
32
- createNavigationLogFeature,
33
- addNavigationLog,
34
- addTrackLog,
35
- useNavigationLogger,
36
- isDebugMode,
37
- clearAll,
38
- createTrackFeature
39
- }
40
-
41
- export default DebugToolKit
@@ -1,9 +0,0 @@
1
- #import <React/RCTBridgeModule.h>
2
-
3
- /**
4
- * BuildTypeModule
5
- * Native module that provides information about the current build type (debug or release)
6
- * Used to conditionally enable debugging tools only in debug builds
7
- */
8
- @interface BuildTypeModule : NSObject <RCTBridgeModule>
9
- @end
@@ -1,42 +0,0 @@
1
- #import "BuildTypeModule.h"
2
-
3
- @implementation BuildTypeModule
4
-
5
- RCT_EXPORT_MODULE();
6
-
7
- + (BOOL)requiresMainQueueSetup
8
- {
9
- return NO;
10
- }
11
-
12
- - (NSDictionary *)constantsToExport
13
- {
14
- #ifdef DEBUG
15
- NSString *buildType = @"debug";
16
- #else
17
- NSString *buildType = @"release";
18
- #endif
19
-
20
- return @{ @"buildType": buildType };
21
- }
22
-
23
- RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(getBuildTypeSync)
24
- {
25
- #ifdef DEBUG
26
- return @"debug";
27
- #else
28
- return @"release";
29
- #endif
30
- }
31
-
32
- RCT_EXPORT_METHOD(getBuildType:(RCTPromiseResolveBlock)resolve
33
- rejecter:(RCTPromiseRejectBlock)reject)
34
- {
35
- #ifdef DEBUG
36
- resolve(@"debug");
37
- #else
38
- resolve(@"release");
39
- #endif
40
- }
41
-
42
- @end
package/ios/RNDebugLibs.h DELETED
@@ -1,10 +0,0 @@
1
- #import <React/RCTBridgeModule.h>
2
-
3
- /**
4
- * RNDebugLibs
5
- * Native module that provides access to FLEX and DoraemonKit debugging tools
6
- * Note: These debugging tools are only available in DEBUG builds
7
- */
8
- @interface RNDebugLibs : NSObject <RCTBridgeModule>
9
-
10
- @end
package/ios/RNDebugLibs.m DELETED
@@ -1,79 +0,0 @@
1
- #import "RNDebugLibs.h"
2
-
3
- #ifdef DEBUG
4
- #import "FLEXManager.h"
5
- #import <DoraemonKit/DoraemonManager.h>
6
- #endif
7
-
8
- @implementation RNDebugLibs
9
-
10
- // Export the module
11
- RCT_EXPORT_MODULE();
12
-
13
- RCT_EXPORT_METHOD(showExplorer)
14
- {
15
- #ifdef DEBUG
16
- dispatch_async(dispatch_get_main_queue(), ^{
17
- [[FLEXManager sharedManager] showExplorer];
18
- });
19
- #else
20
- NSLog(@"[RNDebugLibs] showExplorer is only available in DEBUG builds");
21
- #endif
22
- }
23
-
24
- RCT_EXPORT_METHOD(hideExplorer)
25
- {
26
- #ifdef DEBUG
27
- dispatch_async(dispatch_get_main_queue(), ^{
28
- [[FLEXManager sharedManager] hideExplorer];
29
- });
30
- #else
31
- NSLog(@"[RNDebugLibs] hideExplorer is only available in DEBUG builds");
32
- #endif
33
- }
34
-
35
- RCT_EXPORT_METHOD(toggleExplorer)
36
- {
37
- #ifdef DEBUG
38
- dispatch_async(dispatch_get_main_queue(), ^{
39
- [[FLEXManager sharedManager] toggleExplorer];
40
- });
41
- #else
42
- NSLog(@"[RNDebugLibs] toggleExplorer is only available in DEBUG builds");
43
- #endif
44
- }
45
-
46
- RCT_EXPORT_METHOD(installDoraemonKit:(NSString *)productId)
47
- {
48
- #ifdef DEBUG
49
- dispatch_async(dispatch_get_main_queue(), ^{
50
- [[DoraemonManager shareInstance] installWithPid:productId];
51
- });
52
- #else
53
- NSLog(@"[RNDebugLibs] installDoraemonKit is only available in DEBUG builds");
54
- #endif
55
- }
56
-
57
- RCT_EXPORT_METHOD(showDoraemonKit)
58
- {
59
- #ifdef DEBUG
60
- dispatch_async(dispatch_get_main_queue(), ^{
61
- [[DoraemonManager shareInstance] showDoraemon];
62
- });
63
- #else
64
- NSLog(@"[RNDebugLibs] showDoraemonKit is only available in DEBUG builds");
65
- #endif
66
- }
67
-
68
- RCT_EXPORT_METHOD(hideDoraemonKit)
69
- {
70
- #ifdef DEBUG
71
- dispatch_async(dispatch_get_main_queue(), ^{
72
- [[DoraemonManager shareInstance] hiddenDoraemon];
73
- });
74
- #else
75
- NSLog(@"[RNDebugLibs] hideDoraemonKit is only available in DEBUG builds");
76
- #endif
77
- }
78
-
79
- @end
@@ -1,126 +0,0 @@
1
- import React from 'react'
2
- import { BackHandler, Pressable, Text } from 'react-native'
3
- import RootSiblings from 'react-native-root-siblings'
4
- import FloatPanelView from './views/FloatPanelView'
5
- import NativeDebugLibs from './NativeDebugLibs'
6
-
7
- export default class DebugToolKit {
8
- static instance = null
9
-
10
- constructor(config = {}) {
11
- if (DebugToolKit.instance) {
12
- return DebugToolKit.instance
13
- }
14
-
15
- // Set the debug mode flag directly from NativeDebugLibs
16
- // this.isDebugMode = NativeDebugLibs.isDebugBuild()
17
- this.isDebugMode = true
18
-
19
- this.floatPanel = null
20
- this.features = []
21
- this.isPanelVisible = false
22
-
23
- const featuresToLoad = config.features || []
24
-
25
- // Only load features in debug mode
26
- if (this.isDebugMode) {
27
- featuresToLoad.forEach(featureOrCreator => {
28
- const feature = typeof featureOrCreator === 'function'
29
- ? featureOrCreator()
30
- : featureOrCreator
31
- this.addFeature(feature)
32
- })
33
-
34
- if (config.autoShow) {
35
- this.showDebugPanel()
36
- }
37
-
38
- BackHandler.addEventListener('hardwareBackPress', () => true)
39
- } else {
40
- console.log('[DebugToolKit] Not initializing features - not in debug mode')
41
- }
42
-
43
- DebugToolKit.instance = this
44
- }
45
-
46
- addFeature(feature) {
47
- if (!this.isDebugMode) return this;
48
-
49
- if (feature && typeof feature.name === 'string') {
50
- this.features.push(feature)
51
- feature.setup?.()
52
- } else {
53
- console.warn('[DebugToolKit] Invalid feature added:', feature)
54
- }
55
- return this
56
- }
57
-
58
-
59
- clearAll = () => {
60
- // Clear all logs from all features
61
- this.features.forEach((feature) => {
62
- if (typeof feature.cleanup === 'function') {
63
- feature.cleanup();
64
- }
65
- // Re-setup the feature to initialize it again
66
- if (typeof feature.setup === 'function') {
67
- feature.setup();
68
- }
69
- });
70
-
71
- }
72
-
73
- showDebugPanel = () => {
74
- if (!this.isDebugMode) {
75
- return
76
- }
77
-
78
- if (!this.floatPanel) {
79
- this.floatPanel = new RootSiblings(
80
- <FloatPanelView
81
- features={this.features}
82
- close={this.hideDebugPanel}
83
- clearAll={this.clearAll}
84
- />,
85
- )
86
- }
87
- this.isPanelVisible = true
88
- }
89
-
90
- hideDebugPanel = () => {
91
- if (this.floatPanel) {
92
- this.floatPanel.destroy()
93
- this.floatPanel = null
94
- }
95
- }
96
-
97
- updateDebugPanel() {
98
- if (this.floatPanel) {
99
- this.floatPanel.update(
100
- <FloatPanelView
101
- features={this.features}
102
- close={this.hideDebugPanel}
103
- clearAll={this.clearAll}
104
- />,
105
- )
106
- }
107
- }
108
-
109
- destroy() {
110
- this.hideDebugPanel()
111
-
112
- if (this.restartModal) {
113
- this.restartModal.destroy()
114
- this.restartModal = null
115
- }
116
-
117
- this.features.forEach((feature) => {
118
- if (typeof feature.cleanup === 'function') {
119
- feature.cleanup()
120
- }
121
- })
122
-
123
- this.features = []
124
- BackHandler.removeEventListener('hardwareBackPress')
125
- }
126
- }
@@ -1,80 +0,0 @@
1
- import AsyncStorage from '@react-native-async-storage/async-storage';
2
-
3
- export type BaseEnvironmentConfig = {
4
- [key: string]: any;
5
- };
6
-
7
- export class EnvironmentManager<T extends BaseEnvironmentConfig> {
8
- private static instance: EnvironmentManager<any>;
9
- private currentEnv: string;
10
- private environments: Record<string, T>;
11
- private listeners: ((env: T) => void)[] = [];
12
- static ENV_STORAGE_KEY = '@debug_toolkit_env';
13
-
14
- protected constructor() {
15
- this.environments = {};
16
- this.currentEnv = '';
17
- }
18
-
19
- public static getInstance<T extends BaseEnvironmentConfig>(): EnvironmentManager<T> {
20
- if (!EnvironmentManager.instance) {
21
- EnvironmentManager.instance = new EnvironmentManager<T>();
22
- }
23
- return EnvironmentManager.instance;
24
- }
25
-
26
- public async initialize(environments: Record<string, T>, defaultEnv: string): Promise<string> {
27
- if (!__DEV__) return defaultEnv;
28
-
29
- this.environments = environments;
30
-
31
- try {
32
- const savedEnv = await AsyncStorage.getItem(EnvironmentManager.ENV_STORAGE_KEY);
33
- this.currentEnv = savedEnv || defaultEnv;
34
- await AsyncStorage.setItem(EnvironmentManager.ENV_STORAGE_KEY, this.currentEnv);
35
- return this.currentEnv;
36
- } catch (error) {
37
- console.error('EnvironmentManager initialization error:', error);
38
- this.currentEnv = defaultEnv;
39
- return defaultEnv;
40
- }
41
- }
42
-
43
- public async changeEnvironment(newValue: string): Promise<void> {
44
- if (newValue === this.currentEnv) return;
45
-
46
- try {
47
- await AsyncStorage.setItem(EnvironmentManager.ENV_STORAGE_KEY, newValue);
48
- this.currentEnv = newValue;
49
-
50
- const envConfig = this.environments[newValue];
51
- this.listeners.forEach(listener => listener(envConfig));
52
- } catch (error) {
53
- console.error('Failed to change environment:', error);
54
- throw error;
55
- }
56
- }
57
-
58
- public getCurrentEnvironment(): string {
59
- return this.currentEnv;
60
- }
61
-
62
- public getEnvironmentConfig(): T {
63
- return this.environments[this.currentEnv];
64
- }
65
-
66
- public getEnvironments(): Record<string, T> {
67
- return this.environments;
68
- }
69
-
70
- public onEnvironmentChange(listener: (env: T) => void): () => void {
71
- this.listeners.push(listener);
72
- return () => {
73
- this.listeners = this.listeners.filter(l => l !== listener);
74
- };
75
- }
76
-
77
- public destroy(): void {
78
- this.listeners = [];
79
- }
80
- }
@@ -1,67 +0,0 @@
1
- import { NativeModules, Platform } from 'react-native'
2
-
3
- const { RNDebugLibs, BuildTypeModule } = NativeModules
4
-
5
- export default class NativeDebugLibs {
6
- // Build type methods
7
- static getBuildType() {
8
- if (BuildTypeModule) {
9
- return BuildTypeModule.getBuildType();
10
- }
11
- return Promise.resolve(null);
12
- }
13
-
14
- static getBuildTypeSync() {
15
- console.log('BuildTypeModule', BuildTypeModule);
16
- if (BuildTypeModule) {
17
- console.log('BuildTypeModule.getBuildTypeSync()', BuildTypeModule.getBuildTypeSync());
18
- return BuildTypeModule.getBuildTypeSync();
19
- }
20
- return null;
21
- }
22
-
23
- static isDebugBuild() {
24
- if (BuildTypeModule) {
25
- return BuildTypeModule.getBuildTypeSync() === 'debug';
26
- }
27
- return false;
28
- }
29
-
30
- // FLEX methods (iOS only)
31
- static showExplorer() {
32
- if (Platform.OS === 'ios' && RNDebugLibs) {
33
- RNDebugLibs.showExplorer()
34
- }
35
- }
36
-
37
- static hideExplorer() {
38
- if (Platform.OS === 'ios' && RNDebugLibs) {
39
- RNDebugLibs.hideExplorer()
40
- }
41
- }
42
-
43
- static toggleExplorer() {
44
- if (Platform.OS === 'ios' && RNDebugLibs) {
45
- RNDebugLibs.toggleExplorer()
46
- }
47
- }
48
-
49
- // DoraemonKit/DoKit methods
50
- static installDoraemonKit(productId) {
51
- // if (RNDebugLibs) {
52
- // RNDebugLibs.installDoraemonKit(productId)
53
- // }
54
- }
55
-
56
- static showDoraemonKit() {
57
- // if (RNDebugLibs) {
58
- // RNDebugLibs.showDoraemonKit()
59
- // }
60
- }
61
-
62
- static hideDoraemonKit() {
63
- // if (RNDebugLibs) {
64
- // RNDebugLibs.hideDoraemonKit()
65
- // }
66
- }
67
- }
@@ -1,70 +0,0 @@
1
- const MAX_LOGS = 200; // Max number of console logs to store
2
- const logs = [];
3
- const originalConsole = {}; // Store original console methods
4
-
5
- const _interceptConsole = () => {
6
- const levels = ['log', 'info', 'warn', 'error'];
7
- levels.forEach(level => {
8
- if (typeof console[level] === 'function') { // Check if it's actually a function
9
- originalConsole[level] = console[level]; // Store original
10
-
11
- console[level] = (...args) => {
12
- // Call original console method first
13
- originalConsole[level].apply(console, args); // Use apply for proper context
14
-
15
- // Add log entry
16
- if (logs.length >= MAX_LOGS) {
17
- logs.shift(); // Remove the oldest log if limit is reached
18
- }
19
-
20
- // Store log data
21
- logs.push({
22
- timestamp: new Date(),
23
- level: level,
24
- data: args, // Store all arguments passed to console[level]
25
- });
26
-
27
- // TODO: Notify UI if needed
28
- };
29
- }
30
- });
31
- };
32
-
33
- const _restoreConsole = () => {
34
- Object.keys(originalConsole).forEach(level => {
35
- if (originalConsole[level]) {
36
- console[level] = originalConsole[level];
37
- delete originalConsole[level]; // Clean up stored method
38
- }
39
- });
40
- };
41
-
42
- const setup = () => {
43
- _interceptConsole();
44
- };
45
-
46
- const getData = () => {
47
- return logs;
48
- };
49
-
50
- const cleanup = () => {
51
- _restoreConsole();
52
- logs.length = 0; // More efficient way to clear array
53
- };
54
-
55
- // Factory function remains similar but uses the module-level functions
56
- export const createConsoleLogFeature = () => {
57
- // Ensure setup is only called once if multiple features might be created (though unlikely for console)
58
- // A simple flag could work here if needed, but maybe setup belongs in the main toolkit init.
59
- return {
60
- name: 'console',
61
- label: 'Console Logs',
62
- setup: setup, // Reference module-level function
63
- getData: getData, // Reference module-level function
64
- cleanup: cleanup, // Reference module-level function
65
- };
66
- };
67
-
68
- // Note: This refactor removes the class structure entirely, relying on module scope
69
- // for the "singleton" nature. Decide if this fits the overall pattern of other features.
70
- // The original class-based singleton is also perfectly valid.
@@ -1,45 +0,0 @@
1
- const MAX_LOGS = 200; // Max number of navigation logs to store
2
- const logs = [];
3
- const originalNavigationMethods = {}; // Store original navigation methods
4
-
5
- const setup = () => {
6
- // Note: Actual navigation interception will be done in the main app code
7
- // This is just a setup function for compatibility with the feature API
8
- };
9
-
10
- // Function to add navigation log
11
- export const addNavigationLog = (action, from, to, startTime, duration, debugLog) => {
12
- // Store log data
13
- logs.push({
14
- timestamp: new Date(),
15
- action: action, // push, pop, replace, etc.
16
- from: from, // source route info
17
- to: to, // destination route info
18
- startTime: startTime,
19
- duration: duration,
20
- debugLog: debugLog,
21
- });
22
-
23
- // Trim logs if they exceed the maximum limit
24
- if (logs.length > MAX_LOGS) {
25
- logs.splice(0, logs.length - MAX_LOGS);
26
- }
27
- };
28
-
29
- const getData = () => {
30
- return logs;
31
- };
32
-
33
- const cleanup = () => {
34
- logs.length = 0; // Clear array
35
- };
36
-
37
- export const createNavigationLogFeature = () => {
38
- return {
39
- name: 'navigation',
40
- label: 'Navigation Logs',
41
- setup: setup,
42
- getData: getData,
43
- cleanup: cleanup,
44
- };
45
- };