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.
Files changed (340) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +149 -211
  3. package/README.zh-CN.md +150 -171
  4. package/lib/commonjs/components/ClipboardTab.js +91 -0
  5. package/lib/commonjs/components/ClipboardTab.js.map +1 -0
  6. package/lib/commonjs/components/ConsoleLogTab.js +162 -0
  7. package/lib/commonjs/components/ConsoleLogTab.js.map +1 -0
  8. package/lib/commonjs/components/DebugPanel.js +230 -0
  9. package/lib/commonjs/components/DebugPanel.js.map +1 -0
  10. package/lib/commonjs/components/DebugView.js +66 -0
  11. package/lib/commonjs/components/DebugView.js.map +1 -0
  12. package/lib/commonjs/components/EnvironmentTab.js +287 -0
  13. package/lib/commonjs/components/EnvironmentTab.js.map +1 -0
  14. package/lib/commonjs/components/FeatureTabBar.js +182 -0
  15. package/lib/commonjs/components/FeatureTabBar.js.map +1 -0
  16. package/lib/commonjs/components/FloatIcon.js +187 -0
  17. package/lib/commonjs/components/FloatIcon.js.map +1 -0
  18. package/lib/commonjs/components/FloatPanelView.js +214 -0
  19. package/lib/commonjs/components/FloatPanelView.js.map +1 -0
  20. package/lib/commonjs/components/NavigationLogTab.js +131 -0
  21. package/lib/commonjs/components/NavigationLogTab.js.map +1 -0
  22. package/lib/commonjs/components/NetworkLogTab.js +404 -0
  23. package/lib/commonjs/components/NetworkLogTab.js.map +1 -0
  24. package/lib/commonjs/components/ThirdPartyLibsTab.js +97 -0
  25. package/lib/commonjs/components/ThirdPartyLibsTab.js.map +1 -0
  26. package/lib/commonjs/components/TrackLogTab.js +230 -0
  27. package/lib/commonjs/components/TrackLogTab.js.map +1 -0
  28. package/lib/commonjs/components/ZustandLogTab.js +311 -0
  29. package/lib/commonjs/components/ZustandLogTab.js.map +1 -0
  30. package/lib/commonjs/components/shared/CollapsibleSection.js +84 -0
  31. package/lib/commonjs/components/shared/CollapsibleSection.js.map +1 -0
  32. package/lib/commonjs/components/shared/CopyButton.js +64 -0
  33. package/lib/commonjs/components/shared/CopyButton.js.map +1 -0
  34. package/lib/commonjs/components/shared/JsonView.js +157 -0
  35. package/lib/commonjs/components/shared/JsonView.js.map +1 -0
  36. package/lib/commonjs/components/shared/LogListScreen.js +174 -0
  37. package/lib/commonjs/components/shared/LogListScreen.js.map +1 -0
  38. package/lib/commonjs/core/DebugToolkit.js +122 -0
  39. package/lib/commonjs/core/DebugToolkit.js.map +1 -0
  40. package/lib/commonjs/core/DebugToolkitProvider.js +66 -0
  41. package/lib/commonjs/core/DebugToolkitProvider.js.map +1 -0
  42. package/lib/commonjs/features/ClipboardFeature.js +21 -0
  43. package/lib/commonjs/features/ClipboardFeature.js.map +1 -0
  44. package/lib/commonjs/features/ConsoleLogFeature.js +115 -0
  45. package/lib/commonjs/features/ConsoleLogFeature.js.map +1 -0
  46. package/lib/commonjs/features/EnvironmentFeature.js +160 -0
  47. package/lib/commonjs/features/EnvironmentFeature.js.map +1 -0
  48. package/lib/commonjs/features/NavigationLogFeature.js +39 -0
  49. package/lib/commonjs/features/NavigationLogFeature.js.map +1 -0
  50. package/lib/commonjs/features/NetworkFeature.js +107 -0
  51. package/lib/commonjs/features/NetworkFeature.js.map +1 -0
  52. package/lib/commonjs/features/ThirdPartyLibsFeature.js +51 -0
  53. package/lib/commonjs/features/ThirdPartyLibsFeature.js.map +1 -0
  54. package/lib/commonjs/features/TrackFeature.js +34 -0
  55. package/lib/commonjs/features/TrackFeature.js.map +1 -0
  56. package/lib/commonjs/features/ZustandLogFeature.js +59 -0
  57. package/lib/commonjs/features/ZustandLogFeature.js.map +1 -0
  58. package/lib/commonjs/hooks/useNavigationLogger.js +78 -0
  59. package/lib/commonjs/hooks/useNavigationLogger.js.map +1 -0
  60. package/lib/commonjs/hooks/useSlideDetailAnimation.js +53 -0
  61. package/lib/commonjs/hooks/useSlideDetailAnimation.js.map +1 -0
  62. package/lib/commonjs/index.js +152 -0
  63. package/lib/commonjs/index.js.map +1 -0
  64. package/lib/commonjs/initialize.js +84 -0
  65. package/lib/commonjs/initialize.js.map +1 -0
  66. package/lib/commonjs/interceptors/networkInterceptor.js +466 -0
  67. package/lib/commonjs/interceptors/networkInterceptor.js.map +1 -0
  68. package/lib/commonjs/native/NativeDebugLibs.js +58 -0
  69. package/lib/commonjs/native/NativeDebugLibs.js.map +1 -0
  70. package/lib/commonjs/package.json +1 -0
  71. package/lib/commonjs/types/index.js +6 -0
  72. package/lib/commonjs/types/index.js.map +1 -0
  73. package/lib/commonjs/utils/colors.js +48 -0
  74. package/lib/commonjs/utils/colors.js.map +1 -0
  75. package/lib/commonjs/utils/copyToComputer.js +97 -0
  76. package/lib/commonjs/utils/copyToComputer.js.map +1 -0
  77. package/lib/commonjs/utils/createChannelFeature.js +48 -0
  78. package/lib/commonjs/utils/createChannelFeature.js.map +1 -0
  79. package/lib/commonjs/utils/createEventChannel.js +21 -0
  80. package/lib/commonjs/utils/createEventChannel.js.map +1 -0
  81. package/lib/commonjs/utils/createObservableStore.js +38 -0
  82. package/lib/commonjs/utils/createObservableStore.js.map +1 -0
  83. package/lib/commonjs/utils/layout.js +8 -0
  84. package/lib/commonjs/utils/layout.js.map +1 -0
  85. package/lib/commonjs/utils/safeStringify.js +27 -0
  86. package/lib/commonjs/utils/safeStringify.js.map +1 -0
  87. package/lib/commonjs/utils/urlRewriterRegistry.js +14 -0
  88. package/lib/commonjs/utils/urlRewriterRegistry.js.map +1 -0
  89. package/lib/module/components/ClipboardTab.js +86 -0
  90. package/lib/module/components/ClipboardTab.js.map +1 -0
  91. package/lib/module/components/ConsoleLogTab.js +157 -0
  92. package/lib/module/components/ConsoleLogTab.js.map +1 -0
  93. package/lib/module/components/DebugPanel.js +225 -0
  94. package/lib/module/components/DebugPanel.js.map +1 -0
  95. package/lib/module/components/DebugView.js +61 -0
  96. package/lib/module/components/DebugView.js.map +1 -0
  97. package/lib/module/components/EnvironmentTab.js +282 -0
  98. package/lib/module/components/EnvironmentTab.js.map +1 -0
  99. package/lib/module/components/FeatureTabBar.js +177 -0
  100. package/lib/module/components/FeatureTabBar.js.map +1 -0
  101. package/lib/module/components/FloatIcon.js +182 -0
  102. package/lib/module/components/FloatIcon.js.map +1 -0
  103. package/lib/module/components/FloatPanelView.js +209 -0
  104. package/lib/module/components/FloatPanelView.js.map +1 -0
  105. package/lib/module/components/NavigationLogTab.js +126 -0
  106. package/lib/module/components/NavigationLogTab.js.map +1 -0
  107. package/lib/module/components/NetworkLogTab.js +399 -0
  108. package/lib/module/components/NetworkLogTab.js.map +1 -0
  109. package/lib/module/components/ThirdPartyLibsTab.js +91 -0
  110. package/lib/module/components/ThirdPartyLibsTab.js.map +1 -0
  111. package/lib/module/components/TrackLogTab.js +225 -0
  112. package/lib/module/components/TrackLogTab.js.map +1 -0
  113. package/lib/module/components/ZustandLogTab.js +306 -0
  114. package/lib/module/components/ZustandLogTab.js.map +1 -0
  115. package/lib/module/components/shared/CollapsibleSection.js +78 -0
  116. package/lib/module/components/shared/CollapsibleSection.js.map +1 -0
  117. package/lib/module/components/shared/CopyButton.js +58 -0
  118. package/lib/module/components/shared/CopyButton.js.map +1 -0
  119. package/lib/module/components/shared/JsonView.js +152 -0
  120. package/lib/module/components/shared/JsonView.js.map +1 -0
  121. package/lib/module/components/shared/LogListScreen.js +169 -0
  122. package/lib/module/components/shared/LogListScreen.js.map +1 -0
  123. package/lib/module/core/DebugToolkit.js +118 -0
  124. package/lib/module/core/DebugToolkit.js.map +1 -0
  125. package/lib/module/core/DebugToolkitProvider.js +60 -0
  126. package/lib/module/core/DebugToolkitProvider.js.map +1 -0
  127. package/lib/module/features/ClipboardFeature.js +16 -0
  128. package/lib/module/features/ClipboardFeature.js.map +1 -0
  129. package/lib/module/features/ConsoleLogFeature.js +109 -0
  130. package/lib/module/features/ConsoleLogFeature.js.map +1 -0
  131. package/lib/module/features/EnvironmentFeature.js +156 -0
  132. package/lib/module/features/EnvironmentFeature.js.map +1 -0
  133. package/lib/module/features/NavigationLogFeature.js +32 -0
  134. package/lib/module/features/NavigationLogFeature.js.map +1 -0
  135. package/lib/module/features/NetworkFeature.js +101 -0
  136. package/lib/module/features/NetworkFeature.js.map +1 -0
  137. package/lib/module/features/ThirdPartyLibsFeature.js +46 -0
  138. package/lib/module/features/ThirdPartyLibsFeature.js.map +1 -0
  139. package/lib/module/features/TrackFeature.js +27 -0
  140. package/lib/module/features/TrackFeature.js.map +1 -0
  141. package/lib/module/features/ZustandLogFeature.js +53 -0
  142. package/lib/module/features/ZustandLogFeature.js.map +1 -0
  143. package/lib/module/hooks/useNavigationLogger.js +74 -0
  144. package/lib/module/hooks/useNavigationLogger.js.map +1 -0
  145. package/lib/module/hooks/useSlideDetailAnimation.js +50 -0
  146. package/lib/module/hooks/useSlideDetailAnimation.js.map +1 -0
  147. package/lib/module/index.js +28 -0
  148. package/lib/module/index.js.map +1 -0
  149. package/lib/module/initialize.js +80 -0
  150. package/lib/module/initialize.js.map +1 -0
  151. package/lib/module/interceptors/networkInterceptor.js +460 -0
  152. package/lib/module/interceptors/networkInterceptor.js.map +1 -0
  153. package/lib/module/native/NativeDebugLibs.js +54 -0
  154. package/lib/module/native/NativeDebugLibs.js.map +1 -0
  155. package/lib/module/package.json +1 -0
  156. package/lib/module/types/index.js +4 -0
  157. package/lib/module/types/index.js.map +1 -0
  158. package/lib/module/utils/colors.js +43 -0
  159. package/lib/module/utils/colors.js.map +1 -0
  160. package/lib/module/utils/copyToComputer.js +91 -0
  161. package/lib/module/utils/copyToComputer.js.map +1 -0
  162. package/lib/module/utils/createChannelFeature.js +44 -0
  163. package/lib/module/utils/createChannelFeature.js.map +1 -0
  164. package/lib/module/utils/createEventChannel.js +17 -0
  165. package/lib/module/utils/createEventChannel.js.map +1 -0
  166. package/lib/module/utils/createObservableStore.js +34 -0
  167. package/lib/module/utils/createObservableStore.js.map +1 -0
  168. package/lib/module/utils/layout.js +4 -0
  169. package/lib/module/utils/layout.js.map +1 -0
  170. package/lib/module/utils/safeStringify.js +23 -0
  171. package/lib/module/utils/safeStringify.js.map +1 -0
  172. package/lib/module/utils/urlRewriterRegistry.js +10 -0
  173. package/lib/module/utils/urlRewriterRegistry.js.map +1 -0
  174. package/lib/typescript/src/components/ClipboardTab.d.ts +4 -0
  175. package/lib/typescript/src/components/ClipboardTab.d.ts.map +1 -0
  176. package/lib/typescript/src/components/ConsoleLogTab.d.ts +4 -0
  177. package/lib/typescript/src/components/ConsoleLogTab.d.ts.map +1 -0
  178. package/lib/typescript/src/components/DebugPanel.d.ts +9 -0
  179. package/lib/typescript/src/components/DebugPanel.d.ts.map +1 -0
  180. package/lib/typescript/src/components/DebugView.d.ts +19 -0
  181. package/lib/typescript/src/components/DebugView.d.ts.map +1 -0
  182. package/lib/typescript/src/components/EnvironmentTab.d.ts +4 -0
  183. package/lib/typescript/src/components/EnvironmentTab.d.ts.map +1 -0
  184. package/lib/typescript/src/components/FeatureTabBar.d.ts +13 -0
  185. package/lib/typescript/src/components/FeatureTabBar.d.ts.map +1 -0
  186. package/lib/typescript/src/components/FloatIcon.d.ts +12 -0
  187. package/lib/typescript/src/components/FloatIcon.d.ts.map +1 -0
  188. package/lib/typescript/src/components/FloatPanelView.d.ts +9 -0
  189. package/lib/typescript/src/components/FloatPanelView.d.ts.map +1 -0
  190. package/lib/typescript/src/components/NavigationLogTab.d.ts +4 -0
  191. package/lib/typescript/src/components/NavigationLogTab.d.ts.map +1 -0
  192. package/lib/typescript/src/components/NetworkLogTab.d.ts +4 -0
  193. package/lib/typescript/src/components/NetworkLogTab.d.ts.map +1 -0
  194. package/lib/typescript/src/components/ThirdPartyLibsTab.d.ts +4 -0
  195. package/lib/typescript/src/components/ThirdPartyLibsTab.d.ts.map +1 -0
  196. package/lib/typescript/src/components/TrackLogTab.d.ts +4 -0
  197. package/lib/typescript/src/components/TrackLogTab.d.ts.map +1 -0
  198. package/lib/typescript/src/components/ZustandLogTab.d.ts +4 -0
  199. package/lib/typescript/src/components/ZustandLogTab.d.ts.map +1 -0
  200. package/lib/typescript/src/components/shared/CollapsibleSection.d.ts +9 -0
  201. package/lib/typescript/src/components/shared/CollapsibleSection.d.ts.map +1 -0
  202. package/lib/typescript/src/components/shared/CopyButton.d.ts +12 -0
  203. package/lib/typescript/src/components/shared/CopyButton.d.ts.map +1 -0
  204. package/lib/typescript/src/components/shared/JsonView.d.ts +6 -0
  205. package/lib/typescript/src/components/shared/JsonView.d.ts.map +1 -0
  206. package/lib/typescript/src/components/shared/LogListScreen.d.ts +21 -0
  207. package/lib/typescript/src/components/shared/LogListScreen.d.ts.map +1 -0
  208. package/lib/typescript/src/core/DebugToolkit.d.ts +20 -0
  209. package/lib/typescript/src/core/DebugToolkit.d.ts.map +1 -0
  210. package/lib/typescript/src/core/DebugToolkitProvider.d.ts +15 -0
  211. package/lib/typescript/src/core/DebugToolkitProvider.d.ts.map +1 -0
  212. package/lib/typescript/src/features/ClipboardFeature.d.ts +7 -0
  213. package/lib/typescript/src/features/ClipboardFeature.d.ts.map +1 -0
  214. package/lib/typescript/src/features/ConsoleLogFeature.d.ts +9 -0
  215. package/lib/typescript/src/features/ConsoleLogFeature.d.ts.map +1 -0
  216. package/lib/typescript/src/features/EnvironmentFeature.d.ts +8 -0
  217. package/lib/typescript/src/features/EnvironmentFeature.d.ts.map +1 -0
  218. package/lib/typescript/src/features/NavigationLogFeature.d.ts +10 -0
  219. package/lib/typescript/src/features/NavigationLogFeature.d.ts.map +1 -0
  220. package/lib/typescript/src/features/NetworkFeature.d.ts +15 -0
  221. package/lib/typescript/src/features/NetworkFeature.d.ts.map +1 -0
  222. package/lib/typescript/src/features/ThirdPartyLibsFeature.d.ts +3 -0
  223. package/lib/typescript/src/features/ThirdPartyLibsFeature.d.ts.map +1 -0
  224. package/lib/typescript/src/features/TrackFeature.d.ts +14 -0
  225. package/lib/typescript/src/features/TrackFeature.d.ts.map +1 -0
  226. package/lib/typescript/src/features/ZustandLogFeature.d.ts +31 -0
  227. package/lib/typescript/src/features/ZustandLogFeature.d.ts.map +1 -0
  228. package/lib/typescript/src/hooks/useNavigationLogger.d.ts +13 -0
  229. package/lib/typescript/src/hooks/useNavigationLogger.d.ts.map +1 -0
  230. package/lib/typescript/src/hooks/useSlideDetailAnimation.d.ts +11 -0
  231. package/lib/typescript/src/hooks/useSlideDetailAnimation.d.ts.map +1 -0
  232. package/lib/typescript/src/index.d.ts +26 -0
  233. package/lib/typescript/src/index.d.ts.map +1 -0
  234. package/lib/typescript/src/initialize.d.ts +32 -0
  235. package/lib/typescript/src/initialize.d.ts.map +1 -0
  236. package/lib/typescript/src/interceptors/networkInterceptor.d.ts +18 -0
  237. package/lib/typescript/src/interceptors/networkInterceptor.d.ts.map +1 -0
  238. package/lib/typescript/src/native/NativeDebugLibs.d.ts +11 -0
  239. package/lib/typescript/src/native/NativeDebugLibs.d.ts.map +1 -0
  240. package/lib/typescript/src/types/index.d.ts +109 -0
  241. package/lib/typescript/src/types/index.d.ts.map +1 -0
  242. package/lib/typescript/src/utils/colors.d.ts +21 -0
  243. package/lib/typescript/src/utils/colors.d.ts.map +1 -0
  244. package/lib/typescript/src/utils/copyToComputer.d.ts +30 -0
  245. package/lib/typescript/src/utils/copyToComputer.d.ts.map +1 -0
  246. package/lib/typescript/src/utils/createChannelFeature.d.ts +18 -0
  247. package/lib/typescript/src/utils/createChannelFeature.d.ts.map +1 -0
  248. package/lib/typescript/src/utils/createEventChannel.d.ts +7 -0
  249. package/lib/typescript/src/utils/createEventChannel.d.ts.map +1 -0
  250. package/lib/typescript/src/utils/createObservableStore.d.ts +9 -0
  251. package/lib/typescript/src/utils/createObservableStore.d.ts.map +1 -0
  252. package/lib/typescript/src/utils/layout.d.ts +2 -0
  253. package/lib/typescript/src/utils/layout.d.ts.map +1 -0
  254. package/lib/typescript/src/utils/safeStringify.d.ts +6 -0
  255. package/lib/typescript/src/utils/safeStringify.d.ts.map +1 -0
  256. package/lib/typescript/src/utils/urlRewriterRegistry.d.ts +7 -0
  257. package/lib/typescript/src/utils/urlRewriterRegistry.d.ts.map +1 -0
  258. package/package.json +67 -24
  259. package/src/components/ClipboardTab.tsx +81 -0
  260. package/src/components/ConsoleLogTab.tsx +95 -0
  261. package/src/components/DebugPanel.tsx +215 -0
  262. package/src/components/DebugView.tsx +80 -0
  263. package/src/components/EnvironmentTab.tsx +276 -0
  264. package/src/components/FeatureTabBar.tsx +204 -0
  265. package/src/components/FloatIcon.tsx +171 -0
  266. package/src/components/FloatPanelView.tsx +202 -0
  267. package/src/components/NavigationLogTab.tsx +66 -0
  268. package/src/components/NetworkLogTab.tsx +270 -0
  269. package/src/components/ThirdPartyLibsTab.tsx +63 -0
  270. package/src/components/TrackLogTab.tsx +110 -0
  271. package/src/components/ZustandLogTab.tsx +203 -0
  272. package/src/components/shared/CollapsibleSection.tsx +78 -0
  273. package/src/components/shared/CopyButton.tsx +68 -0
  274. package/src/components/shared/JsonView.tsx +125 -0
  275. package/src/components/shared/LogListScreen.tsx +164 -0
  276. package/src/core/DebugToolkit.tsx +150 -0
  277. package/src/core/DebugToolkitProvider.tsx +83 -0
  278. package/src/features/ClipboardFeature.ts +15 -0
  279. package/src/features/ConsoleLogFeature.ts +116 -0
  280. package/src/features/EnvironmentFeature.ts +186 -0
  281. package/src/features/NavigationLogFeature.ts +44 -0
  282. package/src/features/NetworkFeature.ts +126 -0
  283. package/src/features/ThirdPartyLibsFeature.ts +42 -0
  284. package/src/features/TrackFeature.ts +34 -0
  285. package/src/features/ZustandLogFeature.ts +101 -0
  286. package/src/hooks/useNavigationLogger.ts +102 -0
  287. package/src/hooks/useSlideDetailAnimation.ts +45 -0
  288. package/src/index.ts +48 -0
  289. package/src/initialize.ts +122 -0
  290. package/src/interceptors/networkInterceptor.ts +646 -0
  291. package/src/native/NativeDebugLibs.ts +74 -0
  292. package/src/types/index.ts +127 -0
  293. package/src/utils/colors.ts +38 -0
  294. package/src/utils/copyToComputer.ts +104 -0
  295. package/src/utils/createChannelFeature.ts +55 -0
  296. package/src/utils/createEventChannel.ts +22 -0
  297. package/src/utils/createObservableStore.ts +42 -0
  298. package/src/utils/layout.ts +1 -0
  299. package/src/utils/safeStringify.ts +25 -0
  300. package/src/utils/urlRewriterRegistry.ts +10 -0
  301. package/.cursor/rules/react-native.mdc +0 -41
  302. package/index.js +0 -41
  303. package/ios/BuildTypeModule.h +0 -9
  304. package/ios/BuildTypeModule.m +0 -42
  305. package/ios/RNDebugLibs.h +0 -10
  306. package/ios/RNDebugLibs.m +0 -79
  307. package/lib/DebugToolKit.js +0 -126
  308. package/lib/EnvironmentManager.ts +0 -80
  309. package/lib/NativeDebugLibs.js +0 -67
  310. package/lib/features/ConsoleLogFeature.js +0 -70
  311. package/lib/features/NavigationLogFeature.js +0 -45
  312. package/lib/features/NetworkFeature.js +0 -389
  313. package/lib/features/PerformanceFeature.js +0 -390
  314. package/lib/features/ThirdPartyLibsFeature.js +0 -63
  315. package/lib/features/TrackFeature.js +0 -94
  316. package/lib/features/ZustandLogFeature.js +0 -44
  317. package/lib/hooks/useNavigationLogger.js +0 -92
  318. package/lib/index.js +0 -114
  319. package/lib/navigation/NavigationLogger.js +0 -1
  320. package/lib/types/TrackTypes.ts +0 -92
  321. package/lib/utils/DebugConst.js +0 -67
  322. package/lib/utils/StorageUtils.js +0 -80
  323. package/lib/views/ConsoleLogDetails.js +0 -314
  324. package/lib/views/FloatPanelView.js +0 -697
  325. package/lib/views/HttpLogDetails.js +0 -648
  326. package/lib/views/NavigationLogDetails.js +0 -302
  327. package/lib/views/RestartModal.js +0 -75
  328. package/lib/views/SubViewConsoleLogs.js +0 -209
  329. package/lib/views/SubViewEnvironment.js +0 -73
  330. package/lib/views/SubViewHTTPLogs.js +0 -235
  331. package/lib/views/SubViewNavigationLogs.js +0 -199
  332. package/lib/views/SubViewPerformance.js +0 -515
  333. package/lib/views/SubViewThirdPartyLibs.js +0 -239
  334. package/lib/views/SubViewTrackLogs.js +0 -318
  335. package/lib/views/SubViewZustandLogs.js +0 -279
  336. package/lib/views/TabView.js +0 -66
  337. package/lib/views/TrackLogDetails.js +0 -481
  338. package/lib/views/ZustandLogDetails.js +0 -355
  339. package/react-native-debug-toolkit.podspec +0 -25
  340. 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
