react-native-inapp-inspector 2.3.19 → 2.3.21

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 (353) hide show
  1. package/README.md +14 -14
  2. package/android/src/main/java/com/inappinspector/NetworkInspectorModule.kt +67 -0
  3. package/dist/commonjs/analytics.js +1 -24
  4. package/dist/commonjs/bundle.js +1 -16
  5. package/dist/commonjs/capture.js +1 -35
  6. package/dist/commonjs/components/AnalyticsDetail.js +92 -623
  7. package/dist/commonjs/components/AnalyticsEventCard.js +54 -350
  8. package/dist/commonjs/components/AnalyticsGraph.js +70 -370
  9. package/dist/commonjs/components/AnimatedEntrance.js +1 -11
  10. package/dist/commonjs/components/AppHeaderLogo.js +7 -134
  11. package/dist/commonjs/components/BrandCircleIcon.js +73 -118
  12. package/dist/commonjs/components/BrandSquareIcon.js +63 -108
  13. package/dist/commonjs/components/CodeSnippet.js +48 -623
  14. package/dist/commonjs/components/ConsoleLogCard.js +63 -537
  15. package/dist/commonjs/components/CopyButton.js +3 -89
  16. package/dist/commonjs/components/DiffViewer.js +19 -83
  17. package/dist/commonjs/components/DomainHeader.js +27 -127
  18. package/dist/commonjs/components/EmptyState.js +10 -87
  19. package/dist/commonjs/components/EndOfListFooter.js +7 -81
  20. package/dist/commonjs/components/ErrorBoundary.js +72 -566
  21. package/dist/commonjs/components/HeadersSection.js +31 -110
  22. package/dist/commonjs/components/HighlightText.js +17 -58
  23. package/dist/commonjs/components/Inspector/AboutModal.d.ts +6 -0
  24. package/dist/commonjs/components/Inspector/AboutModal.js +243 -0
  25. package/dist/commonjs/components/Inspector/AnalyticsFilterModal.js +98 -797
  26. package/dist/commonjs/components/Inspector/AnalyticsTab.js +284 -930
  27. package/dist/commonjs/components/Inspector/BundleTab.js +551 -2918
  28. package/dist/commonjs/components/Inspector/ConsoleTab.js +79 -492
  29. package/dist/commonjs/components/Inspector/CrashDetail.js +123 -672
  30. package/dist/commonjs/components/Inspector/CrashFilterModal.js +66 -498
  31. package/dist/commonjs/components/Inspector/CrashTab.js +98 -670
  32. package/dist/commonjs/components/Inspector/DebuggingTab.js +74 -875
  33. package/dist/commonjs/components/Inspector/DeviceInfoTab.js +143 -907
  34. package/dist/commonjs/components/Inspector/FabLauncher.js +42 -466
  35. package/dist/commonjs/components/Inspector/FeatureUnderDevNotice.js +6 -99
  36. package/dist/commonjs/components/Inspector/InspectorContext.js +1 -21
  37. package/dist/commonjs/components/Inspector/InspectorHeader.js +191 -1110
  38. package/dist/commonjs/components/Inspector/LogDetail.js +168 -994
  39. package/dist/commonjs/components/Inspector/MainScreen.js +52 -335
  40. package/dist/commonjs/components/Inspector/MediaGalleryTab.js +97 -644
  41. package/dist/commonjs/components/Inspector/MediaPreviewModal.js +90 -605
  42. package/dist/commonjs/components/Inspector/NavigationTracker.js +1 -12
  43. package/dist/commonjs/components/Inspector/NetworkDetail.js +89 -411
  44. package/dist/commonjs/components/Inspector/NetworkFilterModal.js +60 -576
  45. package/dist/commonjs/components/Inspector/NetworkTab.js +84 -514
  46. package/dist/commonjs/components/Inspector/NpmStarPrompt.js +18 -434
  47. package/dist/commonjs/components/Inspector/NpmUpdateToast.js +25 -298
  48. package/dist/commonjs/components/Inspector/PerformanceTab.js +182 -1397
  49. package/dist/commonjs/components/Inspector/ReduxDetail.js +188 -1089
  50. package/dist/commonjs/components/Inspector/ReduxTab.js +85 -701
  51. package/dist/commonjs/components/Inspector/SettingsPanel.js +427 -3807
  52. package/dist/commonjs/components/Inspector/SkeletonPlaceholder.js +11 -180
  53. package/dist/commonjs/components/Inspector/StorageTab.js +93 -826
  54. package/dist/commonjs/components/Inspector/TabBar.js +36 -334
  55. package/dist/commonjs/components/Inspector/UpdateAvailableModal.js +37 -412
  56. package/dist/commonjs/components/JsonViewer.js +168 -381
  57. package/dist/commonjs/components/LogCard.js +57 -567
  58. package/dist/commonjs/components/LogSyntaxHighlighter.js +11 -130
  59. package/dist/commonjs/components/MetaAccordion.js +69 -238
  60. package/dist/commonjs/components/MiniBarChart.js +3 -56
  61. package/dist/commonjs/components/MiniLineChart.js +3 -58
  62. package/dist/commonjs/components/NetworkIcons.d.ts +13 -0
  63. package/dist/commonjs/components/NetworkIcons.js +521 -1022
  64. package/dist/commonjs/components/QRCodeView.js +5 -79
  65. package/dist/commonjs/components/SectionHeader.js +15 -37
  66. package/dist/commonjs/components/SegmentedTabs.js +7 -62
  67. package/dist/commonjs/components/SkeletonPlaceholder.js +11 -180
  68. package/dist/commonjs/components/Slider.js +15 -243
  69. package/dist/commonjs/components/SourcePageCard.js +30 -89
  70. package/dist/commonjs/components/Toast.js +5 -147
  71. package/dist/commonjs/components/TouchableScale.js +3 -24
  72. package/dist/commonjs/components/TreeNode.js +55 -130
  73. package/dist/commonjs/console.js +1 -16
  74. package/dist/commonjs/constants/index.js +1 -32
  75. package/dist/commonjs/constants/telemetryConfig.js +1 -6
  76. package/dist/commonjs/constants/version.d.ts +1 -1
  77. package/dist/commonjs/constants/version.js +1 -4
  78. package/dist/commonjs/crash.js +1 -23
  79. package/dist/commonjs/customHooks/analyticsLogger.js +1 -250
  80. package/dist/commonjs/customHooks/bundleAnalyzer.js +1 -957
  81. package/dist/commonjs/customHooks/consoleLogger.js +6 -445
  82. package/dist/commonjs/customHooks/crashHandler.js +7 -656
  83. package/dist/commonjs/customHooks/logFilters.js +1 -23
  84. package/dist/commonjs/customHooks/networkLogger.js +2 -536
  85. package/dist/commonjs/customHooks/performanceTracker.js +63 -750
  86. package/dist/commonjs/customHooks/reduxLogger.js +2 -313
  87. package/dist/commonjs/customHooks/storageInspector.js +1 -435
  88. package/dist/commonjs/customHooks/useAccordion.js +1 -18
  89. package/dist/commonjs/decorators/index.js +1 -100
  90. package/dist/commonjs/helpers/gaAnalyticsRegistry.js +1 -148
  91. package/dist/commonjs/helpers/index.d.ts +1 -0
  92. package/dist/commonjs/helpers/index.js +8 -921
  93. package/dist/commonjs/helpers/memoryManager.js +1 -99
  94. package/dist/commonjs/helpers/qrGenerator.js +1 -367
  95. package/dist/commonjs/helpers/remoteConfig.js +1 -165
  96. package/dist/commonjs/helpers/searchQueryParser.js +1 -62
  97. package/dist/commonjs/helpers/settingsStore.js +1 -144
  98. package/dist/commonjs/helpers/telemetry.js +1 -501
  99. package/dist/commonjs/helpers/toast.js +1 -20
  100. package/dist/commonjs/i18n/index.js +1 -90
  101. package/dist/commonjs/i18n/locales/en.json +1 -1140
  102. package/dist/commonjs/index.js +5 -2168
  103. package/dist/commonjs/metro.js +6 -468
  104. package/dist/commonjs/native/NativeInspector.d.ts +1 -0
  105. package/dist/commonjs/native/NativeInspector.js +1 -415
  106. package/dist/commonjs/native/NativeNetworkInspector.js +1 -4
  107. package/dist/commonjs/network.js +1 -13
  108. package/dist/commonjs/performance.js +1 -29
  109. package/dist/commonjs/redux.js +1 -20
  110. package/dist/commonjs/storage.js +1 -14
  111. package/dist/commonjs/styles/AppColors.js +1 -423
  112. package/dist/commonjs/styles/AppFonts.js +1 -17
  113. package/dist/commonjs/styles/common.js +1 -190
  114. package/dist/commonjs/styles/index.d.ts +6 -0
  115. package/dist/commonjs/styles/index.js +1 -1589
  116. package/dist/commonjs/types/enums.d.ts +0 -1
  117. package/dist/commonjs/types/enums.js +1 -152
  118. package/dist/commonjs/types/index.js +1 -18
  119. package/dist/commonjs/types/interfaces.d.ts +2 -2
  120. package/dist/commonjs/types/interfaces.js +1 -2
  121. package/dist/esm/analytics.js +1 -2
  122. package/dist/esm/bundle.js +1 -2
  123. package/dist/esm/capture.js +1 -32
  124. package/dist/esm/components/AnalyticsDetail.js +171 -664
  125. package/dist/esm/components/AnalyticsEventCard.js +77 -335
  126. package/dist/esm/components/AnalyticsGraph.js +95 -357
  127. package/dist/esm/components/AnimatedEntrance.js +1 -6
  128. package/dist/esm/components/AppHeaderLogo.js +7 -94
  129. package/dist/esm/components/BrandCircleIcon.js +114 -119
  130. package/dist/esm/components/BrandSquareIcon.js +73 -78
  131. package/dist/esm/components/CodeSnippet.js +58 -595
  132. package/dist/esm/components/ConsoleLogCard.js +91 -526
  133. package/dist/esm/components/CopyButton.js +3 -51
  134. package/dist/esm/components/DiffViewer.js +22 -48
  135. package/dist/esm/components/DomainHeader.js +43 -138
  136. package/dist/esm/components/EmptyState.js +17 -56
  137. package/dist/esm/components/EndOfListFooter.js +15 -83
  138. package/dist/esm/components/ErrorBoundary.js +125 -582
  139. package/dist/esm/components/HeadersSection.js +52 -93
  140. package/dist/esm/components/HighlightText.js +17 -53
  141. package/dist/esm/components/Inspector/AboutModal.d.ts +6 -0
  142. package/dist/esm/components/Inspector/AboutModal.js +243 -0
  143. package/dist/esm/components/Inspector/AnalyticsFilterModal.js +225 -886
  144. package/dist/esm/components/Inspector/AnalyticsTab.js +296 -904
  145. package/dist/esm/components/Inspector/BundleTab.js +1175 -3502
  146. package/dist/esm/components/Inspector/ConsoleTab.js +113 -488
  147. package/dist/esm/components/Inspector/CrashDetail.js +236 -747
  148. package/dist/esm/components/Inspector/CrashFilterModal.js +149 -541
  149. package/dist/esm/components/Inspector/CrashTab.js +177 -711
  150. package/dist/esm/components/Inspector/DebuggingTab.js +164 -925
  151. package/dist/esm/components/Inspector/DeviceInfoTab.js +199 -924
  152. package/dist/esm/components/Inspector/FabLauncher.js +68 -454
  153. package/dist/esm/components/Inspector/FeatureUnderDevNotice.js +14 -70
  154. package/dist/esm/components/Inspector/InspectorContext.js +1 -12
  155. package/dist/esm/components/Inspector/InspectorHeader.js +282 -1163
  156. package/dist/esm/components/Inspector/LogDetail.js +235 -1023
  157. package/dist/esm/components/Inspector/MainScreen.js +78 -323
  158. package/dist/esm/components/Inspector/MediaGalleryTab.js +143 -650
  159. package/dist/esm/components/Inspector/MediaPreviewModal.js +138 -613
  160. package/dist/esm/components/Inspector/NavigationTracker.js +1 -10
  161. package/dist/esm/components/Inspector/NetworkDetail.js +138 -455
  162. package/dist/esm/components/Inspector/NetworkFilterModal.js +122 -597
  163. package/dist/esm/components/Inspector/NetworkTab.js +125 -517
  164. package/dist/esm/components/Inspector/NpmStarPrompt.js +58 -434
  165. package/dist/esm/components/Inspector/NpmUpdateToast.js +45 -281
  166. package/dist/esm/components/Inspector/PerformanceTab.js +393 -1570
  167. package/dist/esm/components/Inspector/ReduxDetail.js +307 -1170
  168. package/dist/esm/components/Inspector/ReduxTab.js +144 -722
  169. package/dist/esm/components/Inspector/SettingsPanel.js +643 -3985
  170. package/dist/esm/components/Inspector/SkeletonPlaceholder.js +30 -163
  171. package/dist/esm/components/Inspector/StorageTab.js +172 -866
  172. package/dist/esm/components/Inspector/TabBar.js +45 -305
  173. package/dist/esm/components/Inspector/UpdateAvailableModal.js +80 -418
  174. package/dist/esm/components/JsonViewer.js +179 -354
  175. package/dist/esm/components/LogCard.js +93 -565
  176. package/dist/esm/components/LogSyntaxHighlighter.js +11 -123
  177. package/dist/esm/components/MetaAccordion.js +136 -267
  178. package/dist/esm/components/MiniBarChart.js +3 -18
  179. package/dist/esm/components/MiniLineChart.js +3 -20
  180. package/dist/esm/components/NetworkIcons.d.ts +13 -0
  181. package/dist/esm/components/NetworkIcons.js +523 -838
  182. package/dist/esm/components/QRCodeView.js +8 -45
  183. package/dist/esm/components/SectionHeader.js +22 -39
  184. package/dist/esm/components/SegmentedTabs.js +8 -58
  185. package/dist/esm/components/SkeletonPlaceholder.js +30 -163
  186. package/dist/esm/components/Slider.js +24 -213
  187. package/dist/esm/components/SourcePageCard.js +65 -86
  188. package/dist/esm/components/Toast.js +10 -117
  189. package/dist/esm/components/TouchableScale.js +3 -19
  190. package/dist/esm/components/TreeNode.js +58 -95
  191. package/dist/esm/console.js +1 -2
  192. package/dist/esm/constants/index.js +1 -28
  193. package/dist/esm/constants/telemetryConfig.js +1 -3
  194. package/dist/esm/constants/version.d.ts +1 -1
  195. package/dist/esm/constants/version.js +1 -1
  196. package/dist/esm/crash.js +1 -2
  197. package/dist/esm/customHooks/analyticsLogger.js +1 -230
  198. package/dist/esm/customHooks/bundleAnalyzer.js +1 -944
  199. package/dist/esm/customHooks/consoleLogger.js +6 -432
  200. package/dist/esm/customHooks/crashHandler.js +7 -630
  201. package/dist/esm/customHooks/logFilters.js +1 -20
  202. package/dist/esm/customHooks/networkLogger.js +2 -519
  203. package/dist/esm/customHooks/performanceTracker.js +63 -723
  204. package/dist/esm/customHooks/reduxLogger.js +2 -293
  205. package/dist/esm/customHooks/storageInspector.js +1 -418
  206. package/dist/esm/customHooks/useAccordion.js +1 -16
  207. package/dist/esm/decorators/index.js +1 -95
  208. package/dist/esm/helpers/gaAnalyticsRegistry.js +1 -143
  209. package/dist/esm/helpers/index.d.ts +1 -0
  210. package/dist/esm/helpers/index.js +8 -861
  211. package/dist/esm/helpers/memoryManager.js +1 -91
  212. package/dist/esm/helpers/qrGenerator.js +1 -364
  213. package/dist/esm/helpers/remoteConfig.js +1 -160
  214. package/dist/esm/helpers/searchQueryParser.js +1 -59
  215. package/dist/esm/helpers/settingsStore.js +1 -134
  216. package/dist/esm/helpers/telemetry.js +1 -489
  217. package/dist/esm/helpers/toast.js +1 -15
  218. package/dist/esm/i18n/index.js +1 -78
  219. package/dist/esm/i18n/locales/en.json +1 -1140
  220. package/dist/esm/index.js +7 -1982
  221. package/dist/esm/metro.js +6 -459
  222. package/dist/esm/native/NativeInspector.d.ts +1 -0
  223. package/dist/esm/native/NativeInspector.js +1 -382
  224. package/dist/esm/native/NativeNetworkInspector.js +1 -2
  225. package/dist/esm/network.js +1 -1
  226. package/dist/esm/performance.js +1 -2
  227. package/dist/esm/redux.js +1 -1
  228. package/dist/esm/storage.js +1 -1
  229. package/dist/esm/styles/AppColors.js +1 -417
  230. package/dist/esm/styles/AppFonts.js +1 -13
  231. package/dist/esm/styles/common.js +1 -186
  232. package/dist/esm/styles/index.d.ts +6 -0
  233. package/dist/esm/styles/index.js +1 -1551
  234. package/dist/esm/types/enums.d.ts +0 -1
  235. package/dist/esm/types/enums.js +1 -149
  236. package/dist/esm/types/index.js +1 -2
  237. package/dist/esm/types/interfaces.d.ts +2 -2
  238. package/dist/esm/types/interfaces.js +1 -1
  239. package/ios/NetworkInspectorModule.mm +60 -12
  240. package/package.json +5 -3
  241. package/src/native/NativeInspector.ts +18 -0
  242. package/dist/commonjs/components/Inspector/FeedbackModal.d.ts +0 -7
  243. package/dist/commonjs/components/Inspector/FeedbackModal.js +0 -552
  244. package/dist/esm/components/Inspector/FeedbackModal.d.ts +0 -7
  245. package/dist/esm/components/Inspector/FeedbackModal.js +0 -515
  246. package/src/analytics.ts +0 -35
  247. package/src/bundle.ts +0 -25
  248. package/src/capture.ts +0 -109
  249. package/src/components/AnalyticsDetail.tsx +0 -870
  250. package/src/components/AnalyticsEventCard.tsx +0 -444
  251. package/src/components/AnalyticsGraph.tsx +0 -583
  252. package/src/components/AnimatedEntrance.tsx +0 -20
  253. package/src/components/AppHeaderLogo.tsx +0 -143
  254. package/src/components/BrandCircleIcon.tsx +0 -144
  255. package/src/components/BrandSquareIcon.tsx +0 -184
  256. package/src/components/CodeSnippet.tsx +0 -725
  257. package/src/components/ConsoleLogCard.tsx +0 -679
  258. package/src/components/CopyButton.tsx +0 -87
  259. package/src/components/DiffViewer.tsx +0 -82
  260. package/src/components/DomainHeader.tsx +0 -224
  261. package/src/components/EmptyState.tsx +0 -97
  262. package/src/components/EndOfListFooter.tsx +0 -100
  263. package/src/components/ErrorBoundary.tsx +0 -688
  264. package/src/components/HeadersSection.tsx +0 -172
  265. package/src/components/HighlightText.tsx +0 -100
  266. package/src/components/Inspector/AnalyticsFilterModal.tsx +0 -1250
  267. package/src/components/Inspector/AnalyticsTab.tsx +0 -1362
  268. package/src/components/Inspector/BundleTab.tsx +0 -4768
  269. package/src/components/Inspector/ConsoleTab.tsx +0 -726
  270. package/src/components/Inspector/CrashDetail.tsx +0 -997
  271. package/src/components/Inspector/CrashFilterModal.tsx +0 -721
  272. package/src/components/Inspector/CrashTab.tsx +0 -933
  273. package/src/components/Inspector/DebuggingTab.tsx +0 -1103
  274. package/src/components/Inspector/DeviceInfoTab.tsx +0 -1397
  275. package/src/components/Inspector/FabLauncher.tsx +0 -590
  276. package/src/components/Inspector/FeatureUnderDevNotice.tsx +0 -94
  277. package/src/components/Inspector/FeedbackModal.tsx +0 -626
  278. package/src/components/Inspector/InspectorContext.tsx +0 -28
  279. package/src/components/Inspector/InspectorHeader.tsx +0 -1583
  280. package/src/components/Inspector/LogDetail.tsx +0 -1431
  281. package/src/components/Inspector/MainScreen.tsx +0 -460
  282. package/src/components/Inspector/MediaGalleryTab.tsx +0 -829
  283. package/src/components/Inspector/MediaPreviewModal.tsx +0 -783
  284. package/src/components/Inspector/NavigationTracker.tsx +0 -13
  285. package/src/components/Inspector/NetworkDetail.tsx +0 -778
  286. package/src/components/Inspector/NetworkFilterModal.tsx +0 -730
  287. package/src/components/Inspector/NetworkTab.tsx +0 -820
  288. package/src/components/Inspector/NpmStarPrompt.tsx +0 -532
  289. package/src/components/Inspector/NpmUpdateToast.tsx +0 -387
  290. package/src/components/Inspector/PerformanceTab.tsx +0 -1967
  291. package/src/components/Inspector/ReduxDetail.tsx +0 -1651
  292. package/src/components/Inspector/ReduxTab.tsx +0 -987
  293. package/src/components/Inspector/SettingsPanel.tsx +0 -5136
  294. package/src/components/Inspector/SkeletonPlaceholder.tsx +0 -206
  295. package/src/components/Inspector/StorageTab.tsx +0 -1159
  296. package/src/components/Inspector/TabBar.tsx +0 -431
  297. package/src/components/Inspector/UpdateAvailableModal.tsx +0 -555
  298. package/src/components/JsonViewer.tsx +0 -549
  299. package/src/components/LogCard.tsx +0 -694
  300. package/src/components/LogSyntaxHighlighter.tsx +0 -178
  301. package/src/components/MetaAccordion.tsx +0 -355
  302. package/src/components/MiniBarChart.tsx +0 -42
  303. package/src/components/MiniLineChart.tsx +0 -33
  304. package/src/components/NetworkIcons.tsx +0 -2655
  305. package/src/components/QRCodeView.tsx +0 -75
  306. package/src/components/SectionHeader.tsx +0 -101
  307. package/src/components/SegmentedTabs.tsx +0 -84
  308. package/src/components/SkeletonPlaceholder.tsx +0 -206
  309. package/src/components/Slider.tsx +0 -300
  310. package/src/components/SourcePageCard.tsx +0 -150
  311. package/src/components/Toast.tsx +0 -131
  312. package/src/components/TouchableScale.tsx +0 -61
  313. package/src/components/TreeNode.tsx +0 -171
  314. package/src/console.ts +0 -24
  315. package/src/constants/index.ts +0 -41
  316. package/src/constants/telemetryConfig.ts +0 -4
  317. package/src/constants/version.ts +0 -3
  318. package/src/crash.ts +0 -32
  319. package/src/customHooks/analyticsLogger.ts +0 -336
  320. package/src/customHooks/bundleAnalyzer.ts +0 -1256
  321. package/src/customHooks/consoleLogger.ts +0 -530
  322. package/src/customHooks/crashHandler.ts +0 -944
  323. package/src/customHooks/logFilters.ts +0 -32
  324. package/src/customHooks/networkLogger.ts +0 -624
  325. package/src/customHooks/performanceTracker.ts +0 -1014
  326. package/src/customHooks/reduxLogger.ts +0 -406
  327. package/src/customHooks/storageInspector.ts +0 -513
  328. package/src/customHooks/useAccordion.tsx +0 -27
  329. package/src/decorators/index.ts +0 -184
  330. package/src/helpers/gaAnalyticsRegistry.ts +0 -204
  331. package/src/helpers/index.ts +0 -1092
  332. package/src/helpers/memoryManager.ts +0 -138
  333. package/src/helpers/qrGenerator.ts +0 -430
  334. package/src/helpers/remoteConfig.ts +0 -212
  335. package/src/helpers/searchQueryParser.ts +0 -84
  336. package/src/helpers/settingsStore.ts +0 -171
  337. package/src/helpers/telemetry.ts +0 -568
  338. package/src/helpers/toast.ts +0 -17
  339. package/src/i18n/index.ts +0 -104
  340. package/src/i18n/locales/en.json +0 -1141
  341. package/src/index.tsx +0 -2650
  342. package/src/metro.ts +0 -598
  343. package/src/network.ts +0 -22
  344. package/src/performance.ts +0 -38
  345. package/src/redux.ts +0 -23
  346. package/src/storage.ts +0 -18
  347. package/src/styles/AppColors.ts +0 -455
  348. package/src/styles/AppFonts.ts +0 -26
  349. package/src/styles/common.ts +0 -209
  350. package/src/styles/index.ts +0 -1606
  351. package/src/types/enums.ts +0 -210
  352. package/src/types/index.ts +0 -34
  353. package/src/types/interfaces.ts +0 -535
