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
@@ -0,0 +1,127 @@
1
+ import type { ComponentType } from 'react';
2
+
3
+ export type DebugFeatureListener = () => void;
4
+
5
+ export type BuiltInFeatureName =
6
+ | 'network'
7
+ | 'console'
8
+ | 'zustand'
9
+ | 'navigation'
10
+ | 'track'
11
+ | 'environment'
12
+ | 'clipboard';
13
+
14
+ /** Props passed to a feature's renderContent component */
15
+ export interface DebugFeatureRenderProps<TData = unknown> {
16
+ data: TData[];
17
+ feature: DebugFeature<TData>;
18
+ }
19
+
20
+ /**
21
+ * Type-erased feature for heterogeneous collections.
22
+ * Individual features should use `DebugFeature<TData>` with their specific data type.
23
+ * This alias is only for places that hold features of multiple types.
24
+ */
25
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
+ export type AnyDebugFeature = DebugFeature<any>;
27
+
28
+
29
+ /** Base interface all debug features must implement */
30
+ export interface DebugFeature<TData = unknown> {
31
+ name: string;
32
+ label: string;
33
+ setup: () => void;
34
+ getData: () => TData[];
35
+ clear?: () => void;
36
+ cleanup: () => void;
37
+ subscribe?: (listener: DebugFeatureListener) => () => void;
38
+ renderContent?: ComponentType<DebugFeatureRenderProps<TData>>;
39
+ badge?: () => { label: string; color: string } | null;
40
+ }
41
+
42
+ export interface NetworkLogEntry {
43
+ id: string;
44
+ timestamp: number;
45
+ duration?: number;
46
+ request: {
47
+ url: string;
48
+ method: string;
49
+ headers?: Record<string, string>;
50
+ body?: unknown;
51
+ };
52
+ response?: {
53
+ status: number;
54
+ statusText?: string;
55
+ headers?: Record<string, string>;
56
+ data?: unknown;
57
+ success?: boolean;
58
+ };
59
+ error?: string;
60
+ }
61
+
62
+ export interface ConsoleLogEntry {
63
+ id: string;
64
+ timestamp: number;
65
+ level: 'log' | 'info' | 'warn' | 'error';
66
+ data: unknown[];
67
+ }
68
+
69
+ export interface ZustandLogEntry {
70
+ id: string;
71
+ timestamp: number;
72
+ action: string;
73
+ prevState: unknown;
74
+ nextState: unknown;
75
+ actionCompleteTime?: number;
76
+ storeName?: string;
77
+ }
78
+
79
+ export interface NavigationLogEntry {
80
+ id: string;
81
+ timestamp: number;
82
+ action: string;
83
+ from: string;
84
+ to: string;
85
+ startTime?: number;
86
+ duration?: number;
87
+ debugLog?: string;
88
+ }
89
+
90
+ export interface TrackLogEntry {
91
+ id: string;
92
+ timestamp: number;
93
+ eventName: string;
94
+ [key: string]: unknown;
95
+ }
96
+
97
+ export interface EnvironmentConfig {
98
+ id: string;
99
+ label: string;
100
+ host: string;
101
+ color?: string;
102
+ }
103
+
104
+ export interface EnvironmentState {
105
+ environments: EnvironmentConfig[];
106
+ currentEnvironmentId: string | null;
107
+ }
108
+
109
+ export interface NavigationContainerRef {
110
+ getCurrentRoute?: () => { name?: string } | undefined;
111
+ getRootState?: () => unknown;
112
+ addListener: (event: string, callback: () => void) => () => void;
113
+ }
114
+
115
+ export interface ThirdPartyLibAction {
116
+ id: string;
117
+ label: string;
118
+ onPress: () => void;
119
+ }
120
+
121
+ export interface ThirdPartyLib {
122
+ id: string;
123
+ name: string;
124
+ description: string;
125
+ platform: 'ios' | 'android' | 'both';
126
+ actions: ThirdPartyLibAction[];
127
+ }
@@ -0,0 +1,38 @@
1
+ // Apple iOS System Color Palette
2
+ export const Colors = {
3
+ // System
4
+ primary: '#007AFF',
5
+ text: '#1C1C1E',
6
+ textSecondary: '#8E8E93',
7
+ textLight: '#C7C7CC',
8
+ border: '#E5E5EA',
9
+ background: '#F2F2F7',
10
+ surface: '#FFFFFF',
11
+
12
+ // Semantic
13
+ success: '#34C759',
14
+ error: '#FF3B30',
15
+ warning: '#FF9500',
16
+ info: '#5AC8FA',
17
+
18
+ // Accent
19
+ purple: '#AF52DE',
20
+
21
+ // HTTP Method Colors
22
+ get: '#007AFF',
23
+ post: '#34C759',
24
+ put: '#FF9500',
25
+ delete: '#FF3B30',
26
+ patch: '#5AC8FA',
27
+ } as const;
28
+
29
+ export function getMethodColor(method: string): string {
30
+ switch (method.toUpperCase()) {
31
+ case 'GET': return Colors.get;
32
+ case 'POST': return Colors.post;
33
+ case 'PUT': return Colors.put;
34
+ case 'DELETE': return Colors.delete;
35
+ case 'PATCH': return Colors.patch;
36
+ default: return Colors.textSecondary;
37
+ }
38
+ }
@@ -0,0 +1,104 @@
1
+ type ClipboardModule = { setString: (value: string) => void };
2
+
3
+ let clipboardModule: ClipboardModule | null = null;
4
+ let clipboardChecked = false;
5
+
6
+ function getClipboardModule(): ClipboardModule | null {
7
+ if (clipboardChecked) return clipboardModule;
8
+ clipboardChecked = true;
9
+ try {
10
+ // Check native module exists first — getEnforcing() inside the clipboard
11
+ // package throws a fatal Invariant Violation that bypasses try/catch.
12
+ const { TurboModuleRegistry } = require('react-native');
13
+ if (!TurboModuleRegistry.get('RNCClipboard')) {
14
+ return null;
15
+ }
16
+ clipboardModule = require('@react-native-clipboard/clipboard').default;
17
+ } catch {
18
+ clipboardModule = null;
19
+ }
20
+ return clipboardModule;
21
+ }
22
+
23
+ export type CopyMethod = 'clipboard' | 'console' | 'none';
24
+
25
+ export interface CopyResult {
26
+ success: boolean;
27
+ method: CopyMethod;
28
+ }
29
+
30
+ export interface CopyOptions {
31
+ /** Descriptive label for console.log identification */
32
+ label?: string;
33
+ /** If true, only copy to clipboard without console.log */
34
+ silent?: boolean;
35
+ }
36
+
37
+ const MAX_LOG_SIZE = 10 * 1024; // 10KB
38
+
39
+ /**
40
+ * Format data for copying (pretty JSON or raw string).
41
+ */
42
+ export function fmt(data: unknown): string {
43
+ if (!data) return '';
44
+ try {
45
+ return JSON.stringify(typeof data === 'string' ? JSON.parse(data) : data, null, 2);
46
+ } catch {
47
+ return String(data);
48
+ }
49
+ }
50
+
51
+ /**
52
+ * Log content to console (Metro terminal / DevTools) with a structured prefix.
53
+ * ConsoleLogFeature intercepts console.log but still calls the original first,
54
+ * so output reliably appears in Metro terminal.
55
+ */
56
+ export function logToComputer(content: string, label?: string): void {
57
+ try {
58
+ const header = label ? `[DebugToolkit:Copy] ─── ${label} ───` : '[DebugToolkit:Copy] ─── Content ───';
59
+ console.log(header);
60
+
61
+ if (content.length > MAX_LOG_SIZE) {
62
+ console.log(content.slice(0, MAX_LOG_SIZE));
63
+ console.log(`[DebugToolkit:Copy] ... truncated (${content.length} bytes total)`);
64
+ } else {
65
+ console.log(content);
66
+ }
67
+
68
+ console.log('[DebugToolkit:Copy] ─── END ───');
69
+ } catch {
70
+ // Silently fail — console may not be available in all environments
71
+ }
72
+ }
73
+
74
+ /**
75
+ * Copy content to computer via the best available method.
76
+ *
77
+ * 1. Attempts device clipboard (if @react-native-clipboard/clipboard is installed)
78
+ * 2. Always console.logs with structured prefix (appears in Metro terminal)
79
+ * 3. Returns result indicating what succeeded
80
+ */
81
+ export function copyToComputer(content: string, options?: CopyOptions): CopyResult {
82
+ let method: CopyMethod = 'none';
83
+
84
+ // Try clipboard
85
+ try {
86
+ const clipboard = getClipboardModule();
87
+ if (clipboard) {
88
+ clipboard.setString(content);
89
+ method = 'clipboard';
90
+ }
91
+ } catch {
92
+ // Clipboard may fail, continue
93
+ }
94
+
95
+ // Always log to computer console (unless silent)
96
+ if (!options?.silent) {
97
+ logToComputer(content, options?.label);
98
+ if (method === 'none') {
99
+ method = 'console';
100
+ }
101
+ }
102
+
103
+ return { success: true, method };
104
+ }
@@ -0,0 +1,55 @@
1
+ import type { ComponentType } from 'react';
2
+ import type { DebugFeature, DebugFeatureListener, DebugFeatureRenderProps } from '../types';
3
+ import type { EventChannel } from './createEventChannel';
4
+ import { createObservableStore } from './createObservableStore';
5
+
6
+ const DEFAULT_MAX_LOGS = 200;
7
+
8
+ /**
9
+ * Generic factory for features that subscribe to an event channel.
10
+ * Eliminates boilerplate across channel-based features (Track, Navigation, Zustand).
11
+ *
12
+ * @param getChannel - Function returning the current channel (supports test resets)
13
+ * @param toEntry - Maps a payload + auto-generated id to a typed log entry
14
+ * @param options - Feature name, label, render component, and optional maxLogs
15
+ */
16
+ export function createChannelFeature<TPayload, TEntry>(
17
+ getChannel: () => EventChannel<TPayload>,
18
+ toEntry: (payload: TPayload, id: string) => TEntry,
19
+ options: {
20
+ name: string;
21
+ label: string;
22
+ renderContent?: ComponentType<DebugFeatureRenderProps<TEntry>>;
23
+ maxLogs?: number;
24
+ },
25
+ ): DebugFeature<TEntry> {
26
+ const maxLogs = options.maxLogs ?? DEFAULT_MAX_LOGS;
27
+ const logStore = createObservableStore<TEntry>();
28
+ let nextId = 0;
29
+ let initialized = false;
30
+ let unsubscribe: (() => void) | null = null;
31
+
32
+ return {
33
+ name: options.name,
34
+ label: options.label,
35
+ renderContent: options.renderContent,
36
+ setup: () => {
37
+ if (initialized) return;
38
+ unsubscribe = getChannel().subscribe((payload) => {
39
+ logStore.push(toEntry(payload, String(nextId++)), maxLogs);
40
+ });
41
+ initialized = true;
42
+ },
43
+ getData: () => logStore.getData(),
44
+ clear: () => {
45
+ logStore.clear();
46
+ },
47
+ cleanup: () => {
48
+ unsubscribe?.();
49
+ unsubscribe = null;
50
+ logStore.clear();
51
+ initialized = false;
52
+ },
53
+ subscribe: (listener: DebugFeatureListener) => logStore.subscribe(listener),
54
+ };
55
+ }
@@ -0,0 +1,22 @@
1
+ export type EventListener<TEvent> = (event: TEvent) => void;
2
+
3
+ export interface EventChannel<TEvent> {
4
+ emit: (event: TEvent) => void;
5
+ subscribe: (listener: EventListener<TEvent>) => () => void;
6
+ }
7
+
8
+ export function createEventChannel<TEvent>(): EventChannel<TEvent> {
9
+ const listeners = new Set<EventListener<TEvent>>();
10
+
11
+ return {
12
+ emit: (event) => {
13
+ listeners.forEach((listener) => listener(event));
14
+ },
15
+ subscribe: (listener) => {
16
+ listeners.add(listener);
17
+ return () => {
18
+ listeners.delete(listener);
19
+ };
20
+ },
21
+ };
22
+ }
@@ -0,0 +1,42 @@
1
+ export type StoreListener = () => void;
2
+
3
+ export interface ObservableStore<T> {
4
+ getData: () => T[];
5
+ push: (item: T, maxEntries?: number) => void;
6
+ clear: () => void;
7
+ subscribe: (listener: StoreListener) => () => void;
8
+ }
9
+
10
+ export function createObservableStore<T>(): ObservableStore<T> {
11
+ let data: T[] = [];
12
+ const listeners = new Set<StoreListener>();
13
+
14
+ const notify = () => {
15
+ listeners.forEach((listener) => listener());
16
+ };
17
+
18
+ return {
19
+ getData: () => data,
20
+ push: (item, maxEntries) => {
21
+ if (maxEntries && data.length >= maxEntries) {
22
+ data = [...data.slice(data.length - maxEntries + 1), item];
23
+ } else {
24
+ data = [...data, item];
25
+ }
26
+ notify();
27
+ },
28
+ clear: () => {
29
+ if (data.length === 0) {
30
+ return;
31
+ }
32
+ data = [];
33
+ notify();
34
+ },
35
+ subscribe: (listener) => {
36
+ listeners.add(listener);
37
+ return () => {
38
+ listeners.delete(listener);
39
+ };
40
+ },
41
+ };
42
+ }
@@ -0,0 +1 @@
1
+ export const ICON_SIZE = 52;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Safely stringify a value to JSON, handling circular references
3
+ * and values that can't be serialized.
4
+ */
5
+ export function safeStringify(value: unknown, space?: number): string {
6
+ try {
7
+ const seen = new WeakSet();
8
+
9
+ return JSON.stringify(
10
+ value,
11
+ (_, val) => {
12
+ if (typeof val === 'object' && val !== null) {
13
+ if (seen.has(val)) {
14
+ return '[Circular]';
15
+ }
16
+ seen.add(val);
17
+ }
18
+ return val;
19
+ },
20
+ space,
21
+ );
22
+ } catch {
23
+ return String(value);
24
+ }
25
+ }
@@ -0,0 +1,10 @@
1
+ type UrlRewriter = (url: string) => string;
2
+
3
+ let current: UrlRewriter | null = null;
4
+
5
+ export const urlRewriter = {
6
+ get: (): UrlRewriter | null => current,
7
+ set: (rewriter: UrlRewriter | null): void => {
8
+ current = rewriter;
9
+ },
10
+ };
@@ -1,41 +0,0 @@
1
- ---
2
- description:
3
- globs:
4
- alwaysApply: false
5
- ---
6
-
7
- You are an expert in TypeScript, React Native, Expo, and Mobile App Development.
8
-
9
- Code Style and Structure:
10
- - Write concise, type-safe TypeScript code.
11
- - Use functional components and hooks over class components.
12
- - Ensure components are modular, reusable, and maintainable.
13
- - Organize files by feature, grouping related components, hooks, and styles.
14
-
15
- Naming Conventions:
16
- - Use camelCase for variable and function names (e.g., `isFetchingData`, `handleUserInput`).
17
- - Use PascalCase for component names (e.g., `UserProfile`, `ChatScreen`).
18
-
19
- TypeScript Usage:
20
- - Use TypeScript for all components, favoring interfaces for props and state.
21
- - Enable strict typing in `tsconfig.json`.
22
- - Avoid using `any`; strive for precise types.
23
- - Utilize `React.FC` for defining functional components with props.
24
-
25
- Performance Optimization:
26
- - Minimize `useEffect`, `useState`, and heavy computations inside render methods.
27
- - Use `React.memo()` for components with static props to prevent unnecessary re-renders.
28
- - Optimize FlatLists with props like `removeClippedSubviews`, `maxToRenderPerBatch`, and `windowSize`.
29
- - Use `getItemLayout` for FlatLists when items have a consistent size to improve performance.
30
- - Avoid anonymous functions in `renderItem` or event handlers to prevent re-renders.
31
-
32
- UI and Styling:
33
- - Use consistent styling, either through `StyleSheet.create()` or Styled Components.
34
- - Ensure responsive design by considering different screen sizes and orientations.
35
- - Optimize image handling using libraries designed for React Native
36
-
37
- Best Practices:
38
- - Follow React Native's threading model to ensure smooth UI performance.
39
- - Utilize CodePush Build and Updates for continuous deployment and Over-The-Air (OTA) updates.
40
- - Use React Navigation for handling navigation and deep linking with best practices.
41
-
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