react-native-inapp-inspector 2.3.5 → 2.3.6

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 (226) hide show
  1. package/dist/commonjs/analytics.d.ts +0 -4
  2. package/dist/commonjs/analytics.js +0 -4
  3. package/dist/commonjs/bundle.d.ts +0 -4
  4. package/dist/commonjs/bundle.js +0 -4
  5. package/dist/commonjs/components/AnalyticsDetail.js +18 -27
  6. package/dist/commonjs/components/AnalyticsEventCard.js +9 -12
  7. package/dist/commonjs/components/AnalyticsGraph.js +10 -15
  8. package/dist/commonjs/components/AppHeaderLogo.js +0 -3
  9. package/dist/commonjs/components/BrandCircleIcon.js +15 -15
  10. package/dist/commonjs/components/BrandSquareIcon.js +20 -20
  11. package/dist/commonjs/components/CodeSnippet.js +6 -19
  12. package/dist/commonjs/components/ConsoleLogCard.js +0 -1
  13. package/dist/commonjs/components/CopyButton.js +0 -4
  14. package/dist/commonjs/components/DiffViewer.js +0 -2
  15. package/dist/commonjs/components/DomainHeader.js +0 -4
  16. package/dist/commonjs/components/EmptyState.js +0 -3
  17. package/dist/commonjs/components/ErrorBoundary.js +5 -10
  18. package/dist/commonjs/components/HeadersSection.js +0 -5
  19. package/dist/commonjs/components/HighlightText.js +1 -4
  20. package/dist/commonjs/components/Inspector/AnalyticsFilterModal.js +11 -26
  21. package/dist/commonjs/components/Inspector/AnalyticsTab.js +34 -40
  22. package/dist/commonjs/components/Inspector/BundleTab.js +56 -84
  23. package/dist/commonjs/components/Inspector/ConsoleTab.js +7 -7
  24. package/dist/commonjs/components/Inspector/CrashDetail.js +18 -20
  25. package/dist/commonjs/components/Inspector/CrashFilterModal.js +0 -1
  26. package/dist/commonjs/components/Inspector/CrashTab.js +11 -20
  27. package/dist/commonjs/components/Inspector/DeviceInfoTab.js +12 -24
  28. package/dist/commonjs/components/Inspector/FabLauncher.js +1 -1
  29. package/dist/commonjs/components/Inspector/InspectorContext.js +0 -2
  30. package/dist/commonjs/components/Inspector/InspectorHeader.js +7 -8
  31. package/dist/commonjs/components/Inspector/LogDetail.js +27 -29
  32. package/dist/commonjs/components/Inspector/MainScreen.js +9 -10
  33. package/dist/commonjs/components/Inspector/NetworkDetail.js +10 -11
  34. package/dist/commonjs/components/Inspector/NetworkTab.js +14 -14
  35. package/dist/commonjs/components/Inspector/NpmUpdateToast.js +6 -9
  36. package/dist/commonjs/components/Inspector/PerformanceTab.js +30 -43
  37. package/dist/commonjs/components/Inspector/ReduxDetail.js +18 -34
  38. package/dist/commonjs/components/Inspector/ReduxTab.js +11 -20
  39. package/dist/commonjs/components/Inspector/SettingsPanel.js +32 -36
  40. package/dist/commonjs/components/Inspector/SkeletonPlaceholder.js +6 -6
  41. package/dist/commonjs/components/Inspector/StorageTab.js +14 -26
  42. package/dist/commonjs/components/Inspector/UpdateAvailableModal.js +5 -6
  43. package/dist/commonjs/components/JsonViewer.js +3 -10
  44. package/dist/commonjs/components/LogCard.js +7 -7
  45. package/dist/commonjs/components/MetaAccordion.js +1 -7
  46. package/dist/commonjs/components/NetworkIcons.js +12 -16
  47. package/dist/commonjs/components/SectionHeader.js +0 -4
  48. package/dist/commonjs/components/SkeletonPlaceholder.js +6 -6
  49. package/dist/commonjs/components/Slider.js +6 -6
  50. package/dist/commonjs/components/SourcePageCard.js +0 -4
  51. package/dist/commonjs/components/TreeNode.js +0 -4
  52. package/dist/commonjs/console.d.ts +0 -4
  53. package/dist/commonjs/console.js +0 -4
  54. package/dist/commonjs/constants/index.js +6 -9
  55. package/dist/commonjs/constants/telemetryConfig.d.ts +7 -0
  56. package/dist/commonjs/constants/telemetryConfig.js +10 -0
  57. package/dist/commonjs/constants/version.d.ts +1 -1
  58. package/dist/commonjs/constants/version.js +1 -3
  59. package/dist/commonjs/crash.d.ts +0 -4
  60. package/dist/commonjs/crash.js +0 -4
  61. package/dist/commonjs/customHooks/analyticsLogger.d.ts +0 -7
  62. package/dist/commonjs/customHooks/analyticsLogger.js +3 -59
  63. package/dist/commonjs/customHooks/bundleAnalyzer.d.ts +0 -9
  64. package/dist/commonjs/customHooks/bundleAnalyzer.js +3 -86
  65. package/dist/commonjs/customHooks/consoleLogger.js +0 -16
  66. package/dist/commonjs/customHooks/crashHandler.d.ts +0 -28
  67. package/dist/commonjs/customHooks/crashHandler.js +0 -55
  68. package/dist/commonjs/customHooks/logFilters.d.ts +0 -4
  69. package/dist/commonjs/customHooks/logFilters.js +0 -11
  70. package/dist/commonjs/customHooks/networkLogger.js +2 -13
  71. package/dist/commonjs/customHooks/performanceTracker.d.ts +0 -27
  72. package/dist/commonjs/customHooks/performanceTracker.js +0 -31
  73. package/dist/commonjs/customHooks/reduxLogger.d.ts +0 -12
  74. package/dist/commonjs/customHooks/reduxLogger.js +0 -51
  75. package/dist/commonjs/customHooks/storageInspector.d.ts +0 -40
  76. package/dist/commonjs/customHooks/storageInspector.js +1 -56
  77. package/dist/commonjs/decorators/index.d.ts +0 -37
  78. package/dist/commonjs/decorators/index.js +0 -42
  79. package/dist/commonjs/helpers/gaAnalyticsRegistry.d.ts +0 -10
  80. package/dist/commonjs/helpers/gaAnalyticsRegistry.js +0 -26
  81. package/dist/commonjs/helpers/index.d.ts +0 -7
  82. package/dist/commonjs/helpers/index.js +1 -42
  83. package/dist/commonjs/helpers/memoryManager.d.ts +0 -11
  84. package/dist/commonjs/helpers/memoryManager.js +0 -13
  85. package/dist/commonjs/helpers/searchQueryParser.d.ts +0 -4
  86. package/dist/commonjs/helpers/searchQueryParser.js +0 -18
  87. package/dist/commonjs/helpers/settingsStore.js +0 -8
  88. package/dist/commonjs/helpers/telemetry.d.ts +2 -0
  89. package/dist/commonjs/helpers/telemetry.js +302 -0
  90. package/dist/commonjs/i18n/index.d.ts +0 -9
  91. package/dist/commonjs/i18n/index.js +0 -15
  92. package/dist/commonjs/index.js +15 -97
  93. package/dist/commonjs/native/NativeInspector.d.ts +0 -54
  94. package/dist/commonjs/native/NativeInspector.js +0 -56
  95. package/dist/commonjs/network.d.ts +0 -4
  96. package/dist/commonjs/network.js +0 -4
  97. package/dist/commonjs/performance.d.ts +0 -4
  98. package/dist/commonjs/performance.js +0 -4
  99. package/dist/commonjs/redux.d.ts +0 -4
  100. package/dist/commonjs/redux.js +0 -4
  101. package/dist/commonjs/storage.d.ts +0 -4
  102. package/dist/commonjs/storage.js +0 -4
  103. package/dist/commonjs/styles/AppColors.d.ts +0 -3
  104. package/dist/commonjs/styles/AppColors.js +15 -30
  105. package/dist/commonjs/styles/AppFonts.d.ts +0 -4
  106. package/dist/commonjs/styles/AppFonts.js +0 -4
  107. package/dist/commonjs/styles/common.js +0 -11
  108. package/dist/commonjs/styles/index.js +0 -8
  109. package/dist/commonjs/types/enums.js +0 -3
  110. package/dist/commonjs/types/interfaces.d.ts +3 -3
  111. package/dist/esm/analytics.d.ts +0 -4
  112. package/dist/esm/analytics.js +0 -4
  113. package/dist/esm/bundle.d.ts +0 -4
  114. package/dist/esm/bundle.js +0 -4
  115. package/dist/esm/components/AnalyticsDetail.js +18 -27
  116. package/dist/esm/components/AnalyticsEventCard.js +9 -12
  117. package/dist/esm/components/AnalyticsGraph.js +10 -15
  118. package/dist/esm/components/AppHeaderLogo.js +0 -3
  119. package/dist/esm/components/BrandCircleIcon.js +15 -15
  120. package/dist/esm/components/BrandSquareIcon.js +20 -20
  121. package/dist/esm/components/CodeSnippet.js +6 -19
  122. package/dist/esm/components/ConsoleLogCard.js +0 -1
  123. package/dist/esm/components/CopyButton.js +0 -4
  124. package/dist/esm/components/DiffViewer.js +0 -2
  125. package/dist/esm/components/DomainHeader.js +0 -4
  126. package/dist/esm/components/EmptyState.js +0 -3
  127. package/dist/esm/components/ErrorBoundary.js +5 -10
  128. package/dist/esm/components/HeadersSection.js +0 -5
  129. package/dist/esm/components/HighlightText.js +1 -4
  130. package/dist/esm/components/Inspector/AnalyticsFilterModal.js +11 -26
  131. package/dist/esm/components/Inspector/AnalyticsTab.js +34 -40
  132. package/dist/esm/components/Inspector/BundleTab.js +56 -84
  133. package/dist/esm/components/Inspector/ConsoleTab.js +7 -7
  134. package/dist/esm/components/Inspector/CrashDetail.js +18 -20
  135. package/dist/esm/components/Inspector/CrashFilterModal.js +0 -1
  136. package/dist/esm/components/Inspector/CrashTab.js +11 -20
  137. package/dist/esm/components/Inspector/DeviceInfoTab.js +12 -24
  138. package/dist/esm/components/Inspector/FabLauncher.js +1 -1
  139. package/dist/esm/components/Inspector/InspectorContext.js +0 -2
  140. package/dist/esm/components/Inspector/InspectorHeader.js +7 -8
  141. package/dist/esm/components/Inspector/LogDetail.js +27 -29
  142. package/dist/esm/components/Inspector/MainScreen.js +9 -10
  143. package/dist/esm/components/Inspector/NetworkDetail.js +10 -11
  144. package/dist/esm/components/Inspector/NetworkTab.js +14 -14
  145. package/dist/esm/components/Inspector/NpmUpdateToast.js +6 -9
  146. package/dist/esm/components/Inspector/PerformanceTab.js +30 -43
  147. package/dist/esm/components/Inspector/ReduxDetail.js +18 -34
  148. package/dist/esm/components/Inspector/ReduxTab.js +11 -20
  149. package/dist/esm/components/Inspector/SettingsPanel.js +32 -36
  150. package/dist/esm/components/Inspector/SkeletonPlaceholder.js +6 -6
  151. package/dist/esm/components/Inspector/StorageTab.js +14 -26
  152. package/dist/esm/components/Inspector/UpdateAvailableModal.js +5 -6
  153. package/dist/esm/components/JsonViewer.js +3 -10
  154. package/dist/esm/components/LogCard.js +7 -7
  155. package/dist/esm/components/MetaAccordion.js +1 -7
  156. package/dist/esm/components/NetworkIcons.js +12 -16
  157. package/dist/esm/components/SectionHeader.js +0 -4
  158. package/dist/esm/components/SkeletonPlaceholder.js +6 -6
  159. package/dist/esm/components/Slider.js +6 -6
  160. package/dist/esm/components/SourcePageCard.js +0 -4
  161. package/dist/esm/components/TreeNode.js +0 -4
  162. package/dist/esm/console.d.ts +0 -4
  163. package/dist/esm/console.js +0 -4
  164. package/dist/esm/constants/index.js +6 -9
  165. package/dist/esm/constants/telemetryConfig.d.ts +7 -0
  166. package/dist/esm/constants/telemetryConfig.js +7 -0
  167. package/dist/esm/constants/version.d.ts +1 -1
  168. package/dist/esm/constants/version.js +1 -3
  169. package/dist/esm/crash.d.ts +0 -4
  170. package/dist/esm/crash.js +0 -4
  171. package/dist/esm/customHooks/analyticsLogger.d.ts +0 -7
  172. package/dist/esm/customHooks/analyticsLogger.js +3 -59
  173. package/dist/esm/customHooks/bundleAnalyzer.d.ts +0 -9
  174. package/dist/esm/customHooks/bundleAnalyzer.js +3 -86
  175. package/dist/esm/customHooks/consoleLogger.js +0 -16
  176. package/dist/esm/customHooks/crashHandler.d.ts +0 -28
  177. package/dist/esm/customHooks/crashHandler.js +0 -55
  178. package/dist/esm/customHooks/logFilters.d.ts +0 -4
  179. package/dist/esm/customHooks/logFilters.js +0 -11
  180. package/dist/esm/customHooks/networkLogger.js +2 -13
  181. package/dist/esm/customHooks/performanceTracker.d.ts +0 -27
  182. package/dist/esm/customHooks/performanceTracker.js +0 -31
  183. package/dist/esm/customHooks/reduxLogger.d.ts +0 -12
  184. package/dist/esm/customHooks/reduxLogger.js +0 -51
  185. package/dist/esm/customHooks/storageInspector.d.ts +0 -40
  186. package/dist/esm/customHooks/storageInspector.js +1 -56
  187. package/dist/esm/decorators/index.d.ts +0 -37
  188. package/dist/esm/decorators/index.js +0 -42
  189. package/dist/esm/helpers/gaAnalyticsRegistry.d.ts +0 -10
  190. package/dist/esm/helpers/gaAnalyticsRegistry.js +0 -26
  191. package/dist/esm/helpers/index.d.ts +0 -7
  192. package/dist/esm/helpers/index.js +1 -42
  193. package/dist/esm/helpers/memoryManager.d.ts +0 -11
  194. package/dist/esm/helpers/memoryManager.js +0 -13
  195. package/dist/esm/helpers/searchQueryParser.d.ts +0 -4
  196. package/dist/esm/helpers/searchQueryParser.js +0 -18
  197. package/dist/esm/helpers/settingsStore.js +0 -8
  198. package/dist/esm/helpers/telemetry.d.ts +2 -0
  199. package/dist/esm/helpers/telemetry.js +298 -0
  200. package/dist/esm/i18n/index.d.ts +0 -9
  201. package/dist/esm/i18n/index.js +0 -15
  202. package/dist/esm/index.js +15 -97
  203. package/dist/esm/native/NativeInspector.d.ts +0 -54
  204. package/dist/esm/native/NativeInspector.js +0 -56
  205. package/dist/esm/network.d.ts +0 -4
  206. package/dist/esm/network.js +0 -4
  207. package/dist/esm/performance.d.ts +0 -4
  208. package/dist/esm/performance.js +0 -4
  209. package/dist/esm/redux.d.ts +0 -4
  210. package/dist/esm/redux.js +0 -4
  211. package/dist/esm/storage.d.ts +0 -4
  212. package/dist/esm/storage.js +0 -4
  213. package/dist/esm/styles/AppColors.d.ts +0 -3
  214. package/dist/esm/styles/AppColors.js +15 -30
  215. package/dist/esm/styles/AppFonts.d.ts +0 -4
  216. package/dist/esm/styles/AppFonts.js +0 -4
  217. package/dist/esm/styles/common.js +0 -11
  218. package/dist/esm/styles/index.js +0 -8
  219. package/dist/esm/types/enums.js +0 -3
  220. package/dist/esm/types/interfaces.d.ts +3 -3
  221. package/package.json +2 -2
  222. package/src/constants/telemetryConfig.ts +16 -0
  223. package/src/constants/version.ts +1 -1
  224. package/src/helpers/telemetry.ts +341 -0
  225. package/src/index.tsx +15 -1
  226. package/src/types/interfaces.ts +3 -0