@@ -1,944 +1 @@
1
- import { AppColors } from '../styles/AppColors';
2
- import { t } from '../i18n';
3
- import { NativeModules, Platform, TurboModuleRegistry } from 'react-native';
4
- let cachedAnalysis = null;
5
- let isAnalyzing = false;
6
- const subscribers = [];
7
- let isBundleModuleEnabled = false;
8
- export const setBundleModuleEnabled = (enabled) => {
9
- isBundleModuleEnabled = enabled;
10
- };
11
- export const getBundleModuleEnabled = () => isBundleModuleEnabled;
12
- const getSourceCodeModule = () => {
13
- try {
14
- const legacy = NativeModules?.SourceCode;
15
- const scriptURL = legacy?.scriptURL || legacy?.getConstants?.()?.scriptURL;
16
- if (typeof scriptURL === 'string' && scriptURL.length > 0) {
17
- return { scriptURL };
18
- }
19
- }
20
- catch { }
21
- try {
22
- const turbo = TurboModuleRegistry?.get?.('SourceCode');
23
- const constants = turbo?.getConstants?.();
24
- const scriptURL = turbo?.scriptURL || constants?.scriptURL;
25
- if (typeof scriptURL === 'string' && scriptURL.length > 0) {
26
- return { scriptURL };
27
- }
28
- }
29
- catch { }
30
- return null;
31
- };
32
- export const getHostScriptURL = () => {
33
- try {
34
- const scriptURL = getSourceCodeModule()?.scriptURL;
35
- if (typeof scriptURL === 'string' && scriptURL.length > 0) {
36
- return scriptURL;
37
- }
38
- }
39
- catch { }
40
- try {
41
- const serverHost = NativeModules?.PlatformConstants?.serverHost ||
42
- NativeModules?.AndroidConstants?.serverHost ||
43
- NativeModules?.DevSettings?.serverHost ||
44
- NativeModules?.DevSettings?.getConstants?.()?.serverHost;
45
- if (typeof serverHost === 'string' && serverHost.length > 0) {
46
- const formattedHost = serverHost.startsWith('http') ? serverHost : `http://${serverHost}`;
47
- return `${formattedHost}/index.bundle?platform=${Platform.OS}&dev=true`;
48
- }
49
- }
50
- catch { }
51
- try {
52
- const globalHost = globalThis?.__DEV_SERVER_URL__ ||
53
- globalThis?.__METRO_SERVER_HOST__ ||
54
- globalThis?.__DEV_SERVER_PORT__ ||
55
- globalThis?.__METRO_PORT__;
56
- if (typeof globalHost === 'number') {
57
- const host = Platform.OS === 'android' ? '10.0.2.2' : 'localhost';
58
- return `http://${host}:${globalHost}/index.bundle?platform=${Platform.OS}&dev=true`;
59
- }
60
- if (typeof globalHost === 'string' && globalHost.length > 0) {
61
- if (/^\d+$/.test(globalHost)) {
62
- const host = Platform.OS === 'android' ? '10.0.2.2' : 'localhost';
63
- return `http://${host}:${globalHost}/index.bundle?platform=${Platform.OS}&dev=true`;
64
- }
65
- return globalHost.startsWith('http')
66
- ? globalHost
67
- : `http://${globalHost}/index.bundle?platform=${Platform.OS}&dev=true`;
68
- }
69
- }
70
- catch { }
71
- return '';
72
- };
73
- const DYNAMIC_DEV_PORTS = [8081, 8082, 8083, 8084, 8085, 8086, 8087, 8088, 8089, 8090, 19000, 19001, 3000];
74
- const extractHostAndPort = (scriptURL) => {
75
- if (!scriptURL || typeof scriptURL !== 'string') {
76
- return { host: null, port: null };
77
- }
78
- const match = scriptURL.match(/^https?:\/\/([^:/]+)(?::(\d+))?/);
79
- if (match) {
80
- return {
81
- host: match[1] || null,
82
- port: match[2] ? parseInt(match[2], 10) : null,
83
- };
84
- }
85
- return { host: null, port: null };
86
- };
87
- const probeCandidateUrlsInParallel = async (scriptURL, timeoutMs = 3000) => {
88
- const { host: extractedHost, port: extractedPort } = extractHostAndPort(scriptURL);
89
- if (scriptURL && scriptURL.startsWith('http')) {
90
- try {
91
- const controller = new AbortController();
92
- const timer = setTimeout(() => controller.abort(), timeoutMs);
93
- const res = await fetch(scriptURL, { signal: controller.signal });
94
- clearTimeout(timer);
95
- if (res.ok) {
96
- const contentLength = res.headers.get('content-length');
97
- const text = await res.text();
98
- if (text && text.length > 0) {
99
- const bytes = contentLength ? parseInt(contentLength, 10) || text.length : text.length;
100
- return { text, bytes, url: scriptURL };
101
- }
102
- }
103
- }
104
- catch {
105
- }
106
- }
107
- const candidateHosts = extractedHost
108
- ? [extractedHost, 'localhost', '127.0.0.1', ...(Platform.OS === 'android' ? ['10.0.2.2', '10.0.3.2'] : [])]
109
- : ['localhost', '127.0.0.1', ...(Platform.OS === 'android' ? ['10.0.2.2', '10.0.3.2'] : [])];
110
- const uniqueHosts = Array.from(new Set(candidateHosts));
111
- const candidatePorts = extractedPort
112
- ? Array.from(new Set([extractedPort, ...DYNAMIC_DEV_PORTS]))
113
- : DYNAMIC_DEV_PORTS;
114
- const probeTasks = [];
115
- for (const host of uniqueHosts) {
116
- for (const port of candidatePorts) {
117
- probeTasks.push(new Promise(async (resolve, reject) => {
118
- const controller = new AbortController();
119
- const timer = setTimeout(() => controller.abort(), 700);
120
- try {
121
- const res = await fetch(`http://${host}:${port}/status`, { signal: controller.signal });
122
- clearTimeout(timer);
123
- if (res.ok) {
124
- const statusText = await res.text();
125
- if (statusText && statusText.includes('packager-status:running')) {
126
- resolve({ host, port });
127
- return;
128
- }
129
- }
130
- }
131
- catch {
132
- clearTimeout(timer);
133
- }
134
- reject(new Error('unreachable'));
135
- }));
136
- }
137
- }
138
- let activeServer = null;
139
- try {
140
- activeServer = await new Promise((resolve, reject) => {
141
- let pending = probeTasks.length;
142
- if (pending === 0) {
143
- reject(new Error('No candidate hosts'));
144
- return;
145
- }
146
- probeTasks.forEach(p => {
147
- p.then(resolve).catch(() => {
148
- pending--;
149
- if (pending === 0) {
150
- reject(new Error('All probes failed'));
151
- }
152
- });
153
- });
154
- });
155
- }
156
- catch {
157
- activeServer = null;
158
- }
159
- if (activeServer) {
160
- const dynamicBundleUrl = `http://${activeServer.host}:${activeServer.port}/index.bundle?platform=${Platform.OS}&dev=true`;
161
- try {
162
- const controller = new AbortController();
163
- const timer = setTimeout(() => controller.abort(), timeoutMs);
164
- const res = await fetch(dynamicBundleUrl, { signal: controller.signal });
165
- clearTimeout(timer);
166
- if (res.ok) {
167
- const contentLength = res.headers.get('content-length');
168
- const text = await res.text();
169
- if (text && text.length > 0) {
170
- const bytes = contentLength ? parseInt(contentLength, 10) || text.length : text.length;
171
- return { text, bytes, url: dynamicBundleUrl };
172
- }
173
- }
174
- }
175
- catch {
176
- }
177
- }
178
- return null;
179
- };
180
- const executedModuleIds = new Set();
181
- const runtimeModules = new Map();
182
- export const trackRuntimeModuleExecution = () => {
183
- try {
184
- const g = globalThis;
185
- const r = g.__r;
186
- if (typeof r === 'function' && !r.__inspectorTracked) {
187
- const tracked = function (moduleId, ...rest) {
188
- executedModuleIds.add(Number(moduleId));
189
- return r.call(this, moduleId, ...rest);
190
- };
191
- Object.defineProperty(tracked, '__inspectorTracked', { value: true, enumerable: false });
192
- g.__r = tracked;
193
- }
194
- }
195
- catch { }
196
- };
197
- export const trackRuntimeDefine = () => {
198
- try {
199
- const g = globalThis;
200
- const originalD = g.__d;
201
- if (typeof originalD === 'function' && !originalD.__inspectorTracked) {
202
- const trackedD = function (factory, moduleId, dependencyMap, verboseName, ...rest) {
203
- if (typeof verboseName === 'string' && verboseName.length > 0) {
204
- runtimeModules.set(Number(moduleId), { id: Number(moduleId), path: verboseName });
205
- }
206
- return originalD.call(this, factory, moduleId, dependencyMap, verboseName, ...rest);
207
- };
208
- Object.defineProperty(trackedD, '__inspectorTracked', { value: true, enumerable: false });
209
- g.__d = trackedD;
210
- }
211
- }
212
- catch { }
213
- };
214
- trackRuntimeModuleExecution();
215
- trackRuntimeDefine();
216
- const DEFAULT_BASELINE_MODULES = [
217
- { id: 1, deps: [2, 3, 4], path: 'index.js' },
218
- { id: 2, deps: [4, 5, 13, 14, 15, 16], path: 'App.tsx' },
219
- { id: 3, deps: [], path: 'node_modules/react-native/index.js' },
220
- { id: 4, deps: [], path: 'node_modules/react/index.js' },
221
- { id: 5, deps: [6, 7], path: 'node_modules/@react-navigation/native/src/index.ts' },
222
- { id: 6, deps: [], path: 'node_modules/react-native-screens/src/index.ts' },
223
- { id: 7, deps: [], path: 'node_modules/react-native-safe-area-context/src/index.ts' },
224
- { id: 8, deps: [], path: 'node_modules/react-native-svg/src/index.ts' },
225
- { id: 9, deps: [], path: 'node_modules/axios/index.js' },
226
- { id: 10, deps: [], path: 'node_modules/i18next/dist/esm/i18next.js' },
227
- { id: 11, deps: [12], path: 'node_modules/react-redux/src/index.ts' },
228
- { id: 12, deps: [], path: 'node_modules/@reduxjs/toolkit/dist/redux-toolkit.esm.js' },
229
- { id: 13, deps: [], path: 'src/components/Inspector/BundleTab.tsx' },
230
- { id: 14, deps: [], path: 'src/navigation/RootNavigator.tsx' },
231
- { id: 15, deps: [], path: 'src/screens/HomeScreen.tsx' },
232
- { id: 16, deps: [], path: 'src/store/index.ts' },
233
- { id: 17, deps: [], path: 'assets/images/logo.png' },
234
- { id: 18, deps: [], path: 'package.json' },
235
- ];
236
- const extractBundleModules = (bundleText) => {
237
- const modules = [];
238
- const seenIds = new Set();
239
- if (bundleText && bundleText.length > 0) {
240
- const sourceUrlRegex = /\/\/[#@]\s*sourceURL=(?:https?:\/\/[^\s\r\n/]+\/|file:\/\/)?([^\s\r\n?#]+)/g;
241
- let srcMatch;
242
- let autoId = 900000;
243
- while ((srcMatch = sourceUrlRegex.exec(bundleText)) !== null) {
244
- const path = srcMatch[1];
245
- if (path && path.length > 0 && !path.endsWith('.bundle')) {
246
- const id = autoId++;
247
- if (!seenIds.has(id)) {
248
- seenIds.add(id);
249
- modules.push({ id, deps: [], path });
250
- }
251
- }
252
- }
253
- const linearDefineRegex = /,\s*(\d+)\s*,\s*(?:\[[^\]\r\n]{0,500}\]|\{[^}\r\n]{0,500}\})\s*,\s*["']([^"'\r\n]+)["']\s*\)/g;
254
- let defMatch;
255
- while ((defMatch = linearDefineRegex.exec(bundleText)) !== null) {
256
- const id = parseInt(defMatch[1], 10);
257
- const path = defMatch[2] || '';
258
- if (!seenIds.has(id) && path.length > 0) {
259
- seenIds.add(id);
260
- modules.push({ id, deps: [], path });
261
- }
262
- }
263
- }
264
- runtimeModules.forEach((item, id) => {
265
- if (!seenIds.has(id)) {
266
- seenIds.add(id);
267
- modules.push({ id, deps: [], path: item.path });
268
- }
269
- });
270
- if (modules.length === 0) {
271
- return DEFAULT_BASELINE_MODULES;
272
- }
273
- return modules;
274
- };
275
- const getStaticStartupModuleIds = (bundleText) => {
276
- const ids = new Set();
277
- if (!bundleText)
278
- return ids;
279
- const startupRe = /__r\s*\(\s*(\d+)\s*\)/g;
280
- let m;
281
- while ((m = startupRe.exec(bundleText)) !== null) {
282
- ids.add(parseInt(m[1], 10));
283
- }
284
- return ids;
285
- };
286
- const detectProjectRoot = (allRawPaths) => {
287
- const normPaths = allRawPaths.map(p => p.replace(/\\/g, '/'));
288
- for (const norm of normPaths) {
289
- const nmIdx = norm.indexOf('/node_modules/');
290
- if (nmIdx !== -1) {
291
- return norm.slice(0, nmIdx + 1);
292
- }
293
- }
294
- for (const norm of normPaths) {
295
- const match = norm.match(/^(.*\/)(?:index\.[jt]sx?|app\.[jt]sx?|package\.json)(?:[?#].*)?$/i);
296
- if (match && match[1]) {
297
- return match[1];
298
- }
299
- }
300
- const absPaths = normPaths.filter(p => p.startsWith('/') && !p.includes('/node_modules/'));
301
- if (absPaths.length === 0)
302
- return '';
303
- if (absPaths.length === 1) {
304
- const lastSlash = absPaths[0].lastIndexOf('/');
305
- return lastSlash > 0 ? absPaths[0].slice(0, lastSlash + 1) : '';
306
- }
307
- const splitPaths = absPaths.map(p => p.split('/'));
308
- let commonLen = 0;
309
- const first = splitPaths[0];
310
- const minLen = Math.min(...splitPaths.map(sp => sp.length));
311
- while (commonLen < minLen - 1) {
312
- const seg = first[commonLen];
313
- if (splitPaths.every(sp => sp[commonLen] === seg)) {
314
- commonLen++;
315
- }
316
- else {
317
- break;
318
- }
319
- }
320
- return commonLen > 0 ? first.slice(0, commonLen).join('/') + '/' : '';
321
- };
322
- const normalizeProjectRelativePath = (rawPath, projectRoot) => {
323
- let clean = rawPath.replace(/\\/g, '/');
324
- const qIdx = clean.search(/[?#]/);
325
- if (qIdx !== -1) {
326
- clean = clean.slice(0, qIdx);
327
- }
328
- clean = clean.replace(/^(?:https?:\/\/[^/]+\/|file:\/\/)/, '');
329
- if (projectRoot && clean.startsWith(projectRoot)) {
330
- clean = clean.slice(projectRoot.length);
331
- }
332
- clean = clean.replace(/^(\.\.\/)+/, '').replace(/^\.\//, '').replace(/^\/+/, '');
333
- if (!clean)
334
- clean = rawPath.split('/').pop() || rawPath;
335
- return clean;
336
- };
337
- const isExternalPackage = (rawPath) => {
338
- if (rawPath.includes('node_modules/')) {
339
- const pkgMatch = rawPath.match(/node_modules\/(?:@([^/]+)\/([^/]+)|([^/]+))/);
340
- if (pkgMatch) {
341
- const pkgName = pkgMatch[1] && pkgMatch[2] ? `@${pkgMatch[1]}/${pkgMatch[2]}` : pkgMatch[3];
342
- return { isPkg: true, pkgName };
343
- }
344
- return { isPkg: true };
345
- }
346
- if (rawPath.includes('react-native-inapp-inspector')) {
347
- return { isPkg: true, pkgName: 'react-native-inapp-inspector' };
348
- }
349
- if (rawPath.includes('.yarn/') || rawPath.includes('.pnpm/')) {
350
- return { isPkg: true };
351
- }
352
- if (rawPath.includes('/dist/esm/') ||
353
- rawPath.includes('/dist/commonjs/') ||
354
- rawPath.includes('/dist/cjs/') ||
355
- rawPath.startsWith('dist/esm/') ||
356
- rawPath.startsWith('dist/commonjs/') ||
357
- rawPath.startsWith('dist/') ||
358
- rawPath.includes('/react-native-inapp-inspector/dist/')) {
359
- return { isPkg: true, pkgName: 'react-native-inapp-inspector' };
360
- }
361
- return { isPkg: false };
362
- };
363
- const isInternalModule = (rawPath) => {
364
- return (rawPath.startsWith('<<') ||
365
- rawPath.startsWith('[metro]') ||
366
- rawPath.includes('metro-runtime') ||
367
- rawPath.includes('polyfills/require.js') ||
368
- rawPath.includes('prelude_commonjs') ||
369
- rawPath.includes('Libraries/Core/InitializeCore.js') ||
370
- rawPath.includes('@babel/runtime'));
371
- };
372
- export const parseBundleSource = (bundleText, totalBytes, scriptURL, isLive = true) => {
373
- const isHermes = Boolean(globalThis.HermesInternal);
374
- const totalDevMb = Number((totalBytes / (1024 * 1024)).toFixed(2));
375
- const totalDevKb = Math.round(totalBytes / 1024);
376
- const modules = extractBundleModules(bundleText);
377
- const startupIds = getStaticStartupModuleIds(bundleText);
378
- const modMap = new Map();
379
- for (const mod of modules) {
380
- modMap.set(mod.id, mod);
381
- }
382
- const consumedIds = new Set();
383
- const queue = [];
384
- const markConsumed = (id) => {
385
- if (!consumedIds.has(id)) {
386
- consumedIds.add(id);
387
- queue.push(id);
388
- }
389
- };
390
- markConsumed(0);
391
- startupIds.forEach(id => markConsumed(id));
392
- executedModuleIds.forEach(id => markConsumed(id));
393
- for (const mod of modules) {
394
- const lower = mod.path.toLowerCase().replace(/\\/g, '/');
395
- if (lower.endsWith('/index.js') ||
396
- lower.endsWith('/index.ts') ||
397
- lower.endsWith('/index.tsx') ||
398
- lower === 'index.js' ||
399
- lower.endsWith('/app.tsx') ||
400
- lower.endsWith('/app.js') ||
401
- lower.endsWith('/app.jsx') ||
402
- lower === 'app.tsx' ||
403
- lower === 'app.js' ||
404
- lower.endsWith('app.json')) {
405
- markConsumed(mod.id);
406
- }
407
- }
408
- while (queue.length > 0) {
409
- const currId = queue.shift();
410
- const currMod = modMap.get(currId);
411
- if (currMod && currMod.deps) {
412
- for (const depId of currMod.deps) {
413
- markConsumed(depId);
414
- }
415
- }
416
- }
417
- const discoveredPackagesMap = new Map();
418
- const rawProjectItems = [];
419
- for (const mod of modules) {
420
- const rawPath = mod.path.replace(/\\/g, '/');
421
- const { isPkg, pkgName } = isExternalPackage(rawPath);
422
- if (isPkg) {
423
- if (pkgName && !pkgName.startsWith('.')) {
424
- discoveredPackagesMap.set(pkgName, (discoveredPackagesMap.get(pkgName) || 0) + 1);
425
- }
426
- continue;
427
- }
428
- if (isInternalModule(rawPath)) {
429
- continue;
430
- }
431
- rawProjectItems.push({ mod, rawPath });
432
- }
433
- const projectRoot = detectProjectRoot(modules.map(item => item.path));
434
- const discoveredFiles = [];
435
- let fileIdx = 0;
436
- for (const { mod, rawPath } of rawProjectItems) {
437
- const cleanPath = normalizeProjectRelativePath(rawPath, projectRoot);
438
- const isLocalFile = cleanPath.endsWith('.tsx') ||
439
- cleanPath.endsWith('.ts') ||
440
- cleanPath.endsWith('.jsx') ||
441
- cleanPath.endsWith('.js') ||
442
- cleanPath.endsWith('.mjs') ||
443
- cleanPath.endsWith('.cjs') ||
444
- cleanPath.endsWith('.json') ||
445
- cleanPath.endsWith('.png') ||
446
- cleanPath.endsWith('.jpg') ||
447
- cleanPath.endsWith('.jpeg') ||
448
- cleanPath.endsWith('.gif') ||
449
- cleanPath.endsWith('.webp') ||
450
- cleanPath.endsWith('.svg') ||
451
- cleanPath.endsWith('.bmp') ||
452
- cleanPath.endsWith('.ico') ||
453
- cleanPath.endsWith('.ttf') ||
454
- cleanPath.endsWith('.otf') ||
455
- cleanPath.endsWith('.woff') ||
456
- cleanPath.endsWith('.woff2') ||
457
- cleanPath.endsWith('.css') ||
458
- cleanPath.endsWith('.scss') ||
459
- cleanPath.endsWith('.html') ||
460
- cleanPath.endsWith('.md') ||
461
- cleanPath.endsWith('.graphql') ||
462
- cleanPath.endsWith('.gql');
463
- if (!isLocalFile)
464
- continue;
465
- const ext = cleanPath.split('.').pop()?.toUpperCase() || 'JS';
466
- const name = cleanPath.split('/').pop() || cleanPath;
467
- let category = 'javascript';
468
- let color = AppColors.indigo500;
469
- if (ext === 'TSX' || ext === 'TS') {
470
- category = 'typescript';
471
- color = AppColors.sky500;
472
- }
473
- else if (ext === 'PNG' ||
474
- ext === 'JPG' ||
475
- ext === 'JPEG' ||
476
- ext === 'GIF' ||
477
- ext === 'WEBP' ||
478
- ext === 'SVG' ||
479
- ext === 'BMP' ||
480
- ext === 'ICO') {
481
- category = 'image';
482
- color = AppColors.pink500;
483
- }
484
- else if (ext === 'TTF' || ext === 'OTF' || ext === 'WOFF' || ext === 'WOFF2') {
485
- category = 'font';
486
- color = AppColors.purple500;
487
- }
488
- else if (ext === 'JSON' || ext === 'CSS' || ext === 'SCSS' || ext === 'HTML' || ext === 'MD' || ext === 'GRAPHQL' || ext === 'GQL') {
489
- category = 'json';
490
- color = AppColors.emerald500;
491
- }
492
- const approxKb = Math.max(2, Math.round((totalDevKb * 0.15) / Math.max(modules.length, 20)));
493
- const isTestOrFixture = cleanPath.includes('.test.') ||
494
- cleanPath.includes('.spec.') ||
495
- cleanPath.includes('__tests__') ||
496
- cleanPath.includes('__mocks__') ||
497
- cleanPath.includes('.stories.') ||
498
- cleanPath.includes('fixtures/');
499
- const isConsumed = !isTestOrFixture;
500
- discoveredFiles.push({
501
- id: `host-file-${fileIdx++}`,
502
- name,
503
- path: cleanPath,
504
- ext,
505
- category,
506
- sizeKb: approxKb,
507
- meta: `Active Host App Module • ${category.toUpperCase()}`,
508
- color,
509
- status: isConsumed ? 'optimal' : 'warning',
510
- advice: isConsumed
511
- ? 'In-Use: Bundled and active in host application dependency tree'
512
- : 'Not consumed: Test fixture or orphaned file packaged in bundle',
513
- isConsumed,
514
- });
515
- }
516
- const getPackageColor = (name) => {
517
- const colors = [
518
- AppColors.indigo500, AppColors.sky500, AppColors.pink500, AppColors.purple500, AppColors.emerald500,
519
- AppColors.amber500, AppColors.red500, AppColors.teal500, '#3B82F6', AppColors.fuchsia500,
520
- AppColors.orange500, AppColors.lime500, '#06B6D4', '#A855F7', AppColors.errorColor,
521
- ];
522
- let hash = 0;
523
- for (let i = 0; i < name.length; i++) {
524
- hash = name.charCodeAt(i) + ((hash << 5) - hash);
525
- }
526
- return colors[Math.abs(hash) % colors.length];
527
- };
528
- const getPackageCategory = (name) => {
529
- const lower = name.toLowerCase();
530
- if (lower.includes('navigation') || lower.includes('router') || lower.includes('screen')) {
531
- return 'navigation';
532
- }
533
- if (lower.includes('ui') ||
534
- lower.includes('reanimated') ||
535
- lower.includes('gesture') ||
536
- lower.includes('svg') ||
537
- lower.includes('lottie') ||
538
- lower.includes('vector') ||
539
- lower.includes('icon') ||
540
- lower.includes('image') ||
541
- lower.includes('gradient')) {
542
- return 'ui';
543
- }
544
- if (lower.includes('axios') ||
545
- lower.includes('fetch') ||
546
- lower.includes('query') ||
547
- lower.includes('apollo') ||
548
- lower.includes('network') ||
549
- lower.includes('socket') ||
550
- lower.includes('http')) {
551
- return 'network';
552
- }
553
- if (lower === 'react' ||
554
- lower === 'react-native' ||
555
- lower.includes('metro') ||
556
- lower.includes('babel') ||
557
- lower.includes('core')) {
558
- return 'core';
559
- }
560
- return 'utils';
561
- };
562
- const getParentPackageName = (name) => {
563
- if (name.startsWith('@react-navigation/')) {
564
- if (name === '@react-navigation/native')
565
- return null;
566
- return '@react-navigation/native';
567
- }
568
- if (name.startsWith('@react-native/')) {
569
- return 'react-native';
570
- }
571
- if (name === 'react-refresh' ||
572
- name === 'metro-runtime' ||
573
- name === 'whatwg-fetch' ||
574
- name === 'promise' ||
575
- name === 'event-target-shim') {
576
- return 'react-native';
577
- }
578
- if (name === 'scheduler' || name === 'loose-envify' || name === 'object-assign') {
579
- return 'react';
580
- }
581
- if (name === 'use-sync-external-store' ||
582
- name === 'reselect' ||
583
- name === 'redux-thunk' ||
584
- name === 'immer') {
585
- return 'react-redux';
586
- }
587
- if (name === 'follow-redirects' || name === 'form-data' || name === 'proxy-from-env') {
588
- return 'axios';
589
- }
590
- if (name === 'clone-deep' || name === 'html-parse-stringify' || name === '@babel/runtime') {
591
- return 'i18next';
592
- }
593
- if (name === 'css-select' || name === 'css-tree' || name === 'entities') {
594
- return 'react-native-svg';
595
- }
596
- return null;
597
- };
598
- const packageEntries = Array.from(discoveredPackagesMap.entries());
599
- const totalPkgHits = packageEntries.reduce((sum, [, hits]) => sum + hits, 0) || 1;
600
- const packagesList = [];
601
- packageEntries.forEach(([pkgName, hits], idx) => {
602
- const category = getPackageCategory(pkgName);
603
- const color = getPackageColor(pkgName);
604
- const parentPackageName = getParentPackageName(pkgName) || undefined;
605
- const isDirectDefined = !parentPackageName;
606
- const approxPkgKb = Math.max(8, Math.round((totalDevKb * 0.52 * hits) / Math.max(totalPkgHits, 1)));
607
- const percentage = Number(((approxPkgKb / Math.max(totalDevKb, 1)) * 100).toFixed(1));
608
- packagesList.push({
609
- id: `host-pkg-${idx}`,
610
- name: pkgName,
611
- version: '',
612
- latestVersion: '',
613
- sizeKb: approxPkgKb,
614
- percentage,
615
- type: isDirectDefined ? 'direct' : 'transitive',
616
- isDirectDefined,
617
- parentPackageName,
618
- subpackages: [],
619
- category,
620
- color,
621
- description: `${hits} bundled ${hits === 1 ? 'module' : 'modules'}`,
622
- npmUrl: `https://www.npmjs.com/package/${pkgName}`,
623
- isDeprecated: false,
624
- lastActive: `${hits} modules`,
625
- });
626
- });
627
- const directPackagesMap = new Map();
628
- packagesList.forEach(pkg => {
629
- if (pkg.isDirectDefined) {
630
- directPackagesMap.set(pkg.name, pkg);
631
- }
632
- });
633
- packagesList.forEach(pkg => {
634
- if (pkg.parentPackageName && directPackagesMap.has(pkg.parentPackageName)) {
635
- const parent = directPackagesMap.get(pkg.parentPackageName);
636
- if (!parent.subpackages)
637
- parent.subpackages = [];
638
- parent.subpackages.push(pkg);
639
- }
640
- });
641
- packagesList.sort((a, b) => b.sizeKb - a.sizeKb);
642
- let realNodeModulesKb = 0;
643
- for (const pkg of packagesList) {
644
- realNodeModulesKb += pkg.sizeKb || 0;
645
- }
646
- let realAppSourceKb = 0;
647
- let realAssetsMediaKb = 0;
648
- for (const file of discoveredFiles) {
649
- if (file.category === 'image' || file.category === 'font') {
650
- realAssetsMediaKb += file.sizeKb || 0;
651
- }
652
- else {
653
- realAppSourceKb += file.sizeKb || 0;
654
- }
655
- }
656
- const appSourceKb = realAppSourceKb > 0 ? realAppSourceKb : Math.round(totalDevKb * 0.18);
657
- const nodeModulesKb = realNodeModulesKb > 0 ? realNodeModulesKb : Math.round(totalDevKb * 0.58);
658
- const assetsMediaKb = realAssetsMediaKb > 0 ? realAssetsMediaKb : Math.round(totalDevKb * 0.08);
659
- const metroOverheadKb = Math.max(0, totalDevKb - appSourceKb - nodeModulesKb - assetsMediaKb);
660
- const releaseJsMb = Number(((totalDevKb * 0.38) / 1024).toFixed(2));
661
- const nodeModulesMb = Number((nodeModulesKb / 1024).toFixed(2));
662
- const assetsMediaMb = Number((assetsMediaKb / 1024).toFixed(2));
663
- const effectiveNativePkgCount = Math.min(packagesList.length, 55);
664
- const nativeFrameworksMb = Number((48.0 + effectiveNativePkgCount * 0.35 + nodeModulesMb * 0.9).toFixed(1));
665
- const nativeMachoMb = Number((38.0 + effectiveNativePkgCount * 0.22 + nodeModulesMb * 0.6).toFixed(1));
666
- const assetsCatalogMb = Number((30.0 + assetsMediaMb * 2.2).toFixed(1));
667
- const metadataMb = 6.4;
668
- const iosInstallMb = Number((releaseJsMb + nativeFrameworksMb + nativeMachoMb + assetsCatalogMb + metadataMb).toFixed(1));
669
- const iosDownloadMb = Number((iosInstallMb * 0.655).toFixed(1));
670
- const androidCppMb = Number((20.0 + effectiveNativePkgCount * 0.12 + nodeModulesMb * 0.4).toFixed(1));
671
- const androidDexMb = Number((14.0 + effectiveNativePkgCount * 0.08 + nodeModulesMb * 0.25).toFixed(1));
672
- const androidResMb = Number((16.0 + assetsMediaMb * 1.5).toFixed(1));
673
- const androidInstallMb = Number((releaseJsMb + androidCppMb + androidDexMb + androidResMb + 3.8).toFixed(1));
674
- const androidDownloadMb = Number((androidInstallMb * 0.54).toFixed(1));
675
- const androidMultiAbiCppMb = Number((195.0 + effectiveNativePkgCount * 0.55 + nodeModulesMb * 1.6).toFixed(1));
676
- const androidApkDexMb = Number((54.0 + effectiveNativePkgCount * 0.2 + nodeModulesMb * 0.6).toFixed(1));
677
- const androidApkResMb = Number((58.0 + assetsMediaMb * 2.8).toFixed(1));
678
- const androidApkMetaMb = 8.5;
679
- const androidApkInstallMb = Number((releaseJsMb + androidMultiAbiCppMb + androidApkDexMb + androidApkResMb + androidApkMetaMb).toFixed(1));
680
- const androidApkDownloadMb = Number(androidApkInstallMb.toFixed(1));
681
- const iosComponents = [
682
- {
683
- id: 'ios-c1',
684
- name: t('bundle.iosComp1Name'),
685
- category: 'frameworks',
686
- sizeMb: nativeFrameworksMb,
687
- pct: Number(((nativeFrameworksMb / iosInstallMb) * 100).toFixed(1)),
688
- color: AppColors.indigo500,
689
- description: t('bundle.iosComp1Desc', { count: packagesList.length }),
690
- advice: t('bundle.iosComp1Advice'),
691
- },
692
- {
693
- id: 'ios-c2',
694
- name: t('bundle.iosComp2Name'),
695
- category: 'native',
696
- sizeMb: nativeMachoMb,
697
- pct: Number(((nativeMachoMb / iosInstallMb) * 100).toFixed(1)),
698
- color: AppColors.sky500,
699
- description: t('bundle.iosComp2Desc'),
700
- advice: t('bundle.iosComp2Advice'),
701
- },
702
- {
703
- id: 'ios-c3',
704
- name: t('bundle.iosComp3Name'),
705
- category: 'assets',
706
- sizeMb: assetsCatalogMb,
707
- pct: Number(((assetsCatalogMb / iosInstallMb) * 100).toFixed(1)),
708
- color: AppColors.pink500,
709
- description: t('bundle.iosComp3Desc'),
710
- advice: t('bundle.iosComp3Advice'),
711
- },
712
- {
713
- id: 'ios-c4',
714
- name: t('bundle.iosComp4Name'),
715
- category: 'js',
716
- sizeMb: releaseJsMb,
717
- pct: Number(((releaseJsMb / iosInstallMb) * 100).toFixed(1)),
718
- color: AppColors.emerald500,
719
- description: t('bundle.iosComp4Desc', { count: discoveredFiles.length }),
720
- advice: t('bundle.iosComp4Advice'),
721
- },
722
- {
723
- id: 'ios-c5',
724
- name: t('bundle.iosComp5Name'),
725
- category: 'meta',
726
- sizeMb: metadataMb,
727
- pct: Number(((metadataMb / iosInstallMb) * 100).toFixed(1)),
728
- color: AppColors.amber500,
729
- description: t('bundle.iosComp5Desc'),
730
- advice: t('bundle.iosComp5Advice'),
731
- },
732
- ];
733
- const androidComponents = [
734
- {
735
- id: 'and-c1',
736
- name: t('bundle.andComp1Name'),
737
- category: 'native',
738
- sizeMb: androidCppMb,
739
- pct: Number(((androidCppMb / androidInstallMb) * 100).toFixed(1)),
740
- color: AppColors.sky500,
741
- description: t('bundle.andComp1Desc', { count: packagesList.length }),
742
- advice: t('bundle.andComp1Advice'),
743
- },
744
- {
745
- id: 'and-c2',
746
- name: t('bundle.andComp2Name'),
747
- category: 'frameworks',
748
- sizeMb: androidDexMb,
749
- pct: Number(((androidDexMb / androidInstallMb) * 100).toFixed(1)),
750
- color: AppColors.indigo500,
751
- description: t('bundle.andComp2Desc'),
752
- advice: t('bundle.andComp2Advice'),
753
- },
754
- {
755
- id: 'and-c3',
756
- name: t('bundle.andComp3Name'),
757
- category: 'assets',
758
- sizeMb: androidResMb,
759
- pct: Number(((androidResMb / androidInstallMb) * 100).toFixed(1)),
760
- color: AppColors.pink500,
761
- description: t('bundle.andComp3Desc'),
762
- advice: t('bundle.andComp3Advice'),
763
- },
764
- {
765
- id: 'and-c4',
766
- name: t('bundle.andComp4Name'),
767
- category: 'js',
768
- sizeMb: releaseJsMb,
769
- pct: Number(((releaseJsMb / androidInstallMb) * 100).toFixed(1)),
770
- color: AppColors.emerald500,
771
- description: t('bundle.andComp4Desc', { count: discoveredFiles.length }),
772
- advice: t('bundle.andComp4Advice'),
773
- },
774
- {
775
- id: 'and-c5',
776
- name: t('bundle.andComp5Name'),
777
- category: 'meta',
778
- sizeMb: 3.8,
779
- pct: Number(((3.8 / androidInstallMb) * 100).toFixed(1)),
780
- color: AppColors.amber500,
781
- description: t('bundle.andComp5Desc'),
782
- advice: t('bundle.andComp5Advice'),
783
- },
784
- ];
785
- const androidApkComponents = [
786
- {
787
- id: 'apk-c1',
788
- name: t('bundle.apkComp1Name'),
789
- category: 'native',
790
- sizeMb: androidMultiAbiCppMb,
791
- pct: Number(((androidMultiAbiCppMb / androidApkInstallMb) * 100).toFixed(1)),
792
- color: AppColors.sky500,
793
- description: t('bundle.apkComp1Desc'),
794
- advice: t('bundle.apkComp1Advice'),
795
- },
796
- {
797
- id: 'apk-c2',
798
- name: t('bundle.apkComp2Name'),
799
- category: 'frameworks',
800
- sizeMb: androidApkDexMb,
801
- pct: Number(((androidApkDexMb / androidApkInstallMb) * 100).toFixed(1)),
802
- color: AppColors.indigo500,
803
- description: t('bundle.apkComp2Desc'),
804
- advice: t('bundle.apkComp2Advice'),
805
- },
806
- {
807
- id: 'apk-c3',
808
- name: t('bundle.apkComp3Name'),
809
- category: 'assets',
810
- sizeMb: androidApkResMb,
811
- pct: Number(((androidApkResMb / androidApkInstallMb) * 100).toFixed(1)),
812
- color: AppColors.pink500,
813
- description: t('bundle.apkComp3Desc'),
814
- advice: t('bundle.apkComp3Advice'),
815
- },
816
- {
817
- id: 'apk-c4',
818
- name: t('bundle.apkComp4Name'),
819
- category: 'js',
820
- sizeMb: releaseJsMb,
821
- pct: Number(((releaseJsMb / androidApkInstallMb) * 100).toFixed(1)),
822
- color: AppColors.emerald500,
823
- description: t('bundle.apkComp4Desc', { count: discoveredFiles.length }),
824
- advice: t('bundle.apkComp4Advice'),
825
- },
826
- {
827
- id: 'apk-c5',
828
- name: t('bundle.apkComp5Name'),
829
- category: 'meta',
830
- sizeMb: androidApkMetaMb,
831
- pct: Number(((androidApkMetaMb / androidApkInstallMb) * 100).toFixed(1)),
832
- color: AppColors.amber500,
833
- description: t('bundle.apkComp5Desc'),
834
- advice: t('bundle.apkComp5Advice'),
835
- },
836
- ];
837
- return {
838
- isLive,
839
- scriptURL,
840
- totalDevBytes: totalBytes,
841
- totalDevMb,
842
- totalDevKb,
843
- isHermes,
844
- moduleCount: modules.length || discoveredFiles.length + packagesList.length,
845
- packageCount: packagesList.length,
846
- filesCount: discoveredFiles.length,
847
- splitUp: {
848
- appSource: {
849
- kb: appSourceKb,
850
- mb: Number((appSourceKb / 1024).toFixed(2)),
851
- pct: 15.0,
852
- },
853
- nodeModules: {
854
- kb: nodeModulesKb,
855
- mb: Number((nodeModulesKb / 1024).toFixed(2)),
856
- pct: 52.0,
857
- },
858
- assetsMedia: {
859
- kb: assetsMediaKb,
860
- mb: Number((assetsMediaKb / 1024).toFixed(2)),
861
- pct: 12.0,
862
- },
863
- metroDevOverhead: {
864
- kb: metroOverheadKb,
865
- mb: Number((metroOverheadKb / 1024).toFixed(2)),
866
- pct: 21.0,
867
- },
868
- },
869
- files: discoveredFiles,
870
- packages: packagesList,
871
- production: {
872
- ios: {
873
- totalInstallMb: iosInstallMb,
874
- totalDownloadMb: iosDownloadMb,
875
- compressionRatioPct: Number((((totalDevMb - releaseJsMb) / Math.max(totalDevMb, 1)) * 100).toFixed(1)),
876
- components: iosComponents,
877
- },
878
- androidAab: {
879
- totalInstallMb: androidInstallMb,
880
- totalDownloadMb: androidDownloadMb,
881
- compressionRatioPct: Number((((totalDevMb - releaseJsMb) / Math.max(totalDevMb, 1)) * 100).toFixed(1)),
882
- components: androidComponents,
883
- },
884
- androidApk: {
885
- totalInstallMb: androidApkInstallMb,
886
- totalDownloadMb: androidApkDownloadMb,
887
- compressionRatioPct: Number((((totalDevMb - releaseJsMb) / Math.max(totalDevMb, 1)) * 0.7).toFixed(1)),
888
- components: androidApkComponents,
889
- },
890
- android: {
891
- totalInstallMb: androidInstallMb,
892
- totalDownloadMb: androidDownloadMb,
893
- compressionRatioPct: Number((((totalDevMb - releaseJsMb) / Math.max(totalDevMb, 1)) * 100).toFixed(1)),
894
- components: androidComponents,
895
- },
896
- },
897
- };
898
- };
899
- export const getInitialBundleAnalysis = () => {
900
- if (cachedAnalysis)
901
- return cachedAnalysis;
902
- const scriptURL = getHostScriptURL();
903
- const fallbackBytes = 6840000;
904
- const result = parseBundleSource('', fallbackBytes, scriptURL || 'unknown', false);
905
- return result;
906
- };
907
- export const analyzeHostAppBundle = async (forceRefresh = false) => {
908
- if (forceRefresh) {
909
- cachedAnalysis = null;
910
- }
911
- if (cachedAnalysis && !forceRefresh)
912
- return cachedAnalysis;
913
- if (isAnalyzing) {
914
- return new Promise(resolve => {
915
- subscribers.push(resolve);
916
- });
917
- }
918
- isAnalyzing = true;
919
- const scriptURL = getHostScriptURL();
920
- try {
921
- const fetched = await probeCandidateUrlsInParallel(scriptURL, 2500);
922
- if (fetched && fetched.text && fetched.text.length > 0) {
923
- const result = parseBundleSource(fetched.text, fetched.bytes, fetched.url);
924
- cachedAnalysis = result;
925
- isAnalyzing = false;
926
- subscribers.forEach(cb => cb(result));
927
- subscribers.length = 0;
928
- return result;
929
- }
930
- }
931
- catch {
932
- }
933
- const fallbackBytes = 6840000;
934
- const result = parseBundleSource('', fallbackBytes, scriptURL || 'unknown', false);
935
- cachedAnalysis = result;
936
- isAnalyzing = false;
937
- subscribers.forEach(cb => cb(result));
938
- subscribers.length = 0;
939
- return result;
940
- };
941
- export const clearCachedBundleAnalysis = () => {
942
- cachedAnalysis = null;
943
- };
944
- export const getCachedBundleAnalysis = () => cachedAnalysis;
1
+ import{AppColors as a}from"../styles/AppColors";import{t as r}from"../i18n";import{NativeModules as I,Platform as F,TurboModuleRegistry as ye}from"react-native";let A=null,z=!1;const T=[];let le=!1;export const setBundleModuleEnabled=e=>{le=e},getBundleModuleEnabled=()=>le;const Ne=()=>{try{const e=I?.SourceCode,n=e?.scriptURL||e?.getConstants?.()?.scriptURL;if(typeof n=="string"&&n.length>0)return{scriptURL:n}}catch{}try{const e=ye?.get?.("SourceCode"),n=e?.getConstants?.(),o=e?.scriptURL||n?.scriptURL;if(typeof o=="string"&&o.length>0)return{scriptURL:o}}catch{}return null};export const getHostScriptURL=()=>{try{const e=Ne()?.scriptURL;if(typeof e=="string"&&e.length>0)return e}catch{}try{const e=I?.PlatformConstants?.serverHost||I?.AndroidConstants?.serverHost||I?.DevSettings?.serverHost||I?.DevSettings?.getConstants?.()?.serverHost;if(typeof e=="string"&&e.length>0)return`${e.startsWith("http")?e:`http://${e}`}/index.bundle?platform=${F.OS}&dev=true`}catch{}try{const e=globalThis?.__DEV_SERVER_URL__||globalThis?.__METRO_SERVER_HOST__||globalThis?.__DEV_SERVER_PORT__||globalThis?.__METRO_PORT__;if(typeof e=="number")return`http://${F.OS==="android"?"10.0.2.2":"localhost"}:${e}/index.bundle?platform=${F.OS}&dev=true`;if(typeof e=="string"&&e.length>0)return/^\d+$/.test(e)?`http://${F.OS==="android"?"10.0.2.2":"localhost"}:${e}/index.bundle?platform=${F.OS}&dev=true`:e.startsWith("http")?e:`http://${e}/index.bundle?platform=${F.OS}&dev=true`}catch{}return""};const ue=[8081,8082,8083,8084,8085,8086,8087,8088,8089,8090,19e3,19001,3e3],_e=e=>{if(!e||typeof e!="string")return{host:null,port:null};const n=e.match(/^https?:\/\/([^:/]+)(?::(\d+))?/);return n?{host:n[1]||null,port:n[2]?parseInt(n[2],10):null}:{host:null,port:null}},Fe=async(e,n=3e3)=>{const{host:o,port:l}=_e(e);if(e&&e.startsWith("http"))try{const b=new AbortController,k=setTimeout(()=>b.abort(),n),g=await fetch(e,{signal:b.signal});if(clearTimeout(k),g.ok){const f=g.headers.get("content-length"),x=await g.text();if(x&&x.length>0){const M=f&&parseInt(f,10)||x.length;return{text:x,bytes:M,url:e}}}}catch{}const d=o?[o,"localhost","127.0.0.1",...F.OS==="android"?["10.0.2.2","10.0.3.2"]:[]]:["localhost","127.0.0.1",...F.OS==="android"?["10.0.2.2","10.0.3.2"]:[]],m=Array.from(new Set(d)),h=l?Array.from(new Set([l,...ue])):ue,c=[];for(const b of m)for(const k of h)c.push(new Promise(async(g,f)=>{const x=new AbortController,M=setTimeout(()=>x.abort(),700);try{const j=await fetch(`http://${b}:${k}/status`,{signal:x.signal});if(clearTimeout(M),j.ok){const C=await j.text();if(C&&C.includes("packager-status:running")){g({host:b,port:k});return}}}catch{clearTimeout(M)}f(new Error("unreachable"))}));let u=null;try{u=await new Promise((b,k)=>{let g=c.length;if(g===0){k(new Error("No candidate hosts"));return}c.forEach(f=>{f.then(b).catch(()=>{g--,g===0&&k(new Error("All probes failed"))})})})}catch{u=null}if(u){const b=`http://${u.host}:${u.port}/index.bundle?platform=${F.OS}&dev=true`;try{const k=new AbortController,g=setTimeout(()=>k.abort(),n),f=await fetch(b,{signal:k.signal});if(clearTimeout(g),f.ok){const x=f.headers.get("content-length"),M=await f.text();if(M&&M.length>0){const j=x&&parseInt(x,10)||M.length;return{text:M,bytes:j,url:b}}}}catch{}}return null},pe=new Set,me=new Map;export const trackRuntimeModuleExecution=()=>{try{const e=globalThis,n=e.__r;if(typeof n=="function"&&!n.__inspectorTracked){const o=function(l,...d){return pe.add(Number(l)),n.call(this,l,...d)};Object.defineProperty(o,"__inspectorTracked",{value:!0,enumerable:!1}),e.__r=o}}catch{}},trackRuntimeDefine=()=>{try{const e=globalThis,n=e.__d;if(typeof n=="function"&&!n.__inspectorTracked){const o=function(l,d,m,h,...c){return typeof h=="string"&&h.length>0&&me.set(Number(d),{id:Number(d),path:h}),n.call(this,l,d,m,h,...c)};Object.defineProperty(o,"__inspectorTracked",{value:!0,enumerable:!1}),e.__d=o}}catch{}};trackRuntimeModuleExecution(),trackRuntimeDefine();const Ae=[{id:1,deps:[2,3,4],path:"index.js"},{id:2,deps:[4,5,13,14,15,16],path:"App.tsx"},{id:3,deps:[],path:"node_modules/react-native/index.js"},{id:4,deps:[],path:"node_modules/react/index.js"},{id:5,deps:[6,7],path:"node_modules/@react-navigation/native/src/index.ts"},{id:6,deps:[],path:"node_modules/react-native-screens/src/index.ts"},{id:7,deps:[],path:"node_modules/react-native-safe-area-context/src/index.ts"},{id:8,deps:[],path:"node_modules/react-native-svg/src/index.ts"},{id:9,deps:[],path:"node_modules/axios/index.js"},{id:10,deps:[],path:"node_modules/i18next/dist/esm/i18next.js"},{id:11,deps:[12],path:"node_modules/react-redux/src/index.ts"},{id:12,deps:[],path:"node_modules/@reduxjs/toolkit/dist/redux-toolkit.esm.js"},{id:13,deps:[],path:"src/components/Inspector/BundleTab.tsx"},{id:14,deps:[],path:"src/navigation/RootNavigator.tsx"},{id:15,deps:[],path:"src/screens/HomeScreen.tsx"},{id:16,deps:[],path:"src/store/index.ts"},{id:17,deps:[],path:"assets/images/logo.png"},{id:18,deps:[],path:"package.json"}],We=e=>{const n=[],o=new Set;if(e&&e.length>0){const l=/\/\/[#@]\s*sourceURL=(?:https?:\/\/[^\s\r\n/]+\/|file:\/\/)?([^\s\r\n?#]+)/g;let d,m=9e5;for(;(d=l.exec(e))!==null;){const u=d[1];if(u&&u.length>0&&!u.endsWith(".bundle")){const b=m++;o.has(b)||(o.add(b),n.push({id:b,deps:[],path:u}))}}const h=/,\s*(\d+)\s*,\s*(?:\[[^\]\r\n]{0,500}\]|\{[^}\r\n]{0,500}\})\s*,\s*["']([^"'\r\n]+)["']\s*\)/g;let c;for(;(c=h.exec(e))!==null;){const u=parseInt(c[1],10),b=c[2]||"";!o.has(u)&&b.length>0&&(o.add(u),n.push({id:u,deps:[],path:b}))}}return me.forEach((l,d)=>{o.has(d)||(o.add(d),n.push({id:d,deps:[],path:l.path}))}),n.length===0?Ae:n},Se=e=>{const n=new Set;if(!e)return n;const o=/__r\s*\(\s*(\d+)\s*\)/g;let l;for(;(l=o.exec(e))!==null;)n.add(parseInt(l[1],10));return n},De=e=>{const n=e.map(c=>c.replace(/\\/g,"/"));for(const c of n){const u=c.indexOf("/node_modules/");if(u!==-1)return c.slice(0,u+1)}for(const c of n){const u=c.match(/^(.*\/)(?:index\.[jt]sx?|app\.[jt]sx?|package\.json)(?:[?#].*)?$/i);if(u&&u[1])return u[1]}const o=n.filter(c=>c.startsWith("/")&&!c.includes("/node_modules/"));if(o.length===0)return"";if(o.length===1){const c=o[0].lastIndexOf("/");return c>0?o[0].slice(0,c+1):""}const l=o.map(c=>c.split("/"));let d=0;const m=l[0],h=Math.min(...l.map(c=>c.length));for(;d<h-1;){const c=m[d];if(l.every(u=>u[d]===c))d++;else break}return d>0?m.slice(0,d).join("/")+"/":""},we=(e,n)=>{let o=e.replace(/\\/g,"/");const l=o.search(/[?#]/);return l!==-1&&(o=o.slice(0,l)),o=o.replace(/^(?:https?:\/\/[^/]+\/|file:\/\/)/,""),n&&o.startsWith(n)&&(o=o.slice(n.length)),o=o.replace(/^(\.\.\/)+/,"").replace(/^\.\//,"").replace(/^\/+/,""),o||(o=e.split("/").pop()||e),o},je=e=>{if(e.includes("node_modules/")){const n=e.match(/node_modules\/(?:@([^/]+)\/([^/]+)|([^/]+))/);return n?{isPkg:!0,pkgName:n[1]&&n[2]?`@${n[1]}/${n[2]}`:n[3]}:{isPkg:!0}}return e.includes("react-native-inapp-inspector")?{isPkg:!0,pkgName:"react-native-inapp-inspector"}:e.includes(".yarn/")||e.includes(".pnpm/")?{isPkg:!0}:e.includes("/dist/esm/")||e.includes("/dist/commonjs/")||e.includes("/dist/cjs/")||e.startsWith("dist/esm/")||e.startsWith("dist/commonjs/")||e.startsWith("dist/")||e.includes("/react-native-inapp-inspector/dist/")?{isPkg:!0,pkgName:"react-native-inapp-inspector"}:{isPkg:!1}},Pe=e=>e.startsWith("<<")||e.startsWith("[metro]")||e.includes("metro-runtime")||e.includes("polyfills/require.js")||e.includes("prelude_commonjs")||e.includes("Libraries/Core/InitializeCore.js")||e.includes("@babel/runtime");export const parseBundleSource=(e,n,o,l=!0)=>{const d=!!globalThis.HermesInternal,m=Number((n/(1024*1024)).toFixed(2)),h=Math.round(n/1024),c=We(e),u=Se(e),b=new Map;for(const t of c)b.set(t.id,t);const k=new Set,g=[],f=t=>{k.has(t)||(k.add(t),g.push(t))};f(0),u.forEach(t=>f(t)),pe.forEach(t=>f(t));for(const t of c){const s=t.path.toLowerCase().replace(/\\/g,"/");(s.endsWith("/index.js")||s.endsWith("/index.ts")||s.endsWith("/index.tsx")||s==="index.js"||s.endsWith("/app.tsx")||s.endsWith("/app.js")||s.endsWith("/app.jsx")||s==="app.tsx"||s==="app.js"||s.endsWith("app.json"))&&f(t.id)}for(;g.length>0;){const t=g.shift(),s=b.get(t);if(s&&s.deps)for(const i of s.deps)f(i)}const x=new Map,M=[];for(const t of c){const s=t.path.replace(/\\/g,"/"),{isPkg:i,pkgName:N}=je(s);if(i){N&&!N.startsWith(".")&&x.set(N,(x.get(N)||0)+1);continue}Pe(s)||M.push({mod:t,rawPath:s})}const j=De(c.map(t=>t.path)),C=[];let he=0;for(const{mod:t,rawPath:s}of M){const i=we(s,j);if(!(i.endsWith(".tsx")||i.endsWith(".ts")||i.endsWith(".jsx")||i.endsWith(".js")||i.endsWith(".mjs")||i.endsWith(".cjs")||i.endsWith(".json")||i.endsWith(".png")||i.endsWith(".jpg")||i.endsWith(".jpeg")||i.endsWith(".gif")||i.endsWith(".webp")||i.endsWith(".svg")||i.endsWith(".bmp")||i.endsWith(".ico")||i.endsWith(".ttf")||i.endsWith(".otf")||i.endsWith(".woff")||i.endsWith(".woff2")||i.endsWith(".css")||i.endsWith(".scss")||i.endsWith(".html")||i.endsWith(".md")||i.endsWith(".graphql")||i.endsWith(".gql")))continue;const p=i.split(".").pop()?.toUpperCase()||"JS",$=i.split("/").pop()||i;let _="javascript",S=a.indigo500;p==="TSX"||p==="TS"?(_="typescript",S=a.sky500):p==="PNG"||p==="JPG"||p==="JPEG"||p==="GIF"||p==="WEBP"||p==="SVG"||p==="BMP"||p==="ICO"?(_="image",S=a.pink500):p==="TTF"||p==="OTF"||p==="WOFF"||p==="WOFF2"?(_="font",S=a.purple500):(p==="JSON"||p==="CSS"||p==="SCSS"||p==="HTML"||p==="MD"||p==="GRAPHQL"||p==="GQL")&&(_="json",S=a.emerald500);const oe=Math.max(2,Math.round(h*.15/Math.max(c.length,20))),ie=!(i.includes(".test.")||i.includes(".spec.")||i.includes("__tests__")||i.includes("__mocks__")||i.includes(".stories.")||i.includes("fixtures/"));C.push({id:`host-file-${he++}`,name:$,path:i,ext:p,category:_,sizeKb:oe,meta:`Active Host App Module \u2022 ${_.toUpperCase()}`,color:S,status:ie?"optimal":"warning",advice:ie?"In-Use: Bundled and active in host application dependency tree":"Not consumed: Test fixture or orphaned file packaged in bundle",isConsumed:ie})}const be=t=>{const s=[a.indigo500,a.sky500,a.pink500,a.purple500,a.emerald500,a.amber500,a.red500,a.teal500,a.blue500,a.fuchsia500,a.orange500,a.lime500,a.cyan500,a.purple900,a.errorColor];let i=0;for(let N=0;N<t.length;N++)i=t.charCodeAt(N)+((i<<5)-i);return s[Math.abs(i)%s.length]},fe=t=>{const s=t.toLowerCase();return s.includes("navigation")||s.includes("router")||s.includes("screen")?"navigation":s.includes("ui")||s.includes("reanimated")||s.includes("gesture")||s.includes("svg")||s.includes("lottie")||s.includes("vector")||s.includes("icon")||s.includes("image")||s.includes("gradient")?"ui":s.includes("axios")||s.includes("fetch")||s.includes("query")||s.includes("apollo")||s.includes("network")||s.includes("socket")||s.includes("http")?"network":s==="react"||s==="react-native"||s.includes("metro")||s.includes("babel")||s.includes("core")?"core":"utils"},ge=t=>t.startsWith("@react-navigation/")?t==="@react-navigation/native"?null:"@react-navigation/native":t.startsWith("@react-native/")||t==="react-refresh"||t==="metro-runtime"||t==="whatwg-fetch"||t==="promise"||t==="event-target-shim"?"react-native":t==="scheduler"||t==="loose-envify"||t==="object-assign"?"react":t==="use-sync-external-store"||t==="reselect"||t==="redux-thunk"||t==="immer"?"react-redux":t==="follow-redirects"||t==="form-data"||t==="proxy-from-env"?"axios":t==="clone-deep"||t==="html-parse-stringify"||t==="@babel/runtime"?"i18next":t==="css-select"||t==="css-tree"||t==="entities"?"react-native-svg":null,re=Array.from(x.entries()),xe=re.reduce((t,[,s])=>t+s,0)||1,y=[];re.forEach(([t,s],i)=>{const N=fe(t),p=be(t),$=ge(t)||void 0,_=!$,S=Math.max(8,Math.round(h*.52*s/Math.max(xe,1))),oe=Number((S/Math.max(h,1)*100).toFixed(1));y.push({id:`host-pkg-${i}`,name:t,version:"",latestVersion:"",sizeKb:S,percentage:oe,type:_?"direct":"transitive",isDirectDefined:_,parentPackageName:$,subpackages:[],category:N,color:p,description:`${s} bundled ${s===1?"module":"modules"}`,npmUrl:`https://www.npmjs.com/package/${t}`,isDeprecated:!1,lastActive:`${s} modules`})});const L=new Map;y.forEach(t=>{t.isDirectDefined&&L.set(t.name,t)}),y.forEach(t=>{if(t.parentPackageName&&L.has(t.parentPackageName)){const s=L.get(t.parentPackageName);s.subpackages||(s.subpackages=[]),s.subpackages.push(t)}}),y.sort((t,s)=>s.sizeKb-t.sizeKb);let H=0;for(const t of y)H+=t.sizeKb||0;let B=0,K=0;for(const t of C)t.category==="image"||t.category==="font"?K+=t.sizeKb||0:B+=t.sizeKb||0;const U=B>0?B:Math.round(h*.18),R=H>0?H:Math.round(h*.58),O=K>0?K:Math.round(h*.08),ce=Math.max(0,h-U-R-O),v=Number((h*.38/1024).toFixed(2)),P=Number((R/1024).toFixed(2)),V=Number((O/1024).toFixed(2)),E=Math.min(y.length,55),q=Number((48+E*.35+P*.9).toFixed(1)),G=Number((38+E*.22+P*.6).toFixed(1)),J=Number((30+V*2.2).toFixed(1)),Q=6.4,D=Number((v+q+G+J+Q).toFixed(1)),ke=Number((D*.655).toFixed(1)),X=Number((20+E*.12+P*.4).toFixed(1)),Y=Number((14+E*.08+P*.25).toFixed(1)),Z=Number((16+V*1.5).toFixed(1)),W=Number((v+X+Y+Z+3.8).toFixed(1)),ae=Number((W*.54).toFixed(1)),ee=Number((195+E*.55+P*1.6).toFixed(1)),te=Number((54+E*.2+P*.6).toFixed(1)),se=Number((58+V*2.8).toFixed(1)),ne=8.5,w=Number((v+ee+te+se+ne).toFixed(1)),Me=Number(w.toFixed(1)),ve=[{id:"ios-c1",name:r("bundle.iosComp1Name"),category:"frameworks",sizeMb:q,pct:Number((q/D*100).toFixed(1)),color:a.indigo500,description:r("bundle.iosComp1Desc",{count:y.length}),advice:r("bundle.iosComp1Advice")},{id:"ios-c2",name:r("bundle.iosComp2Name"),category:"native",sizeMb:G,pct:Number((G/D*100).toFixed(1)),color:a.sky500,description:r("bundle.iosComp2Desc"),advice:r("bundle.iosComp2Advice")},{id:"ios-c3",name:r("bundle.iosComp3Name"),category:"assets",sizeMb:J,pct:Number((J/D*100).toFixed(1)),color:a.pink500,description:r("bundle.iosComp3Desc"),advice:r("bundle.iosComp3Advice")},{id:"ios-c4",name:r("bundle.iosComp4Name"),category:"js",sizeMb:v,pct:Number((v/D*100).toFixed(1)),color:a.emerald500,description:r("bundle.iosComp4Desc",{count:C.length}),advice:r("bundle.iosComp4Advice")},{id:"ios-c5",name:r("bundle.iosComp5Name"),category:"meta",sizeMb:Q,pct:Number((Q/D*100).toFixed(1)),color:a.amber500,description:r("bundle.iosComp5Desc"),advice:r("bundle.iosComp5Advice")}],de=[{id:"and-c1",name:r("bundle.andComp1Name"),category:"native",sizeMb:X,pct:Number((X/W*100).toFixed(1)),color:a.sky500,description:r("bundle.andComp1Desc",{count:y.length}),advice:r("bundle.andComp1Advice")},{id:"and-c2",name:r("bundle.andComp2Name"),category:"frameworks",sizeMb:Y,pct:Number((Y/W*100).toFixed(1)),color:a.indigo500,description:r("bundle.andComp2Desc"),advice:r("bundle.andComp2Advice")},{id:"and-c3",name:r("bundle.andComp3Name"),category:"assets",sizeMb:Z,pct:Number((Z/W*100).toFixed(1)),color:a.pink500,description:r("bundle.andComp3Desc"),advice:r("bundle.andComp3Advice")},{id:"and-c4",name:r("bundle.andComp4Name"),category:"js",sizeMb:v,pct:Number((v/W*100).toFixed(1)),color:a.emerald500,description:r("bundle.andComp4Desc",{count:C.length}),advice:r("bundle.andComp4Advice")},{id:"and-c5",name:r("bundle.andComp5Name"),category:"meta",sizeMb:3.8,pct:Number((3.8/W*100).toFixed(1)),color:a.amber500,description:r("bundle.andComp5Desc"),advice:r("bundle.andComp5Advice")}],Ce=[{id:"apk-c1",name:r("bundle.apkComp1Name"),category:"native",sizeMb:ee,pct:Number((ee/w*100).toFixed(1)),color:a.sky500,description:r("bundle.apkComp1Desc"),advice:r("bundle.apkComp1Advice")},{id:"apk-c2",name:r("bundle.apkComp2Name"),category:"frameworks",sizeMb:te,pct:Number((te/w*100).toFixed(1)),color:a.indigo500,description:r("bundle.apkComp2Desc"),advice:r("bundle.apkComp2Advice")},{id:"apk-c3",name:r("bundle.apkComp3Name"),category:"assets",sizeMb:se,pct:Number((se/w*100).toFixed(1)),color:a.pink500,description:r("bundle.apkComp3Desc"),advice:r("bundle.apkComp3Advice")},{id:"apk-c4",name:r("bundle.apkComp4Name"),category:"js",sizeMb:v,pct:Number((v/w*100).toFixed(1)),color:a.emerald500,description:r("bundle.apkComp4Desc",{count:C.length}),advice:r("bundle.apkComp4Advice")},{id:"apk-c5",name:r("bundle.apkComp5Name"),category:"meta",sizeMb:ne,pct:Number((ne/w*100).toFixed(1)),color:a.amber500,description:r("bundle.apkComp5Desc"),advice:r("bundle.apkComp5Advice")}];return{isLive:l,scriptURL:o,totalDevBytes:n,totalDevMb:m,totalDevKb:h,isHermes:d,moduleCount:c.length||C.length+y.length,packageCount:y.length,filesCount:C.length,splitUp:{appSource:{kb:U,mb:Number((U/1024).toFixed(2)),pct:15},nodeModules:{kb:R,mb:Number((R/1024).toFixed(2)),pct:52},assetsMedia:{kb:O,mb:Number((O/1024).toFixed(2)),pct:12},metroDevOverhead:{kb:ce,mb:Number((ce/1024).toFixed(2)),pct:21}},files:C,packages:y,production:{ios:{totalInstallMb:D,totalDownloadMb:ke,compressionRatioPct:Number(((m-v)/Math.max(m,1)*100).toFixed(1)),components:ve},androidAab:{totalInstallMb:W,totalDownloadMb:ae,compressionRatioPct:Number(((m-v)/Math.max(m,1)*100).toFixed(1)),components:de},androidApk:{totalInstallMb:w,totalDownloadMb:Me,compressionRatioPct:Number(((m-v)/Math.max(m,1)*.7).toFixed(1)),components:Ce},android:{totalInstallMb:W,totalDownloadMb:ae,compressionRatioPct:Number(((m-v)/Math.max(m,1)*100).toFixed(1)),components:de}}}},getInitialBundleAnalysis=()=>{if(A)return A;const e=getHostScriptURL();return parseBundleSource("",684e4,e||"unknown",!1)},analyzeHostAppBundle=async(e=!1)=>{if(e&&(A=null),A&&!e)return A;if(z)return new Promise(d=>{T.push(d)});z=!0;const n=getHostScriptURL();try{const d=await Fe(n,2500);if(d&&d.text&&d.text.length>0){const m=parseBundleSource(d.text,d.bytes,d.url);return A=m,z=!1,T.forEach(h=>h(m)),T.length=0,m}}catch{}const l=parseBundleSource("",684e4,n||"unknown",!1);return A=l,z=!1,T.forEach(d=>d(l)),T.length=0,l},clearCachedBundleAnalysis=()=>{A=null},getCachedBundleAnalysis=()=>A;