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,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setupConsoleLogger = exports.getConsoleLogs = exports.clearConsoleLogs = exports.subscribeConsoleLogs = void 0;
|
|
3
|
+
exports.setupConsoleLogger = exports.getConsoleLogs = exports.clearConsoleLogs = exports.subscribeConsoleLogs = exports.addLogFromCrash = void 0;
|
|
4
|
+
const react_native_1 = require("react-native");
|
|
4
5
|
const logFilters_1 = require("./logFilters");
|
|
6
|
+
const crashHandler_1 = require("./crashHandler");
|
|
5
7
|
let logs = [];
|
|
6
8
|
let listeners = [];
|
|
7
9
|
let counter = 0;
|
|
@@ -27,12 +29,25 @@ const formatArgs = (args) => {
|
|
|
27
29
|
})
|
|
28
30
|
.join(' ');
|
|
29
31
|
};
|
|
30
|
-
// ─── Symbolication Helper for React Native Metro
|
|
32
|
+
// ─── Dynamic Symbolication Helper for React Native Metro ────────────────────
|
|
33
|
+
const getMetroSymbolicateUrl = () => {
|
|
34
|
+
try {
|
|
35
|
+
const scriptURL = react_native_1.NativeModules.SourceCode?.scriptURL;
|
|
36
|
+
if (typeof scriptURL === 'string') {
|
|
37
|
+
const match = scriptURL.match(/^(https?:\/\/[^\/]+)/);
|
|
38
|
+
if (match) {
|
|
39
|
+
return `${match[1]}/symbolicate`;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch { }
|
|
44
|
+
return 'http://localhost:8081/symbolicate';
|
|
45
|
+
};
|
|
31
46
|
const symbolicateStack = async (stackString) => {
|
|
32
|
-
if (typeof __DEV__ === 'undefined' || !__DEV__)
|
|
47
|
+
if (typeof __DEV__ === 'undefined' || !__DEV__ || !stackString)
|
|
33
48
|
return null;
|
|
49
|
+
// 1. Try React Native built-in symbolicateStackTrace if available
|
|
34
50
|
try {
|
|
35
|
-
// 1. Try React Native's built-in symbolicateStackTrace if available
|
|
36
51
|
let symModule = null;
|
|
37
52
|
try {
|
|
38
53
|
// @ts-ignore
|
|
@@ -42,24 +57,61 @@ const symbolicateStack = async (stackString) => {
|
|
|
42
57
|
const symFn = symModule?.default || symModule;
|
|
43
58
|
if (typeof symFn === 'function') {
|
|
44
59
|
const res = await symFn(stackString);
|
|
45
|
-
if (res && Array.isArray(res.stack)) {
|
|
60
|
+
if (res && Array.isArray(res.stack) && res.stack.length > 0) {
|
|
46
61
|
return res.stack;
|
|
47
62
|
}
|
|
48
63
|
}
|
|
49
64
|
}
|
|
50
65
|
catch { }
|
|
66
|
+
// 2. Direct HTTP symbolication to dynamic Metro packager endpoint
|
|
51
67
|
try {
|
|
52
|
-
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
68
|
+
const metroUrl = getMetroSymbolicateUrl();
|
|
69
|
+
const scriptURL = react_native_1.NativeModules.SourceCode?.scriptURL || 'http://localhost:8081/index.bundle?platform=ios&dev=true';
|
|
70
|
+
// Parse Hermes stack string into frame objects for Metro symbolicate endpoint
|
|
71
|
+
const lines = stackString.split('\n');
|
|
72
|
+
const inputFrames = [];
|
|
73
|
+
for (const rawLine of lines) {
|
|
74
|
+
const line = rawLine.trim().replace(/^at /, '');
|
|
75
|
+
if (!line)
|
|
76
|
+
continue;
|
|
77
|
+
let methodName = '<anonymous>';
|
|
78
|
+
let locationPart = line;
|
|
79
|
+
const parenMatch = line.match(/^(.*?)\s*\((.*?)\)$/);
|
|
80
|
+
if (parenMatch) {
|
|
81
|
+
methodName = parenMatch[1].trim() || '<anonymous>';
|
|
82
|
+
locationPart = parenMatch[2].trim();
|
|
83
|
+
}
|
|
84
|
+
else if (line.includes('@')) {
|
|
85
|
+
const atIdx = line.indexOf('@');
|
|
86
|
+
methodName = line.substring(0, atIdx).trim() || '<anonymous>';
|
|
87
|
+
locationPart = line.substring(atIdx + 1).trim();
|
|
88
|
+
}
|
|
89
|
+
locationPart = locationPart.replace(/^address at /, '');
|
|
90
|
+
const locMatch = locationPart.match(/^(.*?):(\d+):(\d+)$/);
|
|
91
|
+
if (locMatch) {
|
|
92
|
+
let file = locMatch[1];
|
|
93
|
+
if (!file.startsWith('http') && file !== 'native' && !file.includes('InternalBytecode')) {
|
|
94
|
+
file = scriptURL;
|
|
95
|
+
}
|
|
96
|
+
inputFrames.push({
|
|
97
|
+
file,
|
|
98
|
+
lineNumber: parseInt(locMatch[2], 10),
|
|
99
|
+
column: parseInt(locMatch[3], 10),
|
|
100
|
+
methodName,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (inputFrames.length > 0) {
|
|
105
|
+
const response = await fetch(metroUrl, {
|
|
106
|
+
method: 'POST',
|
|
107
|
+
headers: { 'Content-Type': 'application/json' },
|
|
108
|
+
body: JSON.stringify({ stack: inputFrames }),
|
|
109
|
+
});
|
|
110
|
+
if (response.ok) {
|
|
111
|
+
const json = await response.json();
|
|
112
|
+
if (json && Array.isArray(json.stack) && json.stack.length > 0) {
|
|
113
|
+
return json.stack;
|
|
114
|
+
}
|
|
63
115
|
}
|
|
64
116
|
}
|
|
65
117
|
}
|
|
@@ -166,34 +218,10 @@ const addLog = (type, args, sourceMethod) => {
|
|
|
166
218
|
logs = logs.slice(0, MAX_LOGS);
|
|
167
219
|
notify();
|
|
168
220
|
// Asynchronously symbolicate stack trace via Metro in development
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
.then(symbolicatedFrames => {
|
|
172
|
-
if (symbolicatedFrames && symbolicatedFrames.length > 0) {
|
|
173
|
-
const validFrames = symbolicatedFrames.filter(f => f.file &&
|
|
174
|
-
!f.file.includes('react-native/Libraries') &&
|
|
175
|
-
!f.file.includes('node_modules') &&
|
|
176
|
-
!isLoggerInternal(f.file) &&
|
|
177
|
-
!isLoggerInternal(f.methodName || ''));
|
|
178
|
-
const topFrame = validFrames[0] || symbolicatedFrames[0];
|
|
179
|
-
if (topFrame) {
|
|
180
|
-
const cleanMethod = topFrame.methodName || 'anonymous';
|
|
181
|
-
const cleanFile = topFrame.file.split('/').pop() || topFrame.file;
|
|
182
|
-
newLog.caller = `${cleanMethod} (${cleanFile}:${topFrame.lineNumber || 1}:${topFrame.column || 1})`;
|
|
183
|
-
}
|
|
184
|
-
newLog.stack = symbolicatedFrames
|
|
185
|
-
.filter(f => !isLoggerInternal(f.file || '') && !isLoggerInternal(f.methodName || ''))
|
|
186
|
-
.map(f => ` at ${f.methodName || 'anonymous'} (${f.file}:${f.lineNumber || 1}:${f.column || 1})`)
|
|
187
|
-
.join('\n');
|
|
188
|
-
notify();
|
|
189
|
-
}
|
|
190
|
-
})
|
|
191
|
-
.catch(() => { });
|
|
192
|
-
}
|
|
193
|
-
// Asynchronously symbolicate stack trace using Metro in DEV mode
|
|
194
|
-
if (stackToUse && typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
221
|
+
const stackToSymbolicate = errorStack || stackToUse || stack;
|
|
222
|
+
if (stackToSymbolicate && typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
195
223
|
const currentLogId = newLog.id;
|
|
196
|
-
symbolicateStack(
|
|
224
|
+
symbolicateStack(stackToSymbolicate)
|
|
197
225
|
.then(symFrames => {
|
|
198
226
|
if (symFrames && Array.isArray(symFrames) && symFrames.length > 0) {
|
|
199
227
|
const symLines = [];
|
|
@@ -203,19 +231,30 @@ const addLog = (type, args, sourceMethod) => {
|
|
|
203
231
|
const method = frame.methodName || '<anonymous>';
|
|
204
232
|
const line = frame.lineNumber != null ? `:${frame.lineNumber}` : '';
|
|
205
233
|
const col = frame.column != null ? `:${frame.column}` : '';
|
|
234
|
+
// Skip logger internal frames
|
|
235
|
+
const isInternal = file.includes('customHooks/consoleLogger') ||
|
|
236
|
+
file.includes('setupConsoleLogger') ||
|
|
237
|
+
file.includes('getStackDetails') ||
|
|
238
|
+
file.includes('react-native-inapp-inspector/dist') ||
|
|
239
|
+
file.includes('react-native-inapp-inspector/src') ||
|
|
240
|
+
method === 'getStackDetails' ||
|
|
241
|
+
method === 'addLog' ||
|
|
242
|
+
(method === 'log' && file.includes('consoleLogger'));
|
|
243
|
+
if (isInternal) {
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
206
246
|
const lineStr = `at ${method} (${file}${line}${col})`;
|
|
207
247
|
symLines.push(lineStr);
|
|
208
248
|
const isUserFile = file &&
|
|
209
249
|
!file.includes('node_modules') &&
|
|
210
250
|
!file.includes('react-native/') &&
|
|
211
|
-
!file.includes('consoleLogger') &&
|
|
212
|
-
!file.includes('setupConsoleLogger') &&
|
|
213
251
|
(file.endsWith('.tsx') ||
|
|
214
252
|
file.endsWith('.jsx') ||
|
|
215
253
|
file.endsWith('.ts') ||
|
|
216
254
|
file.endsWith('.js'));
|
|
217
255
|
if (!symUserCaller && isUserFile) {
|
|
218
|
-
|
|
256
|
+
const cleanFile = file.split('/').pop() || file;
|
|
257
|
+
symUserCaller = `${method} (${cleanFile}${line}${col})`;
|
|
219
258
|
}
|
|
220
259
|
}
|
|
221
260
|
const targetLog = logs.find(l => l.id === currentLogId);
|
|
@@ -244,6 +283,44 @@ const addLog = (type, args, sourceMethod) => {
|
|
|
244
283
|
}
|
|
245
284
|
};
|
|
246
285
|
// ─── Public API ───────────────────────────────────────────────────────────────
|
|
286
|
+
const addLogFromCrash = (error, message, stack, isFatal) => {
|
|
287
|
+
const { caller, errorStack } = getStackDetails([error]);
|
|
288
|
+
const newLog = {
|
|
289
|
+
id: counter++,
|
|
290
|
+
type: 'error',
|
|
291
|
+
message: message || (error?.message ?? 'Runtime Crash'),
|
|
292
|
+
timestamp: Date.now(),
|
|
293
|
+
caller: caller !== 'Unknown'
|
|
294
|
+
? caller
|
|
295
|
+
: isFatal
|
|
296
|
+
? 'Fatal Crash'
|
|
297
|
+
: 'Unhandled Exception',
|
|
298
|
+
stack: stack || error?.stack || errorStack,
|
|
299
|
+
errorStack: stack || error?.stack,
|
|
300
|
+
rawArgs: [error],
|
|
301
|
+
sourceMethod: 'error',
|
|
302
|
+
};
|
|
303
|
+
logs.unshift(newLog);
|
|
304
|
+
logs = logs.slice(0, MAX_LOGS);
|
|
305
|
+
notify();
|
|
306
|
+
const stackToSym = stack || error?.stack || errorStack;
|
|
307
|
+
if (stackToSym && typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
308
|
+
symbolicateStack(stackToSym)
|
|
309
|
+
.then(symFrames => {
|
|
310
|
+
if (symFrames && Array.isArray(symFrames) && symFrames.length > 0) {
|
|
311
|
+
const symLines = symFrames.map(f => `at ${f.methodName || '<anonymous>'} (${(f.file || '').replace(/^webpack:\/\/\/?/, '')}:${f.lineNumber ?? 0}:${f.column ?? 0})`);
|
|
312
|
+
const target = logs.find(l => l.id === newLog.id);
|
|
313
|
+
if (target) {
|
|
314
|
+
target.stack = symLines.join('\n');
|
|
315
|
+
notify();
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
})
|
|
319
|
+
.catch(() => { });
|
|
320
|
+
}
|
|
321
|
+
return newLog;
|
|
322
|
+
};
|
|
323
|
+
exports.addLogFromCrash = addLogFromCrash;
|
|
247
324
|
const subscribeConsoleLogs = (callback) => {
|
|
248
325
|
listeners.push(callback);
|
|
249
326
|
callback([...logs]);
|
|
@@ -270,24 +347,49 @@ const setupConsoleLogger = () => {
|
|
|
270
347
|
};
|
|
271
348
|
// Intercept console.log
|
|
272
349
|
console.log = (...args) => {
|
|
273
|
-
|
|
350
|
+
try {
|
|
351
|
+
addLog('info', args, 'log');
|
|
352
|
+
}
|
|
353
|
+
catch { }
|
|
274
354
|
originalConsole.log(...args);
|
|
275
355
|
};
|
|
276
356
|
// Intercept console.info
|
|
277
357
|
console.info = (...args) => {
|
|
278
|
-
|
|
358
|
+
try {
|
|
359
|
+
addLog('info', args, 'info');
|
|
360
|
+
}
|
|
361
|
+
catch { }
|
|
279
362
|
originalConsole.info(...args);
|
|
280
363
|
};
|
|
281
364
|
// Intercept console.warn
|
|
282
365
|
console.warn = (...args) => {
|
|
283
|
-
|
|
366
|
+
try {
|
|
367
|
+
addLog('warn', args, 'warn');
|
|
368
|
+
}
|
|
369
|
+
catch { }
|
|
284
370
|
originalConsole.warn(...args);
|
|
285
371
|
};
|
|
286
372
|
// Intercept console.error
|
|
287
373
|
console.error = (...args) => {
|
|
288
|
-
|
|
289
|
-
|
|
374
|
+
try {
|
|
375
|
+
addLog('error', args, 'error');
|
|
376
|
+
}
|
|
377
|
+
catch { }
|
|
378
|
+
const firstArg = args && args[0];
|
|
379
|
+
const isRenderError = typeof firstArg === 'string' &&
|
|
380
|
+
(firstArg.includes('The above error occurred in') ||
|
|
381
|
+
firstArg.includes('Render Error') ||
|
|
382
|
+
firstArg.includes('ReferenceError') ||
|
|
383
|
+
firstArg.includes('TypeError'));
|
|
384
|
+
// Suppress console.error if it's a React render crash to prevent RedBox dialog
|
|
385
|
+
if (!isRenderError) {
|
|
386
|
+
originalConsole.error(...args);
|
|
387
|
+
}
|
|
290
388
|
};
|
|
389
|
+
try {
|
|
390
|
+
(0, crashHandler_1.setupGlobalCrashHandler)();
|
|
391
|
+
}
|
|
392
|
+
catch { }
|
|
291
393
|
globalThis.__CONSOLE_LOGGER_INITIALIZED__ = true;
|
|
292
394
|
};
|
|
293
395
|
exports.setupConsoleLogger = setupConsoleLogger;
|
|
@@ -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;
|