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
@@ -1,389 +0,0 @@
1
- import React from 'react'
2
-
3
- class NetworkFeature {
4
- static instance = null
5
- static MAX_LOGS = 200
6
-
7
- constructor() {
8
- if (NetworkFeature.instance) {
9
- return NetworkFeature.instance
10
- }
11
-
12
- this.logs = []
13
- this.pendingAxiosRequests = new Map()
14
- this.originalFetch = null
15
- this.blacklist = [] // URL patterns to exclude from logging
16
-
17
- NetworkFeature.instance = this
18
- }
19
-
20
- setup() {
21
-
22
- // this._interceptFetch()
23
- return this
24
- }
25
-
26
- getData() {
27
- return this.logs
28
- }
29
-
30
- cleanup() {
31
- if (this.originalFetch) {
32
- global.fetch = this.originalFetch
33
- this.originalFetch = null
34
- }
35
-
36
- this.logs = []
37
- this.pendingAxiosRequests.clear()
38
- }
39
-
40
- // Check if a URL matches any pattern in the blacklist
41
- isUrlBlacklisted(url) {
42
- if (!url) return false
43
-
44
- return this.blacklist.some(pattern => {
45
- if (pattern instanceof RegExp) {
46
- return pattern.test(url)
47
- }
48
- return url.includes(pattern)
49
- })
50
- }
51
-
52
- // Add a URL pattern to blacklist
53
- addUrlToBlacklist(pattern) {
54
- if (!this.blacklist.some(p =>
55
- (p instanceof RegExp && pattern instanceof RegExp) ?
56
- p.toString() === pattern.toString() : p === pattern)) {
57
- this.blacklist.push(pattern)
58
- }
59
- }
60
-
61
- // Remove a URL pattern from blacklist
62
- removeUrlFromBlacklist(pattern) {
63
- this.blacklist = this.blacklist.filter(p =>
64
- (p instanceof RegExp && pattern instanceof RegExp) ?
65
- p.toString() !== pattern.toString() : p !== pattern)
66
- }
67
-
68
- // Clear all patterns from blacklist
69
- clearBlacklist() {
70
- this.blacklist = []
71
- }
72
-
73
- setupAxiosInterceptors(axiosInstance) {
74
-
75
- axiosInstance.interceptors.request.use(
76
- (config) => {
77
- // Generate a unique ID if one doesn't exist
78
- if (!config.headers) {
79
- config.headers = {}
80
- }
81
-
82
- if (!config.headers['X-Request-Id']) {
83
- config.headers['X-Request-Id'] =
84
- Date.now().toString() + Math.random().toString(36).substring(2, 10)
85
- }
86
-
87
- const trackId = config.headers['X-Request-Id']
88
- this.pendingAxiosRequests.set(trackId, {
89
- timestamp: new Date(),
90
- startTime: Date.now(),
91
- })
92
-
93
- return config
94
- },
95
- (error) => {
96
- this.logAxiosError(error)
97
- return Promise.reject(error)
98
- },
99
- )
100
-
101
- axiosInstance.interceptors.response.use(
102
- (response) => {
103
- this.logAxiosResponse(response)
104
- return response
105
- },
106
- (error) => {
107
- this.logAxiosError(error)
108
- return Promise.reject(error)
109
- },
110
- )
111
- }
112
-
113
- logAxiosResponse(response) {
114
- if (!response || !response.config || !response.config.headers) {
115
- return
116
- }
117
-
118
- const trackId = response.config.headers['X-Request-Id']
119
- const pendingRequest = this.pendingAxiosRequests.get(trackId)
120
-
121
- if (!pendingRequest) {
122
- return
123
- }
124
-
125
- const url = `${response.config.baseURL || ''}${response.config.url}`
126
-
127
- // Skip logging if URL is blacklisted
128
- if (this.isUrlBlacklisted(url)) {
129
- this.pendingAxiosRequests.delete(trackId)
130
- return
131
- }
132
-
133
- if (this.logs.length >= NetworkFeature.MAX_LOGS) {
134
- this.logs.shift()
135
- }
136
-
137
- // Calculate duration
138
- const duration = Date.now() - pendingRequest.startTime
139
-
140
- const logEntry = {
141
- timestamp: pendingRequest.timestamp,
142
- duration: Math.round(duration),
143
- request: {
144
- url: url,
145
- method: response.config.method?.toUpperCase() || 'GET',
146
- headers: response.config.headers,
147
- body: response.config.data || response.config.params,
148
- },
149
- response: {
150
- status: response.status,
151
- statusText: response.statusText,
152
- headers: response.headers,
153
- },
154
- }
155
-
156
- if (response.data && typeof response.data === 'object') {
157
- logEntry.response.success = response.data.success !== false
158
- logEntry.response.data = response.data
159
- } else {
160
- logEntry.response.success =
161
- response.status >= 200 && response.status < 300
162
-
163
- if (response.data) {
164
- logEntry.response.data = response.data
165
- }
166
- }
167
-
168
- this.logs.push(logEntry)
169
- this.pendingAxiosRequests.delete(trackId)
170
- }
171
-
172
- logAxiosError(error) {
173
- if (!error.config) {
174
- return
175
- }
176
-
177
- if (!error.config.headers) {
178
- error.config.headers = {}
179
- }
180
-
181
- const trackId = error.config.headers['X-Request-Id']
182
- const pendingRequest = this.pendingAxiosRequests.get(trackId)
183
-
184
- const startTime = pendingRequest
185
- ? pendingRequest.startTime
186
- : Date.now() - 100
187
-
188
- const url = `${error.config.baseURL || ''}${error.config.url}`
189
-
190
- // Skip logging if URL is blacklisted
191
- if (this.isUrlBlacklisted(url)) {
192
- this.pendingAxiosRequests.delete(trackId)
193
- return
194
- }
195
-
196
- if (this.logs.length >= NetworkFeature.MAX_LOGS) {
197
- this.logs.shift()
198
- }
199
-
200
- const duration = Date.now() - startTime
201
-
202
- const logEntry = {
203
- timestamp: pendingRequest ? pendingRequest.timestamp : new Date(),
204
- duration: Math.round(duration),
205
- request: {
206
- url: url,
207
- method: error.config.method?.toUpperCase() || 'GET',
208
- headers: error.config.headers,
209
- body: error.config.data || error.config.params,
210
- },
211
- error: error.message,
212
- success: false,
213
- }
214
-
215
- if (error.response && error.response.data) {
216
- logEntry.response = {
217
- status: error.response.status,
218
- statusText: error.response.statusText,
219
- headers: error.response.headers,
220
- data: error.response.data,
221
- success: false,
222
- }
223
- }
224
-
225
- this.logs.push(logEntry)
226
- this.pendingAxiosRequests.delete(trackId)
227
- }
228
-
229
- _interceptFetch() {
230
-
231
- this.originalFetch = global.fetch
232
-
233
- global.fetch = async (...args) => {
234
- const request = args[0]
235
- const options = args[1] || {}
236
- const startTime = Date.now()
237
-
238
- try {
239
- const response = await this.originalFetch(...args)
240
- this._logFetchResponse(request, options, response.clone(), startTime)
241
- return response
242
- } catch (error) {
243
- this._logFetchError(request, options, error, startTime)
244
- throw error
245
- }
246
- }
247
- }
248
-
249
- _logFetchResponse(request, options, response, startTime) {
250
- const requestUrl = typeof request === 'string' ? request : request.url
251
-
252
- // Skip logging if URL is blacklisted
253
- if (this.isUrlBlacklisted(requestUrl)) {
254
- return
255
- }
256
-
257
- if (this.logs.length >= NetworkFeature.MAX_LOGS) {
258
- this.logs.shift()
259
- }
260
-
261
- const duration = Date.now() - startTime
262
-
263
- const commonData = {
264
- timestamp: new Date(),
265
- duration: Math.round(duration),
266
- request: {
267
- url: requestUrl,
268
- method: options.method || 'GET',
269
- headers: options.headers || {},
270
- body: options.body,
271
- },
272
- }
273
-
274
- // Try to parse JSON response
275
- response
276
- .text()
277
- .then((text) => {
278
- let responseData
279
- let success = response.status >= 200 && response.status < 300
280
-
281
- try {
282
- // Try to parse as JSON
283
- if (text) {
284
- responseData = JSON.parse(text)
285
-
286
- // Use API success flag if available
287
- if (responseData && typeof responseData.success !== 'undefined') {
288
- success = !!responseData.success
289
- }
290
- }
291
- } catch (e) {
292
- // Not JSON, use text response
293
- responseData = text
294
- }
295
-
296
- const logEntry = {
297
- ...commonData,
298
- response: {
299
- status: response.status,
300
- statusText: response.statusText,
301
- headers: this._headersToObject(response.headers),
302
- data: responseData,
303
- success: success,
304
- },
305
- }
306
-
307
- this.logs.push(logEntry)
308
- })
309
- .catch((err) => {
310
- // Fallback for when we can't read the response body
311
- const logEntry = {
312
- ...commonData,
313
- response: {
314
- status: response.status,
315
- statusText: response.statusText,
316
- headers: this._headersToObject(response.headers),
317
- success: response.status >= 200 && response.status < 300,
318
- },
319
- }
320
-
321
- this.logs.push(logEntry)
322
- })
323
- }
324
-
325
- _logFetchError(request, options, error, startTime) {
326
- const requestUrl = typeof request === 'string' ? request : request.url
327
-
328
- // Skip logging if URL is blacklisted
329
- if (this.isUrlBlacklisted(requestUrl)) {
330
- return
331
- }
332
-
333
- if (this.logs.length >= NetworkFeature.MAX_LOGS) {
334
- this.logs.shift()
335
- }
336
-
337
- const duration = Date.now() - startTime
338
-
339
- this.logs.push({
340
- timestamp: new Date(),
341
- duration: Math.round(duration),
342
- request: {
343
- url: requestUrl,
344
- method: options.method || 'GET',
345
- headers: options.headers || {},
346
- body: options.body,
347
- },
348
- error: error.message,
349
- success: false,
350
- })
351
- }
352
-
353
- // Utility to convert Headers object to plain object
354
- _headersToObject(headers) {
355
- const result = {}
356
-
357
- if (headers && typeof headers.forEach === 'function') {
358
- headers.forEach((value, key) => {
359
- result[key] = value
360
- })
361
- } else if (headers) {
362
- // Fallback for non-standard headers object
363
- Object.keys(headers).forEach((key) => {
364
- result[key] = headers[key]
365
- })
366
- }
367
-
368
- return result
369
- }
370
- }
371
-
372
- export const createNetworkFeature = () => {
373
- const feature = new NetworkFeature()
374
-
375
- return {
376
- name: 'network',
377
- label: 'Network Logs',
378
- setup: () => feature.setup(),
379
- getData: () => feature.getData(),
380
- cleanup: () => feature.cleanup(),
381
- setupAxiosInterceptors: (axiosInstance) =>
382
- feature.setupAxiosInterceptors(axiosInstance),
383
- // Expose blacklist management methods
384
- addUrlToBlacklist: (pattern) => feature.addUrlToBlacklist(pattern),
385
- removeUrlFromBlacklist: (pattern) => feature.removeUrlFromBlacklist(pattern),
386
- clearBlacklist: () => feature.clearBlacklist(),
387
- getBlacklist: () => feature.blacklist,
388
- }
389
- }