- A simple yet powerful debugging toolkit for React Native with a convenient floating UI for development.
3
+ [中文文档](README.zh-CN.md)
4
4
 
5
- ## Installation
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
- ### iOS Additional Setup
7
+ > Zero impact on production builds (`__DEV__` only).
14
8
 
15
- This toolkit uses FLEX and DoraemonKit for iOS debugging features. To properly integrate:
9
+ ## Features
16
10
 
17
- 1. Make sure CocoaPods is installed in your project
18
- 2. Add these dependencies to your Podfile:
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
- ```ruby
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
- #ifdef DEBUG
33
- DoraemonManager *doKit = [DoraemonManager shareInstance];
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
- 4. Run pod install in your iOS directory:
25
+ Optional clipboard copy support:
41
26
 
42
27
  ```bash
43
- cd ios && pod install
28
+ npm install @react-native-clipboard/clipboard
44
29
  ```
45
30
 
46
- ### Android Additional Setup
47
-
48
- 1. Add the following to your `android/settings.gradle`:
31
+ ## Quick Start
49
32
 
50
- ```gradle
51
- include ':react-native-debug-toolkit'
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
- 2. Add these dependencies to your `android/app/build.gradle`:
56
-
57
- ```gradle
58
- dependencies {
59
- // Other dependencies...
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
- 3. Initialize DoKit in your `MainApplication.kt`:
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
- ## Basic Usage
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
- The easiest way to add the debug toolkit to your app is using the `initializeDebugToolkit` function with default features:
49
+ ### With Navigation Tracking
85
50
 
86
- ```javascript
87
- // In your App.js or other initialization file
88
- import React, { useEffect } from 'react';
89
- import { initializeDebugToolkit, isDebugMode } from 'react-native-debug-toolkit';
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
- useEffect(() => {
93
- if (isDebugMode) {
94
- // Initialize with all default features
95
- initializeDebugToolkit();
96
-
97
- // Or select specific built-in features
98
- // initializeDebugToolkit(['network', 'console', 'zustand', 'navigation', 'thirdPartyLibs']);
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
- That's it! Your app will now display a floating debug panel in development mode, giving you access to all debugging features.
111
-
112
- ## Built-in Features
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
- By initializing with the single line of code above, you'll automatically get access to all these debugging features:
81
+ ### Disable Specific Features
115
82
 
116
- - **Network**: Track and inspect all network requests and responses
117
- - **Console**: View all console logs within the app
118
- - **Zustand**: Monitor Zustand state management (if your app uses Zustand)
119
- - **Navigation**: Automatically track navigation events in your app
120
- - **ThirdPartyLibs**: Quick access to native debugging tools (FLEX for iOS, DoraemonKit)
83
+ ```tsx
84
+ <DebugView features={{ clipboard: false, zustand: false }}>
85
+ <AppContent />
86
+ </DebugView>
87
+ ```
121
88
 
122
- ## Integration
89
+ ## `<DebugView>` Props
123
90
 
124
- ### Advanced Axios Network Tracking
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
- For projects using Axios, you can enable more detailed network request tracking:
99
+ ### Per-feature options
127
100
 
128
- ```javascript
129
- import axios from 'axios';
130
- import { createNetworkFeature, isDebugMode } from 'react-native-debug-toolkit';
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
- // Get network feature instance and set up Axios interceptors
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
- ### Monitoring Zustand Stores (If You Use Zustand)
113
+ ## Usage Examples
144
114
 
145
- If your app uses Zustand for state management, just add the middleware to track all state changes:
115
+ ### Zustand middleware
146
116
 
147
- ```javascript
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
- (set) => ({
155
- count: 0,
156
- increment: () => set((state) => ({ count: state.count + 1 })),
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
- ### Navigation Tracking (React Navigation)
128
+ ### Custom events
164
129
 
165
- If you're using React Navigation, adding navigation tracking is just one step:
130
+ ```tsx
131
+ import { addTrackLog } from 'react-native-debug-toolkit';
166
132
 
167
- ```javascript
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
- ## Custom Configuration
136
+ ### Copy to computer
187
137
 
188
- If you don't need all features, you can selectively enable specific ones:
138
+ ```tsx
139
+ import { copyToComputer } from 'react-native-debug-toolkit';
140
+
141
+ await copyToComputer(jsonString);
142
+ ```
189
143
 
190
- ```javascript
191
- // Only enable network and console logging features
192
- initializeDebugToolkit(['network', 'console']);
144
+ ## Advanced: Imperative API
193
145
 
194
- // Or specify a custom set of features
195
- initializeDebugToolkit([
196
- 'network',
197
- 'console',
198
- 'zustand',
199
- 'navigation',
200
- 'thirdPartyLibs'
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
- ## Creating Custom Debug Features
205
-
206
- You can create your own custom debugging features:
207
-
208
- ```javascript
209
- // In myCustomFeature.js
210
- export const createMyCustomFeature = () => {
211
- let customData = [];
212
-
213
- return {
214
- name: 'custom', // Unique identifier
215
- label: 'My Custom Feature', // Display name in UI
216
-
217
- setup: () => {
218
- // Initialize your feature
219
- console.log('My custom feature initialized');
220
-
221
- // Start capturing data, set up listeners, etc.
222
- const interval = setInterval(() => {
223
- customData.push({
224
- timestamp: new Date(),
225
- value: Math.random() * 100
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
- // Usage with initializeDebugToolkit
251
- initializeDebugToolkit(['network', 'console', createMyCustomFeature]);
187
+ const toolkit = initializeDebugToolkit();
188
+ toolkit?.addFeature(myFeature);
252
189
  ```
253
190
 
254
- ## Troubleshooting
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
- ### Debug panel not showing
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
- ### iOS features not working
261
- - Verify that you've added FLEX and DoraemonKit to your Podfile
262
- - Run `pod install` again after making changes
263
- - Make sure you're running a Debug build
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
- ### Network requests not captured
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
- ### App performance issues
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