@@ -3,15 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getCachedBundleAnalysis = exports.clearCachedBundleAnalysis = exports.analyzeHostAppBundle = exports.getInitialBundleAnalysis = exports.parseBundleSource = exports.trackRuntimeDefine = exports.trackRuntimeModuleExecution = exports.getHostScriptURL = exports.getBundleModuleEnabled = exports.setBundleModuleEnabled = void 0;
4
4
  const AppColors_1 = require("../styles/AppColors");
5
5
  const i18n_1 = require("../i18n");
6
- // ─── Real Host App Bundle Analyzer ──────────────────────────────────────────
7
- //
8
- // Dynamically measures and analyzes the real JavaScript bundle and packages
9
- // for the hosted application at runtime by:
10
- // 1. Inspecting `NativeModules.SourceCode.scriptURL` for the active Metro bundle.
11
- // 2. Fetching and measuring the exact byte size of the running JS bundle.
12
- // 3. Extracting real module paths (project files vs node_modules dependencies).
13
- // 4. Computing real Development and Production Binary (.ipa / .aab / .apk) sizes.
14
- // ─────────────────────────────────────────────────────────────────────────────
15
6
  const react_native_1 = require("react-native");
16
7
  let cachedAnalysis = null;
17
8
  let isAnalyzing = false;
