react-native-inapp-inspector 1.1.24 → 1.1.26
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.
- package/android/build.gradle +36 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/java/com/inappinspector/NetworkInspectorModule.java +114 -0
- package/android/src/main/java/com/inappinspector/NetworkInspectorPackage.java +28 -0
- package/dist/commonjs/components/AnalyticsEventCard.js +94 -88
- package/dist/commonjs/components/ConsoleLogCard.js +49 -25
- package/dist/commonjs/components/ErrorBoundary.d.ts +1 -1
- package/dist/commonjs/components/ErrorBoundary.js +9 -145
- package/dist/commonjs/components/Inspector/AnalyticsFilterModal.d.ts +7 -0
- package/dist/commonjs/components/Inspector/AnalyticsFilterModal.js +1002 -0
- package/dist/commonjs/components/Inspector/AnalyticsTab.js +637 -10
- package/dist/commonjs/components/Inspector/BundleTab.d.ts +1 -1
- package/dist/commonjs/components/Inspector/BundleTab.js +826 -406
- package/dist/commonjs/components/Inspector/CrashDetail.d.ts +3 -0
- package/dist/commonjs/components/Inspector/CrashDetail.js +796 -0
- package/dist/commonjs/components/Inspector/CrashFilterModal.d.ts +20 -0
- package/dist/commonjs/components/Inspector/CrashFilterModal.js +597 -0
- package/dist/commonjs/components/Inspector/CrashTab.d.ts +3 -0
- package/dist/commonjs/components/Inspector/CrashTab.js +727 -0
- package/dist/commonjs/components/Inspector/InspectorContext.js +6 -1
- package/dist/commonjs/components/Inspector/InspectorHeader.js +65 -28
- package/dist/commonjs/components/Inspector/LogDetail.js +227 -114
- package/dist/commonjs/components/Inspector/MainScreen.js +13 -4
- package/dist/commonjs/components/Inspector/NetworkDetail.js +131 -81
- package/dist/commonjs/components/Inspector/PerformanceTab.js +20 -10
- package/dist/commonjs/components/Inspector/SettingsPanel.js +90 -1
- package/dist/commonjs/components/Inspector/TabBar.js +15 -3
- package/dist/commonjs/components/NetworkIcons.d.ts +25 -0
- package/dist/commonjs/components/NetworkIcons.js +188 -1
- package/dist/commonjs/components/SegmentedTabs.js +33 -23
- package/dist/commonjs/components/TreeNode.js +13 -12
- package/dist/commonjs/constants/version.d.ts +1 -1
- package/dist/commonjs/constants/version.js +1 -1
- package/dist/commonjs/customHooks/analyticsLogger.js +70 -44
- package/dist/commonjs/customHooks/bundleAnalyzer.d.ts +5 -1
- package/dist/commonjs/customHooks/bundleAnalyzer.js +497 -126
- package/dist/commonjs/customHooks/consoleLogger.d.ts +1 -0
- package/dist/commonjs/customHooks/consoleLogger.js +153 -51
- package/dist/commonjs/customHooks/crashHandler.d.ts +64 -0
- package/dist/commonjs/customHooks/crashHandler.js +681 -0
- package/dist/commonjs/customHooks/networkLogger.js +74 -49
- package/dist/commonjs/customHooks/performanceTracker.d.ts +8 -0
- package/dist/commonjs/customHooks/performanceTracker.js +44 -3
- package/dist/commonjs/decorators/index.d.ts +49 -0
- package/dist/commonjs/decorators/index.js +142 -0
- package/dist/commonjs/helpers/gaAnalyticsRegistry.d.ts +18 -0
- package/dist/commonjs/helpers/gaAnalyticsRegistry.js +174 -0
- package/dist/commonjs/helpers/index.d.ts +7 -4
- package/dist/commonjs/helpers/index.js +102 -64
- package/dist/commonjs/i18n/locales/en.json +182 -4
- package/dist/commonjs/index.d.ts +6 -0
- package/dist/commonjs/index.js +310 -8
- package/dist/commonjs/styles/index.d.ts +4 -1
- package/dist/commonjs/styles/index.js +22 -19
- package/dist/commonjs/types/enums.d.ts +156 -9
- package/dist/commonjs/types/enums.js +139 -2
- package/dist/commonjs/types/interfaces.d.ts +70 -1
- package/dist/esm/components/AnalyticsEventCard.js +95 -89
- package/dist/esm/components/ConsoleLogCard.js +49 -25
- package/dist/esm/components/ErrorBoundary.d.ts +1 -1
- package/dist/esm/components/ErrorBoundary.js +10 -113
- package/dist/esm/components/Inspector/AnalyticsFilterModal.d.ts +7 -0
- package/dist/esm/components/Inspector/AnalyticsFilterModal.js +964 -0
- package/dist/esm/components/Inspector/AnalyticsTab.js +639 -12
- package/dist/esm/components/Inspector/BundleTab.d.ts +1 -1
- package/dist/esm/components/Inspector/BundleTab.js +827 -407
- package/dist/esm/components/Inspector/CrashDetail.d.ts +3 -0
- package/dist/esm/components/Inspector/CrashDetail.js +758 -0
- package/dist/esm/components/Inspector/CrashFilterModal.d.ts +20 -0
- package/dist/esm/components/Inspector/CrashFilterModal.js +557 -0
- package/dist/esm/components/Inspector/CrashTab.d.ts +3 -0
- package/dist/esm/components/Inspector/CrashTab.js +689 -0
- package/dist/esm/components/Inspector/InspectorContext.js +1 -0
- package/dist/esm/components/Inspector/InspectorHeader.js +66 -29
- package/dist/esm/components/Inspector/LogDetail.js +227 -114
- package/dist/esm/components/Inspector/MainScreen.js +14 -5
- package/dist/esm/components/Inspector/NetworkDetail.js +132 -49
- package/dist/esm/components/Inspector/PerformanceTab.js +20 -10
- package/dist/esm/components/Inspector/SettingsPanel.js +91 -2
- package/dist/esm/components/Inspector/TabBar.js +16 -4
- package/dist/esm/components/NetworkIcons.d.ts +25 -0
- package/dist/esm/components/NetworkIcons.js +161 -0
- package/dist/esm/components/SegmentedTabs.js +33 -23
- package/dist/esm/components/TreeNode.js +13 -12
- package/dist/esm/constants/version.d.ts +1 -1
- package/dist/esm/constants/version.js +1 -1
- package/dist/esm/customHooks/analyticsLogger.js +70 -44
- package/dist/esm/customHooks/bundleAnalyzer.d.ts +5 -1
- package/dist/esm/customHooks/bundleAnalyzer.js +493 -125
- package/dist/esm/customHooks/consoleLogger.d.ts +1 -0
- package/dist/esm/customHooks/consoleLogger.js +151 -50
- package/dist/esm/customHooks/crashHandler.d.ts +64 -0
- package/dist/esm/customHooks/crashHandler.js +659 -0
- package/dist/esm/customHooks/networkLogger.js +74 -49
- package/dist/esm/customHooks/performanceTracker.d.ts +8 -0
- package/dist/esm/customHooks/performanceTracker.js +38 -1
- package/dist/esm/decorators/index.d.ts +49 -0
- package/dist/esm/decorators/index.js +137 -0
- package/dist/esm/helpers/gaAnalyticsRegistry.d.ts +18 -0
- package/dist/esm/helpers/gaAnalyticsRegistry.js +169 -0
- package/dist/esm/helpers/index.d.ts +7 -4
- package/dist/esm/helpers/index.js +100 -63
- package/dist/esm/i18n/locales/en.json +182 -4
- package/dist/esm/index.d.ts +6 -0
- package/dist/esm/index.js +262 -8
- package/dist/esm/styles/index.d.ts +4 -1
- package/dist/esm/styles/index.js +22 -19
- package/dist/esm/types/enums.d.ts +156 -9
- package/dist/esm/types/enums.js +138 -3
- package/dist/esm/types/interfaces.d.ts +70 -1
- package/ios/NetworkInspectorModule.h +6 -0
- package/ios/NetworkInspectorModule.m +125 -0
- package/package.json +5 -2
- package/react-native-inapp-inspector.podspec +18 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ConsoleLog } from '../types';
|
|
2
|
+
export declare const addLogFromCrash: (error: any, message: string, stack?: string, isFatal?: boolean) => ConsoleLog;
|
|
2
3
|
export declare const subscribeConsoleLogs: (callback: (logs: ConsoleLog[]) => void) => () => void;
|
|
3
4
|
export declare const clearConsoleLogs: () => void;
|
|
4
5
|
export declare const getConsoleLogs: () => ConsoleLog[];
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { NativeModules } from 'react-native';
|
|
1
2
|
import { IGNORED_LOG_PREFIXES } from './logFilters';
|
|
3
|
+
import { setupGlobalCrashHandler } from './crashHandler';
|
|
2
4
|
let logs = [];
|
|
3
5
|
let listeners = [];
|
|
4
6
|
let counter = 0;
|
|
@@ -24,12 +26,25 @@ const formatArgs = (args) => {
|
|
|
24
26
|
})
|
|
25
27
|
.join(' ');
|
|
26
28
|
};
|
|
27
|
-
// ─── Symbolication Helper for React Native Metro
|
|
29
|
+
// ─── Dynamic Symbolication Helper for React Native Metro ────────────────────
|
|
30
|
+
const getMetroSymbolicateUrl = () => {
|
|
31
|
+
try {
|
|
32
|
+
const scriptURL = NativeModules.SourceCode?.scriptURL;
|
|
33
|
+
if (typeof scriptURL === 'string') {
|
|
34
|
+
const match = scriptURL.match(/^(https?:\/\/[^\/]+)/);
|
|
35
|
+
if (match) {
|
|
36
|
+
return `${match[1]}/symbolicate`;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
catch { }
|
|
41
|
+
return 'http://localhost:8081/symbolicate';
|
|
42
|
+
};
|
|
28
43
|
const symbolicateStack = async (stackString) => {
|
|
29
|
-
if (typeof __DEV__ === 'undefined' || !__DEV__)
|
|
44
|
+
if (typeof __DEV__ === 'undefined' || !__DEV__ || !stackString)
|
|
30
45
|
return null;
|
|
46
|
+
// 1. Try React Native built-in symbolicateStackTrace if available
|
|
31
47
|
try {
|
|
32
|
-
// 1. Try React Native's built-in symbolicateStackTrace if available
|
|
33
48
|
let symModule = null;
|
|
34
49
|
try {
|
|
35
50
|
// @ts-ignore
|
|
@@ -39,24 +54,61 @@ const symbolicateStack = async (stackString) => {
|
|
|
39
54
|
const symFn = symModule?.default || symModule;
|
|
40
55
|
if (typeof symFn === 'function') {
|
|
41
56
|
const res = await symFn(stackString);
|
|
42
|
-
if (res && Array.isArray(res.stack)) {
|
|
57
|
+
if (res && Array.isArray(res.stack) && res.stack.length > 0) {
|
|
43
58
|
return res.stack;
|
|
44
59
|
}
|
|
45
60
|
}
|
|
46
61
|
}
|
|
47
62
|
catch { }
|
|
63
|
+
// 2. Direct HTTP symbolication to dynamic Metro packager endpoint
|
|
48
64
|
try {
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
65
|
+
const metroUrl = getMetroSymbolicateUrl();
|
|
66
|
+
const scriptURL = NativeModules.SourceCode?.scriptURL || 'http://localhost:8081/index.bundle?platform=ios&dev=true';
|
|
67
|
+
// Parse Hermes stack string into frame objects for Metro symbolicate endpoint
|
|
68
|
+
const lines = stackString.split('\n');
|
|
69
|
+
const inputFrames = [];
|
|
70
|
+
for (const rawLine of lines) {
|
|
71
|
+
const line = rawLine.trim().replace(/^at /, '');
|
|
72
|
+
if (!line)
|
|
73
|
+
continue;
|
|
74
|
+
let methodName = '<anonymous>';
|
|
75
|
+
let locationPart = line;
|
|
76
|
+
const parenMatch = line.match(/^(.*?)\s*\((.*?)\)$/);
|
|
77
|
+
if (parenMatch) {
|
|
78
|
+
methodName = parenMatch[1].trim() || '<anonymous>';
|
|
79
|
+
locationPart = parenMatch[2].trim();
|
|
80
|
+
}
|
|
81
|
+
else if (line.includes('@')) {
|
|
82
|
+
const atIdx = line.indexOf('@');
|
|
83
|
+
methodName = line.substring(0, atIdx).trim() || '<anonymous>';
|
|
84
|
+
locationPart = line.substring(atIdx + 1).trim();
|
|
85
|
+
}
|
|
86
|
+
locationPart = locationPart.replace(/^address at /, '');
|
|
87
|
+
const locMatch = locationPart.match(/^(.*?):(\d+):(\d+)$/);
|
|
88
|
+
if (locMatch) {
|
|
89
|
+
let file = locMatch[1];
|
|
90
|
+
if (!file.startsWith('http') && file !== 'native' && !file.includes('InternalBytecode')) {
|
|
91
|
+
file = scriptURL;
|
|
92
|
+
}
|
|
93
|
+
inputFrames.push({
|
|
94
|
+
file,
|
|
95
|
+
lineNumber: parseInt(locMatch[2], 10),
|
|
96
|
+
column: parseInt(locMatch[3], 10),
|
|
97
|
+
methodName,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (inputFrames.length > 0) {
|
|
102
|
+
const response = await fetch(metroUrl, {
|
|
103
|
+
method: 'POST',
|
|
104
|
+
headers: { 'Content-Type': 'application/json' },
|
|
105
|
+
body: JSON.stringify({ stack: inputFrames }),
|
|
106
|
+
});
|
|
107
|
+
if (response.ok) {
|
|
108
|
+
const json = await response.json();
|
|
109
|
+
if (json && Array.isArray(json.stack) && json.stack.length > 0) {
|
|
110
|
+
return json.stack;
|
|
111
|
+
}
|
|
60
112
|
}
|
|
61
113
|
}
|
|
62
114
|
}
|
|
@@ -163,34 +215,10 @@ const addLog = (type, args, sourceMethod) => {
|
|
|
163
215
|
logs = logs.slice(0, MAX_LOGS);
|
|
164
216
|
notify();
|
|
165
217
|
// Asynchronously symbolicate stack trace via Metro in development
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
.then(symbolicatedFrames => {
|
|
169
|
-
if (symbolicatedFrames && symbolicatedFrames.length > 0) {
|
|
170
|
-
const validFrames = symbolicatedFrames.filter(f => f.file &&
|
|
171
|
-
!f.file.includes('react-native/Libraries') &&
|
|
172
|
-
!f.file.includes('node_modules') &&
|
|
173
|
-
!isLoggerInternal(f.file) &&
|
|
174
|
-
!isLoggerInternal(f.methodName || ''));
|
|
175
|
-
const topFrame = validFrames[0] || symbolicatedFrames[0];
|
|
176
|
-
if (topFrame) {
|
|
177
|
-
const cleanMethod = topFrame.methodName || 'anonymous';
|
|
178
|
-
const cleanFile = topFrame.file.split('/').pop() || topFrame.file;
|
|
179
|
-
newLog.caller = `${cleanMethod} (${cleanFile}:${topFrame.lineNumber || 1}:${topFrame.column || 1})`;
|
|
180
|
-
}
|
|
181
|
-
newLog.stack = symbolicatedFrames
|
|
182
|
-
.filter(f => !isLoggerInternal(f.file || '') && !isLoggerInternal(f.methodName || ''))
|
|
183
|
-
.map(f => ` at ${f.methodName || 'anonymous'} (${f.file}:${f.lineNumber || 1}:${f.column || 1})`)
|
|
184
|
-
.join('\n');
|
|
185
|
-
notify();
|
|
186
|
-
}
|
|
187
|
-
})
|
|
188
|
-
.catch(() => { });
|
|
189
|
-
}
|
|
190
|
-
// Asynchronously symbolicate stack trace using Metro in DEV mode
|
|
191
|
-
if (stackToUse && typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
218
|
+
const stackToSymbolicate = errorStack || stackToUse || stack;
|
|
219
|
+
if (stackToSymbolicate && typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
192
220
|
const currentLogId = newLog.id;
|
|
193
|
-
symbolicateStack(
|
|
221
|
+
symbolicateStack(stackToSymbolicate)
|
|
194
222
|
.then(symFrames => {
|
|
195
223
|
if (symFrames && Array.isArray(symFrames) && symFrames.length > 0) {
|
|
196
224
|
const symLines = [];
|
|
@@ -200,19 +228,30 @@ const addLog = (type, args, sourceMethod) => {
|
|
|
200
228
|
const method = frame.methodName || '<anonymous>';
|
|
201
229
|
const line = frame.lineNumber != null ? `:${frame.lineNumber}` : '';
|
|
202
230
|
const col = frame.column != null ? `:${frame.column}` : '';
|
|
231
|
+
// Skip logger internal frames
|
|
232
|
+
const isInternal = file.includes('customHooks/consoleLogger') ||
|
|
233
|
+
file.includes('setupConsoleLogger') ||
|
|
234
|
+
file.includes('getStackDetails') ||
|
|
235
|
+
file.includes('react-native-inapp-inspector/dist') ||
|
|
236
|
+
file.includes('react-native-inapp-inspector/src') ||
|
|
237
|
+
method === 'getStackDetails' ||
|
|
238
|
+
method === 'addLog' ||
|
|
239
|
+
(method === 'log' && file.includes('consoleLogger'));
|
|
240
|
+
if (isInternal) {
|
|
241
|
+
continue;
|
|
242
|
+
}
|
|
203
243
|
const lineStr = `at ${method} (${file}${line}${col})`;
|
|
204
244
|
symLines.push(lineStr);
|
|
205
245
|
const isUserFile = file &&
|
|
206
246
|
!file.includes('node_modules') &&
|
|
207
247
|
!file.includes('react-native/') &&
|
|
208
|
-
!file.includes('consoleLogger') &&
|
|
209
|
-
!file.includes('setupConsoleLogger') &&
|
|
210
248
|
(file.endsWith('.tsx') ||
|
|
211
249
|
file.endsWith('.jsx') ||
|
|
212
250
|
file.endsWith('.ts') ||
|
|
213
251
|
file.endsWith('.js'));
|
|
214
252
|
if (!symUserCaller && isUserFile) {
|
|
215
|
-
|
|
253
|
+
const cleanFile = file.split('/').pop() || file;
|
|
254
|
+
symUserCaller = `${method} (${cleanFile}${line}${col})`;
|
|
216
255
|
}
|
|
217
256
|
}
|
|
218
257
|
const targetLog = logs.find(l => l.id === currentLogId);
|
|
@@ -241,6 +280,43 @@ const addLog = (type, args, sourceMethod) => {
|
|
|
241
280
|
}
|
|
242
281
|
};
|
|
243
282
|
// ─── Public API ───────────────────────────────────────────────────────────────
|
|
283
|
+
export const addLogFromCrash = (error, message, stack, isFatal) => {
|
|
284
|
+
const { caller, errorStack } = getStackDetails([error]);
|
|
285
|
+
const newLog = {
|
|
286
|
+
id: counter++,
|
|
287
|
+
type: 'error',
|
|
288
|
+
message: message || (error?.message ?? 'Runtime Crash'),
|
|
289
|
+
timestamp: Date.now(),
|
|
290
|
+
caller: caller !== 'Unknown'
|
|
291
|
+
? caller
|
|
292
|
+
: isFatal
|
|
293
|
+
? 'Fatal Crash'
|
|
294
|
+
: 'Unhandled Exception',
|
|
295
|
+
stack: stack || error?.stack || errorStack,
|
|
296
|
+
errorStack: stack || error?.stack,
|
|
297
|
+
rawArgs: [error],
|
|
298
|
+
sourceMethod: 'error',
|
|
299
|
+
};
|
|
300
|
+
logs.unshift(newLog);
|
|
301
|
+
logs = logs.slice(0, MAX_LOGS);
|
|
302
|
+
notify();
|
|
303
|
+
const stackToSym = stack || error?.stack || errorStack;
|
|
304
|
+
if (stackToSym && typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
305
|
+
symbolicateStack(stackToSym)
|
|
306
|
+
.then(symFrames => {
|
|
307
|
+
if (symFrames && Array.isArray(symFrames) && symFrames.length > 0) {
|
|
308
|
+
const symLines = symFrames.map(f => `at ${f.methodName || '<anonymous>'} (${(f.file || '').replace(/^webpack:\/\/\/?/, '')}:${f.lineNumber ?? 0}:${f.column ?? 0})`);
|
|
309
|
+
const target = logs.find(l => l.id === newLog.id);
|
|
310
|
+
if (target) {
|
|
311
|
+
target.stack = symLines.join('\n');
|
|
312
|
+
notify();
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
})
|
|
316
|
+
.catch(() => { });
|
|
317
|
+
}
|
|
318
|
+
return newLog;
|
|
319
|
+
};
|
|
244
320
|
export const subscribeConsoleLogs = (callback) => {
|
|
245
321
|
listeners.push(callback);
|
|
246
322
|
callback([...logs]);
|
|
@@ -264,23 +340,48 @@ export const setupConsoleLogger = () => {
|
|
|
264
340
|
};
|
|
265
341
|
// Intercept console.log
|
|
266
342
|
console.log = (...args) => {
|
|
267
|
-
|
|
343
|
+
try {
|
|
344
|
+
addLog('info', args, 'log');
|
|
345
|
+
}
|
|
346
|
+
catch { }
|
|
268
347
|
originalConsole.log(...args);
|
|
269
348
|
};
|
|
270
349
|
// Intercept console.info
|
|
271
350
|
console.info = (...args) => {
|
|
272
|
-
|
|
351
|
+
try {
|
|
352
|
+
addLog('info', args, 'info');
|
|
353
|
+
}
|
|
354
|
+
catch { }
|
|
273
355
|
originalConsole.info(...args);
|
|
274
356
|
};
|
|
275
357
|
// Intercept console.warn
|
|
276
358
|
console.warn = (...args) => {
|
|
277
|
-
|
|
359
|
+
try {
|
|
360
|
+
addLog('warn', args, 'warn');
|
|
361
|
+
}
|
|
362
|
+
catch { }
|
|
278
363
|
originalConsole.warn(...args);
|
|
279
364
|
};
|
|
280
365
|
// Intercept console.error
|
|
281
366
|
console.error = (...args) => {
|
|
282
|
-
|
|
283
|
-
|
|
367
|
+
try {
|
|
368
|
+
addLog('error', args, 'error');
|
|
369
|
+
}
|
|
370
|
+
catch { }
|
|
371
|
+
const firstArg = args && args[0];
|
|
372
|
+
const isRenderError = typeof firstArg === 'string' &&
|
|
373
|
+
(firstArg.includes('The above error occurred in') ||
|
|
374
|
+
firstArg.includes('Render Error') ||
|
|
375
|
+
firstArg.includes('ReferenceError') ||
|
|
376
|
+
firstArg.includes('TypeError'));
|
|
377
|
+
// Suppress console.error if it's a React render crash to prevent RedBox dialog
|
|
378
|
+
if (!isRenderError) {
|
|
379
|
+
originalConsole.error(...args);
|
|
380
|
+
}
|
|
284
381
|
};
|
|
382
|
+
try {
|
|
383
|
+
setupGlobalCrashHandler();
|
|
384
|
+
}
|
|
385
|
+
catch { }
|
|
285
386
|
globalThis.__CONSOLE_LOGGER_INITIALIZED__ = true;
|
|
286
387
|
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { CrashRecord, ParsedStackFrame, CrashBreadcrumb } from '../types';
|
|
2
|
+
import { CrashExportFormat, CrashType } from '../types/enums';
|
|
3
|
+
export interface CrashEventPayload {
|
|
4
|
+
error: Error | any;
|
|
5
|
+
isFatal?: boolean;
|
|
6
|
+
message: string;
|
|
7
|
+
stack?: string;
|
|
8
|
+
timestamp: number;
|
|
9
|
+
logId?: number;
|
|
10
|
+
crashRecord?: CrashRecord;
|
|
11
|
+
}
|
|
12
|
+
export { CrashExportFormat };
|
|
13
|
+
type CrashListener = (payload: CrashEventPayload) => void;
|
|
14
|
+
export declare const setMaxCrashLogsLimit: (max: number) => void;
|
|
15
|
+
export declare const addCrashBreadcrumb: (type: CrashBreadcrumb["type"], message: string, data?: any) => void;
|
|
16
|
+
export declare const recordNavigationBreadcrumb: (fromRoute: string, toRoute: string) => void;
|
|
17
|
+
export declare const recordNetworkBreadcrumb: (url: string, method: string, status?: number, duration?: number) => void;
|
|
18
|
+
export declare const recordReduxBreadcrumb: (actionType: string, payload?: any) => void;
|
|
19
|
+
export declare const recordUserActionBreadcrumb: (action: string, metadata?: any) => void;
|
|
20
|
+
export declare const clearCrashBreadcrumbs: () => void;
|
|
21
|
+
export declare const getCrashBreadcrumbs: () => CrashBreadcrumb[];
|
|
22
|
+
/**
|
|
23
|
+
* Intelligent stack trace parser with multi-engine support:
|
|
24
|
+
* - Hermes bytecode & source maps
|
|
25
|
+
* - Android Java / Kotlin native frames
|
|
26
|
+
* - iOS Objective-C / Swift symbols
|
|
27
|
+
* - JavaScript standard V8 & SpiderMonkey
|
|
28
|
+
*/
|
|
29
|
+
export declare const parseCrashStackTrace: (stack?: string) => ParsedStackFrame[];
|
|
30
|
+
/**
|
|
31
|
+
* Computes a unique fingerprint signature to group recurring crash occurrences.
|
|
32
|
+
*/
|
|
33
|
+
export declare const computeCrashFingerprint: (crash: CrashRecord) => string;
|
|
34
|
+
export declare const getCrashRecords: () => CrashRecord[];
|
|
35
|
+
export declare const clearCrashRecords: () => void;
|
|
36
|
+
export declare const subscribeCrashEvents: (listener: CrashListener) => (() => void);
|
|
37
|
+
export declare const emitCrashEvent: (payload: CrashEventPayload) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Core exception interceptor. Ingests all forms of errors, parses call stacks,
|
|
40
|
+
* collects device telemetry, records breadcrumbs, and updates the store.
|
|
41
|
+
*/
|
|
42
|
+
export declare const handleInterceptedCrash: (errorOrTitle: any, rawStack?: any, isFatal?: boolean, customType?: CrashType, componentStack?: string) => CrashRecord;
|
|
43
|
+
/**
|
|
44
|
+
* Manually report a caught error with custom metadata.
|
|
45
|
+
*/
|
|
46
|
+
export declare const recordCustomCrash: (error: Error | string, options?: {
|
|
47
|
+
isFatal?: boolean;
|
|
48
|
+
type?: CrashType;
|
|
49
|
+
componentStack?: string;
|
|
50
|
+
}) => CrashRecord;
|
|
51
|
+
/**
|
|
52
|
+
* Simulates a crash for developer testing without crashing the host app.
|
|
53
|
+
* Uses real runtime Error objects — no mocked file paths or fake stacks.
|
|
54
|
+
*/
|
|
55
|
+
export declare const simulateTestCrash: (type?: CrashType, customMessage?: string, customStack?: string) => CrashRecord;
|
|
56
|
+
/**
|
|
57
|
+
* Formats a crash into Text, Markdown, or JSON.
|
|
58
|
+
*/
|
|
59
|
+
export declare const exportCrashReport: (crash: CrashRecord, format?: CrashExportFormat) => string;
|
|
60
|
+
/**
|
|
61
|
+
* Natively intercepts and prevents crashes, native RedBox dialogues,
|
|
62
|
+
* unhandled JS errors, and unhandled promise rejections.
|
|
63
|
+
*/
|
|
64
|
+
export declare const setupGlobalCrashHandler: () => void;
|