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/lib/index.js DELETED
@@ -1,114 +0,0 @@
1
- import DebugToolKit from './DebugToolKit'
2
- import { createNetworkFeature } from './features/NetworkFeature'
3
- // import { createPerformanceFeature} from './features/PerformanceFeature'
4
- import { createConsoleLogFeature } from './features/ConsoleLogFeature'
5
- import { createZustandLogFeature, zustandLogMiddleware } from './features/ZustandLogFeature'
6
- import { createNavigationLogFeature, addNavigationLog } from './features/NavigationLogFeature'
7
- import { createThirdPartyLibsFeature } from './features/ThirdPartyLibsFeature'
8
- import { createTrackFeature, addTrackLog } from './features/TrackFeature'
9
- import NativeDebugLibs from './NativeDebugLibs'
10
-
11
- // Registry mapping feature names (strings) to their creator functions
12
- const featureRegistry = {
13
- network: createNetworkFeature,
14
- track: createTrackFeature,
15
- console: createConsoleLogFeature,
16
- // performance: createPerformanceFeature,
17
- zustand: createZustandLogFeature,
18
- navigation: createNavigationLogFeature,
19
- thirdPartyLibs: createThirdPartyLibsFeature,
20
- // Add other built-in features here
21
- // 'storage': createStorageFeature,
22
- }
23
-
24
- // List of default features (can use strings now)
25
- const defaultFeatures = ['network', 'track', 'navigation','zustand', 'thirdPartyLibs', 'console']
26
-
27
- // Export the debug mode status - this is used by the app
28
- // const isDebugMode = NativeDebugLibs.isDebugBuild();
29
- const isDebugMode = true
30
-
31
- /**
32
- * Initializes and shows the Debug ToolKit panel with specified features.
33
- * Only runs in debug mode.
34
- * Features can be specified as strings (e.g., 'network') or creator functions.
35
- * @param {Array<string|Function>} features - Array of feature names (strings) or creator functions. Defaults to standard features.
36
- * @param {Object} options - Additional options like doraemonProductId for third-party debug libraries
37
- */
38
- export function initializeDebugToolkit(features = defaultFeatures, options = {}) {
39
- // Create instance but it will internally handle debug mode check
40
- try {
41
- const debugToolKit = new DebugToolKit();
42
-
43
- // If not in debug mode, the class methods won't do anything
44
- if (!isDebugMode) {
45
- return debugToolKit;
46
- }
47
-
48
- // Initialize third-party debug libraries if configured
49
- if (options.doraemonProductId) {
50
- NativeDebugLibs.installDoraemonKit(options.doraemonProductId);
51
- }
52
-
53
- features.forEach(featureIdentifier => {
54
- let feature = null;
55
- let featureCreator = null;
56
-
57
- if (typeof featureIdentifier === 'string') {
58
- // It's a string, look it up in the registry
59
- featureCreator = featureRegistry[featureIdentifier];
60
- if (!featureCreator) {
61
- console.warn(`[DebugToolKit] Unknown feature identifier string: "${featureIdentifier}". Skipping.`);
62
- return; // Skip this identifier
63
- }
64
- feature = featureCreator();
65
- } else if (typeof featureIdentifier === 'function') {
66
- // It's a function, assume it's a creator
67
- featureCreator = featureIdentifier;
68
- try {
69
- feature = featureCreator();
70
- } catch (e) {
71
- console.error(`[DebugToolKit] Error calling feature creator function:`, e);
72
- return; // Skip if creator fails
73
- }
74
- } else if (typeof featureIdentifier === 'object' && featureIdentifier !== null && featureIdentifier.name) {
75
- // It might be a pre-created feature object
76
- feature = featureIdentifier;
77
- console.warn(`[DebugToolKit] Passing pre-created feature objects is supported but using strings or creators is recommended.`);
78
- } else {
79
- console.warn('[DebugToolKit] Invalid feature identifier type:', typeof featureIdentifier, featureIdentifier, '. Skipping.');
80
- return; // Skip invalid types
81
- }
82
-
83
- if (feature) {
84
- debugToolKit.addFeature(feature);
85
- } else {
86
- // This case might happen if a creator function returns null/undefined
87
- console.warn(`[DebugToolKit] Feature creator for identifier "${typeof featureIdentifier === 'string' ? featureIdentifier : 'custom function'}" did not return a valid feature object.`);
88
- }
89
- });
90
-
91
- debugToolKit.showDebugPanel();
92
- return debugToolKit; // Return instance if needed elsewhere
93
- } catch (error) {
94
- console.error('[DebugToolKit] Failed to initialize:', error);
95
- return null;
96
- }
97
- }
98
-
99
- // Export existing stuff and the new initializer
100
- export {
101
- DebugToolKit,
102
- createNetworkFeature,
103
- // createPerformanceFeature,
104
- createConsoleLogFeature,
105
- createZustandLogFeature,
106
- createNavigationLogFeature,
107
- createThirdPartyLibsFeature,
108
- addNavigationLog,
109
- createTrackFeature,
110
- addTrackLog,
111
- zustandLogMiddleware, // Export middleware for use in Zustand stores
112
- featureRegistry,
113
- isDebugMode
114
- };
@@ -1 +0,0 @@
1
-
@@ -1,92 +0,0 @@
1
- // Define the entity types and names as constants for better type safety
2
- export const EntityType = {
3
- mine_module: 'mine_module',
4
- search_module: 'search_module',
5
- page_view: 'page_view',
6
- error_module: 'error_module',
7
- navigation: 'navigation',
8
- content: 'content',
9
- user_action: 'user_action',
10
- } as const
11
-
12
- export const EntityName = {
13
- MINE_POST: 'MINE_POST',
14
- HOME_PAGE: 'HOME_PAGE',
15
- SEARCH_BAR: 'SEARCH_BAR',
16
- PROFILE_PAGE: 'PROFILE_PAGE',
17
- NAVIGATION_TAB: 'NAVIGATION_TAB',
18
- CONTENT_ITEM: 'CONTENT_ITEM',
19
- USER_BUTTON: 'USER_BUTTON',
20
- } as const
21
-
22
- export type TrackEventOptions = {
23
- entityType: (typeof EntityType)[keyof typeof EntityType]
24
- entityName?: (typeof EntityName)[keyof typeof EntityName]
25
- pageId?: string
26
- objId?: string
27
- entityPath?: string
28
- objType?: number
29
- objPt?: string // 瀑布流作品pt
30
- refPageLocation?: string
31
- position?: string
32
- entityLocation?: string
33
- frontOperation?: string
34
- sessionId?: string //搜索模块需要
35
- requestId?: string //搜索模块需要
36
- searchKeywored?: string //搜索模块需要
37
- enSearchKeywored?: string //搜索模块需要
38
- }
39
-
40
- // Complete event structure that includes the event name and all tracking options
41
- export type TrackEvent = {
42
- eventName: string
43
- timestamp: Date
44
- } & TrackEventOptions
45
-
46
- // Track feature interface
47
- export interface ITrackFeature {
48
- setup(): ITrackFeature
49
- getData(): TrackEvent[]
50
- cleanup(): void
51
- logEvent(eventData: TrackEventOptions & { eventName: string }): void
52
- getEventStats(): EventStats
53
- addEventToBlacklist(pattern: string | RegExp): void
54
- removeEventFromBlacklist(pattern: string | RegExp): void
55
- clearBlacklist(): void
56
- getBlacklist(): (string | RegExp)[]
57
- }
58
-
59
- // Event statistics structure
60
- export type EventStats = {
61
- [eventName: string]: {
62
- count: number
63
- lastSeen: Date
64
- entityTypes: string[]
65
- operations: string[]
66
- }
67
- }
68
-
69
- // Common event names used in the application
70
- export const CommonEventNames = {
71
- LOG_ACTION_FRONT: 'log_action_front',
72
- LOG_ERROR_FRONT: 'log_error_front',
73
- LOG_VIEW_FRONT: 'log_view_front',
74
- LOG_SEARCH_FRONT: 'log_search_front',
75
- LOG_NAVIGATION_FRONT: 'log_navigation_front',
76
- } as const
77
-
78
- // Common front operations
79
- export const FrontOperations = {
80
- CLICK: 'click',
81
- VIEW: 'view',
82
- SEARCH: 'search',
83
- SWIPE: 'swipe',
84
- SCROLL: 'scroll',
85
- ERROR: 'error',
86
- NAVIGATE: 'navigate',
87
- } as const
88
-
89
- // Helper type for creating events with better type safety
90
- export type CreateTrackEvent<T extends keyof typeof CommonEventNames> = {
91
- eventName: (typeof CommonEventNames)[T]
92
- } & TrackEventOptions
@@ -1,67 +0,0 @@
1
- import { Dimensions } from 'react-native';
2
-
3
- const { width: screenWidth, height: screenHeight } = Dimensions.get('window');
4
-
5
- export const IconRadius = 50;
6
- export const PanelWidth = screenWidth * 0.85;
7
- export const PanelHeight = screenHeight * 0.85;
8
-
9
- export const DebugColors = {
10
- white: '#FFFFFF',
11
- blue: '#007AFF',
12
- text: '#000000',
13
- border: '#CCCCCC',
14
- background: '#F5F5F5',
15
- success: '#4CD964',
16
- error: '#FF3B30',
17
- warning: '#FF9500'
18
- };
19
- export const getLogLevelColor = (level) => {
20
- switch (level?.toLowerCase()) {
21
- case 'log':
22
- return '#333'; // Dark gray for standard log
23
- case 'info':
24
- return '#0D96F2'; // Blue for info
25
- case 'warn':
26
- return '#FCA130'; // Orange for warning
27
- case 'error':
28
- return '#F93E3E'; // Red for error
29
- default:
30
- return '#666666'; // Default gray
31
- }
32
- };
33
- export const DebugImgs = {
34
- iconLink: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADsSURBVGhD7ZgxDoMwDEV9/xvQtReoGBASYmFhYmNiYmNhYWJiQQIJqUh8y05wlAYw+T/pD5Dg9xwnhPR6vV6v1+v1er3eGvuOb7yIhxEQvjAC4hRGQJzGCIhLGAFxGSMgbmEExC2MgLiFERC3MALiFkZA3MIIiFsYAXELIyBuYQTELYyAuIURELcwAuIWRkDcwgiIWxgBcQsjIG5hBMQtjIC4hREQtzAC4hZGQNzCCIhbGAFxCyMgbmEExC2MgLiFERC3MALiFkZA3MIIiFsYAXELIyBuYQTELYyAuIURELcwAuIWRkDcwgiIW/+PYBgfhPtL9WBrfKUAAAAASUVORK5CYII='
35
- };
36
-
37
- // Function to get color for Zustand action types
38
- export const getZustandActionColor = (action) => {
39
- if (!action) return '#666666'; // Default gray
40
-
41
- // You can customize this based on common Zustand action patterns
42
- if (action.startsWith('set')) return '#0D96F2'; // Blue for setters
43
- if (action.startsWith('update')) return '#4CAF50'; // Green for updates
44
- if (action.startsWith('delete') || action.startsWith('remove')) return '#F93E3E'; // Red for deletions
45
- if (action.startsWith('toggle')) return '#FCA130'; // Orange for toggles
46
- if (action.startsWith('init')) return '#9C27B0'; // Purple for initialization
47
-
48
- return '#0D96F2'; // Default blue for other actions
49
- };
50
-
51
- // Navigation action colors
52
- export const getNavigationActionColor = (action) => {
53
- switch (action?.toLowerCase()) {
54
- case 'push':
55
- return '#0D96F2'; // Blue for push
56
- case 'pop':
57
- return '#6E7072'; // Gray for pop
58
- case 'replace':
59
- return '#4CAF50'; // Green for replace
60
- case 'reset':
61
- return '#FCA130'; // Orange for reset
62
- case 'goback':
63
- return '#9C27B0'; // Purple for go back
64
- default:
65
- return '#0D96F2'; // Default blue for navigation
66
- }
67
- };
@@ -1,80 +0,0 @@
1
- import { MMKV } from 'react-native-mmkv';
2
-
3
- // Create MMKV instance for storing debug logs
4
- const storage = new MMKV({
5
- id: 'debug-toolkit-storage',
6
- encryptionKey: 'debug-toolkit-encryption-key'
7
- });
8
-
9
- // Storage keys for different features
10
- const STORAGE_KEYS = {
11
- CONSOLE_LOGS: 'console_logs',
12
- NETWORK_LOGS: 'network_logs',
13
- PERFORMANCE_DATA: 'performance_data',
14
- ZUSTAND_LOGS: 'zustand_logs',
15
- NAVIGATION_LOGS: 'navigation_logs',
16
- };
17
-
18
- /**
19
- * Utility class for storing and retrieving logs using MMKV
20
- */
21
- export class StorageUtils {
22
- /**
23
- * Save data to MMKV storage
24
- * @param {string} key - Storage key
25
- * @param {any} data - Data to store
26
- */
27
- static saveData(key, data) {
28
- try {
29
- const jsonString = JSON.stringify(data);
30
- storage.set(key, jsonString);
31
- } catch (error) {
32
- console.error(`Error saving data for key ${key}:`, error);
33
- }
34
- }
35
-
36
- /**
37
- * Retrieve data from MMKV storage
38
- * @param {string} key - Storage key
39
- * @param {any} defaultValue - Default value if data doesn't exist
40
- * @returns {any} - Retrieved data or default value
41
- */
42
- static getData(key, defaultValue = null) {
43
- try {
44
- const jsonString = storage.getString(key);
45
- if (!jsonString) return defaultValue;
46
- return JSON.parse(jsonString);
47
- } catch (error) {
48
- console.error(`Error retrieving data for key ${key}:`, error);
49
- return defaultValue;
50
- }
51
- }
52
-
53
- /**
54
- * Delete data from MMKV storage
55
- * @param {string} key - Storage key
56
- */
57
- static deleteData(key) {
58
- try {
59
- storage.delete(key);
60
- } catch (error) {
61
- console.error(`Error deleting data for key ${key}:`, error);
62
- }
63
- }
64
-
65
- /**
66
- * Clear all debug toolkit data from storage
67
- */
68
- static clearAllData() {
69
- try {
70
- Object.values(STORAGE_KEYS).forEach(key => {
71
- storage.delete(key);
72
- });
73
- } catch (error) {
74
- console.error('Error clearing all data:', error);
75
- }
76
- }
77
- }
78
-
79
- // Export storage keys for use in features
80
- export { STORAGE_KEYS };
@@ -1,314 +0,0 @@
1
- import React from 'react'
2
- import { View, Text, StyleSheet, Clipboard } from 'react-native'
3
- import { ScrollView, Pressable } from 'react-native'
4
- import JSONTree from 'react-native-json-tree'
5
-
6
- // Re-using the theme from HttpLogDetails for consistency
7
- const theme = {
8
- scheme: 'monokai',
9
- author: 'wimer hazenberg (http://www.monokai.nl)',
10
- base00: '#272822',
11
- base01: '#383830',
12
- base02: '#49483e',
13
- base03: '#75715e',
14
- base04: '#a59f85',
15
- base05: '#f8f8f2',
16
- base06: '#f5f4f1',
17
- base07: '#f9f8f5',
18
- base08: '#f92672',
19
- base09: '#fd971f',
20
- base0A: '#f4bf75',
21
- base0B: '#a6e22e',
22
- base0C: '#a1efe4',
23
- base0D: '#66d9ef',
24
- base0E: '#ae81ff',
25
- base0F: '#cc6633'
26
- };
27
-
28
- const CopyButton = ({ text, style }) => {
29
- const [copied, setCopied] = React.useState(false)
30
-
31
- const handleCopy = async () => {
32
- await Clipboard.setString(text)
33
- setCopied(true)
34
- setTimeout(() => setCopied(false), 2000)
35
- }
36
-
37
- return (
38
- <Pressable style={[styles.copyButton, style]} onPress={handleCopy}>
39
- <Text style={styles.copyButtonText}>{copied ? 'Copied!' : 'Copy'}</Text>
40
- </Pressable>
41
- )
42
- }
43
-
44
- const CollapsibleSection = ({ title, children, initiallyExpanded = false }) => {
45
- const [expanded, setExpanded] = React.useState(initiallyExpanded)
46
-
47
- return (
48
- <View style={styles.collapsibleSection}>
49
- <Pressable
50
- style={styles.sectionHeader}
51
- onPress={() => setExpanded(!expanded)}>
52
- <Text style={styles.sectionTitle}>{title}</Text>
53
- <Text style={styles.expandIcon}>{expanded ? '▼' : '▶'}</Text>
54
- </Pressable>
55
- {expanded && children}
56
- </View>
57
- )
58
- }
59
-
60
- // Basic JSONValue renderer, might need adjustments for console log specifics
61
- const JSONValue = ({ value }) => {
62
- if (value === null) {
63
- return <Text style={styles.jsonNull}>null</Text>
64
- }
65
-
66
- if (value === undefined) {
67
- return <Text style={styles.jsonNull}>undefined</Text>
68
- }
69
-
70
- if (typeof value === 'boolean') {
71
- return <Text style={styles.jsonBoolean}>{value.toString()}</Text>
72
- }
73
-
74
- if (typeof value === 'number') {
75
- return <Text style={styles.jsonNumber}>{value}</Text>
76
- }
77
-
78
- if (typeof value === 'string') {
79
- return (
80
- <Text style={styles.jsonString} selectable={true}>
81
- "{value}"
82
- </Text>
83
- )
84
- }
85
-
86
- if (typeof value === 'object') {
87
- return (
88
- <JSONTree
89
- data={value}
90
- theme={theme}
91
- invertTheme={true}
92
- hideRoot={true}
93
- shouldExpandNode={(keyPath, nodeData, currentLevel) => currentLevel < 1}
94
- />
95
- )
96
- }
97
-
98
- return <Text style={styles.jsonOther}>{String(value)}</Text>
99
- }
100
-
101
-
102
- const ConsoleLogDetails = ({ log }) => {
103
- if (!log) {
104
- return (
105
- <View style={styles.errorContainer}>
106
- <Text style={styles.errorText}>Log data is missing</Text>
107
- </View>
108
- )
109
- }
110
-
111
- const logData = log.data || [] // Console logs can have multiple arguments
112
- const timestamp = log.timestamp
113
- const level = log.level || 'log' // Default to 'log' if level is not provided
114
-
115
- // Simple function to format log data for display and copying
116
- const formatLogData = (dataArray) => {
117
- return dataArray.map(item => {
118
- if (typeof item === 'object') {
119
- try {
120
- return JSON.stringify(item, null, 2);
121
- } catch (e) {
122
- return '[unserializable object]';
123
- }
124
- }
125
- return String(item);
126
- }).join(' ');
127
- }
128
-
129
- const formattedLog = formatLogData(logData);
130
-
131
- return (
132
- <ScrollView
133
- style={styles.container}
134
- contentContainerStyle={styles.contentContainer}
135
- showsVerticalScrollIndicator={true}
136
- scrollEventThrottle={16}
137
- keyboardShouldPersistTaps='handled'>
138
-
139
- <View style={styles.header}>
140
- <View style={styles.headerInfo}>
141
- <Text style={[styles.levelIndicator, { color: getLevelColor(level) }]}>
142
- {level.toUpperCase()}
143
- </Text>
144
- <Text style={styles.timestamp}>
145
- {timestamp
146
- ? new Date(timestamp).toLocaleString()
147
- : 'Unknown time'}
148
- </Text>
149
- </View>
150
- <CopyButton text={formattedLog} />
151
- </View>
152
-
153
- <CollapsibleSection title='Log Data' initiallyExpanded={true}>
154
- <View style={styles.dataContentWrapper}>
155
- <View style={styles.dataContent}>
156
- {logData.map((item, index) => (
157
- <View key={index} style={[styles.logDataItem, index === logData.length - 1 && styles.logDataItemLast]}>
158
- <JSONValue value={item} />
159
- </View>
160
- ))}
161
- </View>
162
- </View>
163
- </CollapsibleSection>
164
-
165
- </ScrollView>
166
- )
167
- }
168
-
169
- const getLevelColor = (level) => {
170
- switch (level?.toLowerCase()) {
171
- case 'log':
172
- return '#333'; // Dark gray for standard log
173
- case 'info':
174
- return '#0D96F2'; // Blue for info
175
- case 'warn':
176
- return '#FCA130'; // Orange for warning
177
- case 'error':
178
- return '#F93E3E'; // Red for error
179
- default:
180
- return '#666666'; // Default gray
181
- }
182
- };
183
-
184
- const getLevelTextStyle = (level) => {
185
- const baseStyle = { fontSize: 14, fontFamily: 'monospace' }; // Use monospace font
186
- return { ...baseStyle, color: getLevelColor(level) };
187
- }
188
-
189
- // Re-using and adapting styles from HttpLogDetails
190
- const styles = StyleSheet.create({
191
- container: {
192
- flex: 1,
193
- backgroundColor: '#fff',
194
- },
195
- contentContainer: {
196
- paddingBottom: 20,
197
- },
198
- header: {
199
- flexDirection: 'row',
200
- padding: 15,
201
- borderBottomWidth: 1,
202
- borderBottomColor: '#eee',
203
- alignItems: 'center', // Align items vertically
204
- justifyContent: 'space-between', // Space out items
205
- },
206
- headerInfo: {
207
- flexDirection: 'row', // Arrange level and timestamp horizontally
208
- alignItems: 'center',
209
- flexShrink: 1, // Allow info to shrink if needed
210
- marginRight: 10,
211
- },
212
- levelIndicator: {
213
- fontSize: 14,
214
- fontWeight: 'bold',
215
- marginRight: 10,
216
- },
217
- timestamp: {
218
- fontSize: 13,
219
- color: '#666',
220
- },
221
- collapsibleSection: {
222
- marginBottom: 1,
223
- backgroundColor: '#fff',
224
- },
225
- sectionHeader: {
226
- flexDirection: 'row',
227
- justifyContent: 'space-between',
228
- alignItems: 'center',
229
- padding: 15,
230
- backgroundColor: '#f5f5f5',
231
- },
232
- sectionTitle: {
233
- fontSize: 15,
234
- fontWeight: 'bold',
235
- color: '#333',
236
- },
237
- expandIcon: {
238
- fontSize: 14,
239
- color: '#666',
240
- },
241
- content: {
242
- padding: 15,
243
- },
244
- dataContentWrapper: {
245
- flex: 1,
246
- padding: 10, // Add padding around the scroll view
247
- },
248
- dataContent: {
249
- backgroundColor: '#f8f9fa',
250
- padding: 10,
251
- borderRadius: 4,
252
- borderWidth: 1,
253
- borderColor: '#e9ecef',
254
- },
255
- logDataItem: {
256
- borderBottomWidth: 1,
257
- borderBottomColor: '#eee',
258
- paddingVertical: 8,
259
- },
260
- logDataItemLast: {
261
- borderBottomWidth: 0,
262
- },
263
- errorContainer: {
264
- flex: 1,
265
- justifyContent: 'center',
266
- alignItems: 'center',
267
- padding: 20,
268
- },
269
- errorText: {
270
- color: '#ff4444',
271
- fontSize: 16,
272
- },
273
- copyButton: {
274
- backgroundColor: '#e9ecef',
275
- paddingHorizontal: 10,
276
- paddingVertical: 5,
277
- borderRadius: 4,
278
- flexShrink: 0, // Prevent button from shrinking
279
- },
280
- copyButtonText: {
281
- fontSize: 12,
282
- color: '#666',
283
- },
284
- // JSON Value Styles (simplified)
285
- jsonString: {
286
- color: '#CB772F',
287
- fontFamily: 'monospace',
288
- fontSize: 13,
289
- },
290
- jsonNumber: {
291
- color: '#AE81FF',
292
- fontFamily: 'monospace',
293
- fontSize: 13,
294
- },
295
- jsonBoolean: {
296
- color: '#66D9EF',
297
- fontWeight: 'bold',
298
- fontFamily: 'monospace',
299
- fontSize: 13,
300
- },
301
- jsonNull: {
302
- color: '#F92672',
303
- fontStyle: 'italic',
304
- fontFamily: 'monospace',
305
- fontSize: 13,
306
- },
307
- jsonOther: {
308
- color: '#75715e',
309
- fontFamily: 'monospace',
310
- fontSize: 13,
311
- },
312
- });
313
-
314
- export default ConsoleLogDetails