@@ -44,7 +35,6 @@ const getSourceCodeModule = () => {
44
35
  return null;
45
36
  };
46
37
  const getHostScriptURL = () => {
47
- // 1. NativeModules.SourceCode (bridged) or SourceCode TurboModule (bridgeless / new arch)
48
38
  try {
49
39
  const scriptURL = getSourceCodeModule()?.scriptURL;
50
40
  if (typeof scriptURL === 'string' && scriptURL.length > 0) {
@@ -52,7 +42,6 @@ const getHostScriptURL = () => {
52
42
  }
53
43
  }
54
44
  catch { }
55
- // 2. Android legacy & new arch: PlatformConstants.serverHost, DevSettings, or AndroidConstants
56
45
  try {
57
46
  const serverHost = react_native_1.NativeModules?.PlatformConstants?.serverHost ||
58
47
  react_native_1.NativeModules?.AndroidConstants?.serverHost ||
@@ -64,7 +53,6 @@ const getHostScriptURL = () => {
64
53
  }
65
54
  }
66
55
  catch { }
67
- // 3. Fallback to global dev configs if defined
68
56
  try {
69
57
  const globalHost = globalThis?.__DEV_SERVER_URL__ ||
70
58
  globalThis?.__METRO_SERVER_HOST__ ||
@@ -88,7 +76,6 @@ const getHostScriptURL = () => {
88
76
  return '';
89
77
  };
90
78
  exports.getHostScriptURL = getHostScriptURL;
91
- // Dynamic Metro dev server ports to probe
92
79
  const DYNAMIC_DEV_PORTS = [8081, 8082, 8083, 8084, 8085, 8086, 8087, 8088, 8089, 8090, 19000, 19001, 3000];
93
80
  const extractHostAndPort = (scriptURL) => {
94
81
  if (!scriptURL || typeof scriptURL !== 'string') {
@@ -105,7 +92,6 @@ const extractHostAndPort = (scriptURL) => {
105
92
  };
106
93
  const probeCandidateUrlsInParallel = async (scriptURL, timeoutMs = 3000) => {
107
94
  const { host: extractedHost, port: extractedPort } = extractHostAndPort(scriptURL);
108
- // 1. If we have a direct HTTP scriptURL, try fetching directly
109
95
  if (scriptURL && scriptURL.startsWith('http')) {
110
96
  try {
111
97
  const controller = new AbortController();
@@ -122,10 +108,8 @@ const probeCandidateUrlsInParallel = async (scriptURL, timeoutMs = 3000) => {
122
108
  }
123
109
  }
124
110
  catch {
125
- // Continue to dynamic port discovery
126
111
  }
127
112
  }
128
- // 2. Dynamic Port Discovery via parallel lightweight Metro /status probes
129
113
  const candidateHosts = extractedHost
130
114
  ? [extractedHost, 'localhost', '127.0.0.1', ...(react_native_1.Platform.OS === 'android' ? ['10.0.2.2', '10.0.3.2'] : [])]
131
115
  : ['localhost', '127.0.0.1', ...(react_native_1.Platform.OS === 'android' ? ['10.0.2.2', '10.0.3.2'] : [])];
@@ -178,7 +162,6 @@ const probeCandidateUrlsInParallel = async (scriptURL, timeoutMs = 3000) => {
178
162
  catch {
179
163
  activeServer = null;
180
164
  }
181
- // 3. If a live Metro port was detected dynamically, fetch the bundle from it
182
165
  if (activeServer) {
183
166
  const dynamicBundleUrl = `http://${activeServer.host}:${activeServer.port}/index.bundle?platform=${react_native_1.Platform.OS}&dev=true`;
184
167
  try {
@@ -196,13 +179,10 @@ const probeCandidateUrlsInParallel = async (scriptURL, timeoutMs = 3000) => {
196
179
  }
197
180
  }
198
181
  catch {
199
- // Fallback
200
182
  }
201
183
  }
202
184
  return null;
203
185
  };
204
- // ─── Runtime Module & Define Tracking ────────────────────────────────────────
205
- // Captures modules registered via Metro's global __d and executed via __r.
206
186
  const executedModuleIds = new Set();
207
187
  const runtimeModules = new Map();
208
188
  const trackRuntimeModuleExecution = () => {
@@ -265,7 +245,6 @@ const extractBundleModules = (bundleText) => {
265
245
  const modules = [];
266
246
  const seenIds = new Set();
267
247
  if (bundleText && bundleText.length > 0) {
268
- // 1. Fast linear regex on sourceURL (100% linear, zero backtracking, super fast)
269
248
  const sourceUrlRegex = /\/\/[#@]\s*sourceURL=(?:https?:\/\/[^\s\r\n/]+\/|file:\/\/)?([^\s\r\n?#]+)/g;
270
249
  let srcMatch;
271
250
  let autoId = 900000;
@@ -279,7 +258,6 @@ const extractBundleModules = (bundleText) => {
279
258
  }
280
259
  }
281
260
  }
282
- // 2. Linear bounded regex for __d definitions: __d(..., <id>, [...], "<path>")
283
261
  const linearDefineRegex = /,\s*(\d+)\s*,\s*(?:\[[^\]\r\n]{0,500}\]|\{[^}\r\n]{0,500}\})\s*,\s*["']([^"'\r\n]+)["']\s*\)/g;
284
262
  let defMatch;
285
263
  while ((defMatch = linearDefineRegex.exec(bundleText)) !== null) {
@@ -291,7 +269,6 @@ const extractBundleModules = (bundleText) => {
291
269
  }
292
270
  }
293
271
  }
294
- // 3. Merge runtime modules registered through global.__d
295
272
  runtimeModules.forEach((item, id) => {
296
273
  if (!seenIds.has(id)) {
297
274
  seenIds.add(id);
@@ -314,27 +291,20 @@ const getStaticStartupModuleIds = (bundleText) => {
314
291
  }
315
292
  return ids;
316
293
  };
317
- /**
318
- * Dynamically computes the host app's project root directory without hardcoding any folder names.
319
- * Uses node_modules boundary, root entry points (index/App/package.json), and common directory analysis.
320
- */
321
294
  const detectProjectRoot = (allRawPaths) => {
322
295
  const normPaths = allRawPaths.map(p => p.replace(/\\/g, '/'));
323
- // 1. Extract from node_modules path (most definitive in Metro dev bundles)
324
296
  for (const norm of normPaths) {
325
297
  const nmIdx = norm.indexOf('/node_modules/');
326
298
  if (nmIdx !== -1) {
327
- return norm.slice(0, nmIdx + 1); // e.g. "/Users/user/Projects/my-app/"
299
+ return norm.slice(0, nmIdx + 1);
328
300
  }
329
301
  }
330
- // 2. Extract from root entrypoint files (e.g. /path/to/project/index.js or App.tsx)
331
302
  for (const norm of normPaths) {
332
303
  const match = norm.match(/^(.*\/)(?:index\.[jt]sx?|app\.[jt]sx?|package\.json)(?:[?#].*)?$/i);
333
304
  if (match && match[1]) {
334
305
  return match[1];
335
306
  }
336
307
  }
337
- // 3. Fallback: lowest common directory ancestor among all absolute project paths
338
308
  const absPaths = normPaths.filter(p => p.startsWith('/') && !p.includes('/node_modules/'));
339
309
  if (absPaths.length === 0)
340
310
  return '';
@@ -357,31 +327,22 @@ const detectProjectRoot = (allRawPaths) => {
357
327
  }
358
328
  return commonLen > 0 ? first.slice(0, commonLen).join('/') + '/' : '';
359
329
  };
360
- /**
361
- * Normalizes absolute or relative module paths so they retain their full
362
- * folder hierarchy from the host project root dynamically.
363
- */
364
330
  const normalizeProjectRelativePath = (rawPath, projectRoot) => {
365
331
  let clean = rawPath.replace(/\\/g, '/');
366
- // Strip query parameters e.g. ?platform=ios or hashes
367
332
  const qIdx = clean.search(/[?#]/);
368
333
  if (qIdx !== -1) {
369
334
  clean = clean.slice(0, qIdx);
370
335
  }
371
- // Strip file:// or http://.../ dev server URL prefixes
372
336
  clean = clean.replace(/^(?:https?:\/\/[^/]+\/|file:\/\/)/, '');
373
- // Strip dynamically detected project root prefix
374
337
  if (projectRoot && clean.startsWith(projectRoot)) {
375
338
  clean = clean.slice(projectRoot.length);
376
339
  }
377
- // Clean leading ../ sequences, ./, and leading /
378
340
  clean = clean.replace(/^(\.\.\/)+/, '').replace(/^\.\//, '').replace(/^\/+/, '');
379
341
  if (!clean)
380
342
  clean = rawPath.split('/').pop() || rawPath;
381
343
  return clean;
382
344
  };
383
345
  const isExternalPackage = (rawPath) => {
384
- // 1. Standard node_modules
385
346
  if (rawPath.includes('node_modules/')) {
386
347
  const pkgMatch = rawPath.match(/node_modules\/(?:@([^/]+)\/([^/]+)|([^/]+))/);
387
348
  if (pkgMatch) {
@@ -390,15 +351,12 @@ const isExternalPackage = (rawPath) => {
390
351
  }
391
352
  return { isPkg: true };
392
353
  }
393
- // 2. React Native In-App Inspector (when linked or embedded)
394
354
  if (rawPath.includes('react-native-inapp-inspector')) {
395
355
  return { isPkg: true, pkgName: 'react-native-inapp-inspector' };
396
356
  }
397
- // 3. Yarn berry / pnpm virtual stores
398
357
  if (rawPath.includes('.yarn/') || rawPath.includes('.pnpm/')) {
399
358
  return { isPkg: true };
400
359
  }
401
- // 4. Compiled package dist / build folders outside project source
402
360
  if (rawPath.includes('/dist/esm/') ||
403
361
  rawPath.includes('/dist/commonjs/') ||
404
362
  rawPath.includes('/dist/cjs/') ||
@@ -419,22 +377,16 @@ const isInternalModule = (rawPath) => {
419
377
  rawPath.includes('Libraries/Core/InitializeCore.js') ||
420
378
  rawPath.includes('@babel/runtime'));
421
379
  };
422
- /**
423
- * Parses raw Metro bundle source code to discover real modules and packages in the host app.
424
- */
425
380
  const parseBundleSource = (bundleText, totalBytes, scriptURL, isLive = true) => {
426
381
  const isHermes = Boolean(globalThis.HermesInternal);
427
382
  const totalDevMb = Number((totalBytes / (1024 * 1024)).toFixed(2));
428
383
  const totalDevKb = Math.round(totalBytes / 1024);
429
384
  const modules = extractBundleModules(bundleText);
430
385
  const startupIds = getStaticStartupModuleIds(bundleText);
431
- // Build module map for dependency graph traversal
432
386
  const modMap = new Map();
433
387
  for (const mod of modules) {
434
388
  modMap.set(mod.id, mod);
435
389
  }
436
- // Transitive Reachability: traverse the dependency graph starting from
437
- // entrypoints (index.js, App.tsx, app.json, startupIds, executedModuleIds)
438
390
  const consumedIds = new Set();
439
391
  const queue = [];
440
392
  const markConsumed = (id) => {
@@ -443,7 +395,6 @@ const parseBundleSource = (bundleText, totalBytes, scriptURL, isLive = true) =>
443
395
  queue.push(id);
444
396
  }
445
397
  };
446
- // Seed with root entrypoints and runtime executions
447
398
  markConsumed(0);
448
399
  startupIds.forEach(id => markConsumed(id));
449
400
  executedModuleIds.forEach(id => markConsumed(id));
@@ -462,7 +413,6 @@ const parseBundleSource = (bundleText, totalBytes, scriptURL, isLive = true) =>
462
413
  markConsumed(mod.id);
463
414
  }
464
415
  }
465
- // Transitive BFS dependency traversal
466
416
  while (queue.length > 0) {
467
417
  const currId = queue.shift();
468
418
  const currMod = modMap.get(currId);
@@ -475,7 +425,7 @@ const parseBundleSource = (bundleText, totalBytes, scriptURL, isLive = true) =>
475
425
  const discoveredPackagesMap = new Map();
476
426
  const rawProjectItems = [];
477
427
  for (const mod of modules) {
478
- const rawPath = mod.path.replace(/\\/g, '/'); // Normalize Windows backslashes
428
+ const rawPath = mod.path.replace(/\\/g, '/');
479
429
  const { isPkg, pkgName } = isExternalPackage(rawPath);
480
430
  if (isPkg) {
481
431
  if (pkgName && !pkgName.startsWith('.')) {
@@ -483,13 +433,11 @@ const parseBundleSource = (bundleText, totalBytes, scriptURL, isLive = true) =>
483
433
  }
484
434
  continue;
485
435
  }
486
- // Filter out internal Metro polyfills / virtual modules
487
436
  if (isInternalModule(rawPath)) {
488
437
  continue;
489
438
  }
490
439
  rawProjectItems.push({ mod, rawPath });
491
440
  }
492
- // Dynamically calculate project root prefix to cleanly extract all host app folders & files
493
441
  const projectRoot = detectProjectRoot(modules.map(item => item.path));
494
442
  const discoveredFiles = [];
495
443
  let fileIdx = 0;
@@ -549,11 +497,7 @@ const parseBundleSource = (bundleText, totalBytes, scriptURL, isLive = true) =>
549
497
  category = 'json';
550
498
  color = AppColors_1.AppColors.emerald500;
551
499
  }
552
- // Approximate module size from total dev size and module count
553
500
  const approxKb = Math.max(2, Math.round((totalDevKb * 0.15) / Math.max(modules.length, 20)));
554
- // In React Native Metro bundler, modules included in the bundle are transitively
555
- // imported from the entrypoint (index.js / App.tsx) and active in the dependency tree.
556
- // A module is marked as 'Not Consumed' only if it is an orphaned test file, mock fixture, or dead spec.
557
501
  const isTestOrFixture = cleanPath.includes('.test.') ||
558
502
  cleanPath.includes('.spec.') ||
559
503
  cleanPath.includes('__tests__') ||
@@ -577,7 +521,6 @@ const parseBundleSource = (bundleText, totalBytes, scriptURL, isLive = true) =>
577
521
  isConsumed,
578
522
  });
579
523
  }
580
- // Dynamic color palette generator based on package name hash
581
524
  const getPackageColor = (name) => {
582
525
  const colors = [
583
526
  AppColors_1.AppColors.indigo500, AppColors_1.AppColors.sky500, AppColors_1.AppColors.pink500, AppColors_1.AppColors.purple500, AppColors_1.AppColors.emerald500,
@@ -660,7 +603,6 @@ const parseBundleSource = (bundleText, totalBytes, scriptURL, isLive = true) =>
660
603
  }
661
604
  return null;
662
605
  };
663
- // Convert discovered packages into dynamic package items
664
606
  const packageEntries = Array.from(discoveredPackagesMap.entries());
665
607
  const totalPkgHits = packageEntries.reduce((sum, [, hits]) => sum + hits, 0) || 1;
666
608
  const packagesList = [];
@@ -690,7 +632,6 @@ const parseBundleSource = (bundleText, totalBytes, scriptURL, isLive = true) =>
690
632
  lastActive: `${hits} modules`,
691
633
  });
692
634
  });
693
- // Attach subpackages to their direct parents
694
635
  const directPackagesMap = new Map();
695
636
  packagesList.forEach(pkg => {
696
637
  if (pkg.isDirectDefined) {
@@ -705,9 +646,7 @@ const parseBundleSource = (bundleText, totalBytes, scriptURL, isLive = true) =>
705
646
  parent.subpackages.push(pkg);
706
647
  }
707
648
  });
708
- // Sort packages by size descending
709
649
  packagesList.sort((a, b) => b.sizeKb - a.sizeKb);
710
- // Compute Development Split-Up dynamically from real discovered files and packages
711
650
  let realNodeModulesKb = 0;
712
651
  for (const pkg of packagesList) {
713
652
  realNodeModulesKb += pkg.sizeKb || 0;
@@ -726,35 +665,21 @@ const parseBundleSource = (bundleText, totalBytes, scriptURL, isLive = true) =>
726
665
  const nodeModulesKb = realNodeModulesKb > 0 ? realNodeModulesKb : Math.round(totalDevKb * 0.58);
727
666
  const assetsMediaKb = realAssetsMediaKb > 0 ? realAssetsMediaKb : Math.round(totalDevKb * 0.08);
728
667
  const metroOverheadKb = Math.max(0, totalDevKb - appSourceKb - nodeModulesKb - assetsMediaKb);
729
- // ─── Production Binary (.ipa / .aab / .apk) Dynamically Scaled ────────────
730
- // Fully dynamic across any React Native project based on:
731
- // 1. Exact Hermes bytecode size (releaseJsMb derived from totalDevKb)
732
- // 2. Exact third-party package count and dependency weight
733
- // 3. Exact media assets, fonts, and images size (assetsMediaKb)
734
668
  const releaseJsMb = Number(((totalDevKb * 0.38) / 1024).toFixed(2));
735
669
  const nodeModulesMb = Number((nodeModulesKb / 1024).toFixed(2));
736
670
  const assetsMediaMb = Number((assetsMediaKb / 1024).toFixed(2));
737
- // In node_modules, only ~15-20% of packages contain compiled native code (C++ .so, Swift/Obj-C)
738
- // Clamp effective native packages so large JS dependency trees (150+ packages) scale realistically
739
671
  const effectiveNativePkgCount = Math.min(packagesList.length, 55);
740
- // ─── 1. iOS Binary Calculations (.ipa / App Store) ────────────────────────
741
- // Base React Native iOS engine Mach-O + third-party dynamic Frameworks + Assets + Hermes
742
672
  const nativeFrameworksMb = Number((48.0 + effectiveNativePkgCount * 0.35 + nodeModulesMb * 0.9).toFixed(1));
743
673
  const nativeMachoMb = Number((38.0 + effectiveNativePkgCount * 0.22 + nodeModulesMb * 0.6).toFixed(1));
744
674
  const assetsCatalogMb = Number((30.0 + assetsMediaMb * 2.2).toFixed(1));
745
675
  const metadataMb = 6.4;
746
676
  const iosInstallMb = Number((releaseJsMb + nativeFrameworksMb + nativeMachoMb + assetsCatalogMb + metadataMb).toFixed(1));
747
- // iOS .ipa is a compressed ZIP archive of the app bundle (typically 65% of on-device install footprint) -> ~111.9 MB
748
677
  const iosDownloadMb = Number((iosInstallMb * 0.655).toFixed(1));
749
- // ─── 2. Android Google Play App Bundle (.aab / dynamic split delivery) ───
750
678
  const androidCppMb = Number((20.0 + effectiveNativePkgCount * 0.12 + nodeModulesMb * 0.4).toFixed(1));
751
679
  const androidDexMb = Number((14.0 + effectiveNativePkgCount * 0.08 + nodeModulesMb * 0.25).toFixed(1));
752
680
  const androidResMb = Number((16.0 + assetsMediaMb * 1.5).toFixed(1));
753
681
  const androidInstallMb = Number((releaseJsMb + androidCppMb + androidDexMb + androidResMb + 3.8).toFixed(1));
754
682
  const androidDownloadMb = Number((androidInstallMb * 0.54).toFixed(1));
755
- // ─── 3. Universal Standalone FAT APK (.apk) ───────────────────────────────
756
- // Multi-ABI FAT APK bundling 4 distinct native architectures (arm64-v8a + armeabi-v7a + x86_64 + x86)
757
- // Base multi-ABI engine C++ libraries (libhermes.so, libreactnativejni.so, libfbjni.so, libc++_shared.so) ~195 MB
758
683
  const androidMultiAbiCppMb = Number((195.0 + effectiveNativePkgCount * 0.55 + nodeModulesMb * 1.6).toFixed(1));
759
684
  const androidApkDexMb = Number((54.0 + effectiveNativePkgCount * 0.2 + nodeModulesMb * 0.6).toFixed(1));
760
685
  const androidApkResMb = Number((58.0 + assetsMediaMb * 2.8).toFixed(1));
@@ -980,21 +905,15 @@ const parseBundleSource = (bundleText, totalBytes, scriptURL, isLive = true) =>
980
905
  };
981
906
  };
982
907
  exports.parseBundleSource = parseBundleSource;
983
- /**
984
- * Returns an instant baseline bundle analysis synchronously (never blocks UI).
985
- */
986
908
  const getInitialBundleAnalysis = () => {
987
909
  if (cachedAnalysis)
988
910
  return cachedAnalysis;
989
911
  const scriptURL = (0, exports.getHostScriptURL)();
990
- const fallbackBytes = 6840000; // ~6.8MB standard RN dev bundle
912
+ const fallbackBytes = 6840000;
991
913
  const result = (0, exports.parseBundleSource)('', fallbackBytes, scriptURL || 'unknown', false);
992
914
  return result;
993
915
  };
994
916
  exports.getInitialBundleAnalysis = getInitialBundleAnalysis;
995
- /**
996
- * Asynchronously fetch and analyze the running Metro bundle in the background.
997
- */
998
917
  const analyzeHostAppBundle = async (forceRefresh = false) => {
999
918
  if (forceRefresh) {
1000
919
  cachedAnalysis = null;
@@ -1020,9 +939,7 @@ const analyzeHostAppBundle = async (forceRefresh = false) => {
1020
939
  }
1021
940
  }
1022
941
  catch {
1023
- // Silent catch
1024
942
  }
1025
- // Fallback: could not reach a Metro dev server (offline, device on different network, or release build).
1026
943
  const fallbackBytes = 6840000;
1027
944
  const result = (0, exports.parseBundleSource)('', fallbackBytes, scriptURL || 'unknown', false);
1028
945
  cachedAnalysis = result;
@@ -36,7 +36,6 @@ const pruneConsoleLogs = (targetCount) => {
36
36
  return Math.max(0, pruned);
37
37
  };
38
38
  exports.pruneConsoleLogs = pruneConsoleLogs;
39
- // ─── Helpers ──────────────────────────────────────────────────────────────────
40
39
  const formatArgs = (args) => {
41
40
  return args
42
41
  .map(arg => {
@@ -56,7 +55,6 @@ const formatArgs = (args) => {
56
55
  })
57
56
  .join(' ');
58
57
  };
59
- // ─── Dynamic Symbolication Helper for React Native Metro ────────────────────
60
58
  const getMetroSymbolicateUrl = () => {
61
59
  try {
62
60
  const scriptURL = react_native_1.NativeModules.SourceCode?.scriptURL ||
@@ -78,11 +76,9 @@ const getMetroSymbolicateUrl = () => {
78
76
  const symbolicateStack = async (stackString) => {
79
77
  if (typeof __DEV__ === 'undefined' || !__DEV__ || !stackString)
80
78
  return null;
81
- // 1. Try React Native built-in symbolicateStackTrace if available
82
79
  try {
83
80
  let symModule = null;
84
81
  try {
85
- // @ts-ignore
86
82
  symModule = require('react-native/Libraries/Core/Devtools/symbolicateStackTrace');
87
83
  }
88
84
  catch { }
@@ -95,11 +91,9 @@ const symbolicateStack = async (stackString) => {
95
91
  }
96
92
  }
97
93
  catch { }
98
- // 2. Direct HTTP symbolication to dynamic Metro packager endpoint
99
94
  try {
100
95
  const metroUrl = getMetroSymbolicateUrl();
101
96
  const scriptURL = react_native_1.NativeModules.SourceCode?.scriptURL || 'http://localhost:8081/index.bundle?platform=ios&dev=true';
102
- // Parse Hermes stack string into frame objects for Metro symbolicate endpoint
103
97
  const lines = stackString.split('\n');
104
98
  const inputFrames = [];
105
99
  for (const rawLine of lines) {
@@ -223,7 +217,6 @@ const addLog = (type, args, sourceMethod) => {
223
217
  isIntercepting = true;
224
218
  try {
225
219
  const message = formatArgs(args);
226
- // Check if the log should be ignored based on starting prefixes across all categories
227
220
  const allPrefixes = [
228
221
  ...((logFilters_1.IGNORED_LOG_PREFIXES && logFilters_1.IGNORED_LOG_PREFIXES.info) || []),
229
222
  ...((logFilters_1.IGNORED_LOG_PREFIXES && logFilters_1.IGNORED_LOG_PREFIXES.warn) || []),
@@ -251,7 +244,6 @@ const addLog = (type, args, sourceMethod) => {
251
244
  logs.unshift(newLog);
252
245
  logs = logs.slice(0, maxConsoleLogsLimit);
253
246
  notify();
254
- // Asynchronously symbolicate stack trace via Metro in development
255
247
  const stackToSymbolicate = errorStack || stackToUse || stack;
256
248
  if (stackToSymbolicate && typeof __DEV__ !== 'undefined' && __DEV__) {
257
249
  const currentLogId = newLog.id;
@@ -265,7 +257,6 @@ const addLog = (type, args, sourceMethod) => {
265
257
  const method = frame.methodName || '<anonymous>';
266
258
  const line = frame.lineNumber != null ? `:${frame.lineNumber}` : '';
267
259
  const col = frame.column != null ? `:${frame.column}` : '';
268
- // Skip logger internal frames
269
260
  const isInternal = file.includes('customHooks/consoleLogger') ||
270
261
  file.includes('setupConsoleLogger') ||
271
262
  file.includes('getStackDetails') ||
@@ -310,13 +301,11 @@ const addLog = (type, args, sourceMethod) => {
310
301
  }
311
302
  }
312
303
  catch (e) {
313
- // Fail-safe to prevent crash during logging
314
304
  }
315
305
  finally {
316
306
  isIntercepting = false;
317
307
  }
318
308
  };
319
- // ─── Public API ───────────────────────────────────────────────────────────────
320
309
  const addLogFromCrash = (error, message, stack, isFatal) => {
321
310
  const { caller, errorStack } = getStackDetails([error]);
322
311
  const newLog = {
@@ -379,7 +368,6 @@ const setupConsoleLogger = () => {
379
368
  warn: console.warn,
380
369
  error: console.error,
381
370
  };
382
- // Intercept console.log
383
371
  console.log = (...args) => {
384
372
  try {
385
373
  addLog('info', args, 'log');
@@ -387,7 +375,6 @@ const setupConsoleLogger = () => {
387
375
  catch { }
388
376
  originalConsole.log(...args);
389
377
  };
390
- // Intercept console.info
391
378
  console.info = (...args) => {
392
379
  try {
393
380
  addLog('info', args, 'info');
@@ -395,7 +382,6 @@ const setupConsoleLogger = () => {
395
382
  catch { }
396
383
  originalConsole.info(...args);
397
384
  };
398
- // Intercept console.warn
399
385
  console.warn = (...args) => {
400
386
  try {
401
387
  addLog('warn', args, 'warn');
@@ -403,7 +389,6 @@ const setupConsoleLogger = () => {
403
389
  catch { }
404
390
  originalConsole.warn(...args);
405
391
  };
406
- // Intercept console.error
407
392
  console.error = (...args) => {
408
393
  try {
409
394
  addLog('error', args, 'error');
@@ -415,7 +400,6 @@ const setupConsoleLogger = () => {
415
400
  firstArg.includes('Render Error') ||
416
401
  firstArg.includes('ReferenceError') ||
417
402
  firstArg.includes('TypeError'));
418
- // Suppress console.error if it's a React render crash to prevent RedBox dialog
419
403
  if (!isRenderError) {
420
404
  originalConsole.error(...args);
421
405
  }
@@ -23,46 +23,18 @@ export declare const recordReduxBreadcrumb: (actionType: string, payload?: any)
23
23
  export declare const recordUserActionBreadcrumb: (action: string, metadata?: any) => void;
24
24
  export declare const clearCrashBreadcrumbs: () => void;
25
25
  export declare const getCrashBreadcrumbs: () => CrashBreadcrumb[];
26
- /**
27
- * Intelligent stack trace parser with multi-engine support:
28
- * - Hermes bytecode & source maps
29
- * - Android Java / Kotlin native frames
30
- * - iOS Objective-C / Swift symbols
31
- * - JavaScript standard V8 & SpiderMonkey
32
- */
33
26
  export declare const parseCrashStackTrace: (stack?: string) => ParsedStackFrame[];
34
- /**
35
- * Computes a unique fingerprint signature to group recurring crash occurrences.
36
- */
37
27
  export declare const computeCrashFingerprint: (crash: CrashRecord) => string;
38
28
  export declare const getCrashRecords: () => CrashRecord[];
39
29
  export declare const clearCrashRecords: () => void;
40
30
  export declare const subscribeCrashEvents: (listener: CrashListener) => (() => void);
41
31
  export declare const emitCrashEvent: (payload: CrashEventPayload) => void;
42
- /**
43
- * Core exception interceptor. Ingests all forms of errors, parses call stacks,
44
- * collects device telemetry, records breadcrumbs, and updates the store.
45
- */
46
32
  export declare const handleInterceptedCrash: (errorOrTitle: any, rawStack?: any, isFatal?: boolean, customType?: CrashType, componentStack?: string) => CrashRecord;
47
- /**
48
- * Manually report a caught error with custom metadata.
49
- */
50
33
  export declare const recordCustomCrash: (error: Error | string, options?: {
51
34
  isFatal?: boolean;
52
35
  type?: CrashType;
53
36
  componentStack?: string;
54
37
  }) => CrashRecord;
55
- /**
56
- * Simulates a crash for developer testing without crashing the host app.
57
- * Uses real runtime Error objects — no mocked file paths or fake stacks.
58
- */
59
38
  export declare const simulateTestCrash: (type?: CrashType, customMessage?: string, customStack?: string) => CrashRecord;
60
- /**
61
- * Formats a crash into Text, Markdown, or JSON.
62
- */
63
39
  export declare const exportCrashReport: (crash: CrashRecord, format?: CrashExportFormat) => string;
64
- /**
65
- * Natively intercepts and prevents crashes, native RedBox dialogues,
66
- * unhandled JS errors, and unhandled promise rejections.
67
- */
68
40
  export declare const setupGlobalCrashHandler: () => void;