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.
- package/dist/commonjs/analytics.d.ts +0 -4
- package/dist/commonjs/analytics.js +0 -4
- package/dist/commonjs/bundle.d.ts +0 -4
- package/dist/commonjs/bundle.js +0 -4
- package/dist/commonjs/components/AnalyticsDetail.js +18 -27
- package/dist/commonjs/components/AnalyticsEventCard.js +9 -12
- package/dist/commonjs/components/AnalyticsGraph.js +10 -15
- package/dist/commonjs/components/AppHeaderLogo.js +0 -3
- package/dist/commonjs/components/BrandCircleIcon.js +15 -15
- package/dist/commonjs/components/BrandSquareIcon.js +20 -20
- package/dist/commonjs/components/CodeSnippet.js +6 -19
- package/dist/commonjs/components/ConsoleLogCard.js +0 -1
- package/dist/commonjs/components/CopyButton.js +0 -4
- package/dist/commonjs/components/DiffViewer.js +0 -2
- package/dist/commonjs/components/DomainHeader.js +0 -4
- package/dist/commonjs/components/EmptyState.js +0 -3
- package/dist/commonjs/components/ErrorBoundary.js +5 -10
- package/dist/commonjs/components/HeadersSection.js +0 -5
- package/dist/commonjs/components/HighlightText.js +1 -4
- package/dist/commonjs/components/Inspector/AnalyticsFilterModal.js +11 -26
- package/dist/commonjs/components/Inspector/AnalyticsTab.js +34 -40
- package/dist/commonjs/components/Inspector/BundleTab.js +56 -84
- package/dist/commonjs/components/Inspector/ConsoleTab.js +7 -7
- package/dist/commonjs/components/Inspector/CrashDetail.js +18 -20
- package/dist/commonjs/components/Inspector/CrashFilterModal.js +0 -1
- package/dist/commonjs/components/Inspector/CrashTab.js +11 -20
- package/dist/commonjs/components/Inspector/DeviceInfoTab.js +12 -24
- package/dist/commonjs/components/Inspector/FabLauncher.js +1 -1
- package/dist/commonjs/components/Inspector/InspectorContext.js +0 -2
- package/dist/commonjs/components/Inspector/InspectorHeader.js +7 -8
- package/dist/commonjs/components/Inspector/LogDetail.js +27 -29
- package/dist/commonjs/components/Inspector/MainScreen.js +9 -10
- package/dist/commonjs/components/Inspector/NetworkDetail.js +10 -11
- package/dist/commonjs/components/Inspector/NetworkTab.js +14 -14
- package/dist/commonjs/components/Inspector/NpmUpdateToast.js +6 -9
- package/dist/commonjs/components/Inspector/PerformanceTab.js +30 -43
- package/dist/commonjs/components/Inspector/ReduxDetail.js +18 -34
- package/dist/commonjs/components/Inspector/ReduxTab.js +11 -20
- package/dist/commonjs/components/Inspector/SettingsPanel.js +32 -36
- package/dist/commonjs/components/Inspector/SkeletonPlaceholder.js +6 -6
- package/dist/commonjs/components/Inspector/StorageTab.js +14 -26
- package/dist/commonjs/components/Inspector/UpdateAvailableModal.js +5 -6
- package/dist/commonjs/components/JsonViewer.js +3 -10
- package/dist/commonjs/components/LogCard.js +7 -7
- package/dist/commonjs/components/MetaAccordion.js +1 -7
- package/dist/commonjs/components/NetworkIcons.js +12 -16
- package/dist/commonjs/components/SectionHeader.js +0 -4
- package/dist/commonjs/components/SkeletonPlaceholder.js +6 -6
- package/dist/commonjs/components/Slider.js +6 -6
- package/dist/commonjs/components/SourcePageCard.js +0 -4
- package/dist/commonjs/components/TreeNode.js +0 -4
- package/dist/commonjs/console.d.ts +0 -4
- package/dist/commonjs/console.js +0 -4
- package/dist/commonjs/constants/index.js +6 -9
- package/dist/commonjs/constants/telemetryConfig.d.ts +7 -0
- package/dist/commonjs/constants/telemetryConfig.js +10 -0
- package/dist/commonjs/constants/version.d.ts +1 -1
- package/dist/commonjs/constants/version.js +1 -3
- package/dist/commonjs/crash.d.ts +0 -4
- package/dist/commonjs/crash.js +0 -4
- package/dist/commonjs/customHooks/analyticsLogger.d.ts +0 -7
- package/dist/commonjs/customHooks/analyticsLogger.js +3 -59
- package/dist/commonjs/customHooks/bundleAnalyzer.d.ts +0 -9
- package/dist/commonjs/customHooks/bundleAnalyzer.js +3 -86
- package/dist/commonjs/customHooks/consoleLogger.js +0 -16
- package/dist/commonjs/customHooks/crashHandler.d.ts +0 -28
- package/dist/commonjs/customHooks/crashHandler.js +0 -55
- package/dist/commonjs/customHooks/logFilters.d.ts +0 -4
- package/dist/commonjs/customHooks/logFilters.js +0 -11
- package/dist/commonjs/customHooks/networkLogger.js +2 -13
- package/dist/commonjs/customHooks/performanceTracker.d.ts +0 -27
- package/dist/commonjs/customHooks/performanceTracker.js +0 -31
- package/dist/commonjs/customHooks/reduxLogger.d.ts +0 -12
- package/dist/commonjs/customHooks/reduxLogger.js +0 -51
- package/dist/commonjs/customHooks/storageInspector.d.ts +0 -40
- package/dist/commonjs/customHooks/storageInspector.js +1 -56
- package/dist/commonjs/decorators/index.d.ts +0 -37
- package/dist/commonjs/decorators/index.js +0 -42
- package/dist/commonjs/helpers/gaAnalyticsRegistry.d.ts +0 -10
- package/dist/commonjs/helpers/gaAnalyticsRegistry.js +0 -26
- package/dist/commonjs/helpers/index.d.ts +0 -7
- package/dist/commonjs/helpers/index.js +1 -42
- package/dist/commonjs/helpers/memoryManager.d.ts +0 -11
- package/dist/commonjs/helpers/memoryManager.js +0 -13
- package/dist/commonjs/helpers/searchQueryParser.d.ts +0 -4
- package/dist/commonjs/helpers/searchQueryParser.js +0 -18
- package/dist/commonjs/helpers/settingsStore.js +0 -8
- package/dist/commonjs/helpers/telemetry.d.ts +2 -0
- package/dist/commonjs/helpers/telemetry.js +302 -0
- package/dist/commonjs/i18n/index.d.ts +0 -9
- package/dist/commonjs/i18n/index.js +0 -15
- package/dist/commonjs/index.js +15 -97
- package/dist/commonjs/native/NativeInspector.d.ts +0 -54
- package/dist/commonjs/native/NativeInspector.js +0 -56
- package/dist/commonjs/network.d.ts +0 -4
- package/dist/commonjs/network.js +0 -4
- package/dist/commonjs/performance.d.ts +0 -4
- package/dist/commonjs/performance.js +0 -4
- package/dist/commonjs/redux.d.ts +0 -4
- package/dist/commonjs/redux.js +0 -4
- package/dist/commonjs/storage.d.ts +0 -4
- package/dist/commonjs/storage.js +0 -4
- package/dist/commonjs/styles/AppColors.d.ts +0 -3
- package/dist/commonjs/styles/AppColors.js +15 -30
- package/dist/commonjs/styles/AppFonts.d.ts +0 -4
- package/dist/commonjs/styles/AppFonts.js +0 -4
- package/dist/commonjs/styles/common.js +0 -11
- package/dist/commonjs/styles/index.js +0 -8
- package/dist/commonjs/types/enums.js +0 -3
- package/dist/commonjs/types/interfaces.d.ts +3 -3
- package/dist/esm/analytics.d.ts +0 -4
- package/dist/esm/analytics.js +0 -4
- package/dist/esm/bundle.d.ts +0 -4
- package/dist/esm/bundle.js +0 -4
- package/dist/esm/components/AnalyticsDetail.js +18 -27
- package/dist/esm/components/AnalyticsEventCard.js +9 -12
- package/dist/esm/components/AnalyticsGraph.js +10 -15
- package/dist/esm/components/AppHeaderLogo.js +0 -3
- package/dist/esm/components/BrandCircleIcon.js +15 -15
- package/dist/esm/components/BrandSquareIcon.js +20 -20
- package/dist/esm/components/CodeSnippet.js +6 -19
- package/dist/esm/components/ConsoleLogCard.js +0 -1
- package/dist/esm/components/CopyButton.js +0 -4
- package/dist/esm/components/DiffViewer.js +0 -2
- package/dist/esm/components/DomainHeader.js +0 -4
- package/dist/esm/components/EmptyState.js +0 -3
- package/dist/esm/components/ErrorBoundary.js +5 -10
- package/dist/esm/components/HeadersSection.js +0 -5
- package/dist/esm/components/HighlightText.js +1 -4
- package/dist/esm/components/Inspector/AnalyticsFilterModal.js +11 -26
- package/dist/esm/components/Inspector/AnalyticsTab.js +34 -40
- package/dist/esm/components/Inspector/BundleTab.js +56 -84
- package/dist/esm/components/Inspector/ConsoleTab.js +7 -7
- package/dist/esm/components/Inspector/CrashDetail.js +18 -20
- package/dist/esm/components/Inspector/CrashFilterModal.js +0 -1
- package/dist/esm/components/Inspector/CrashTab.js +11 -20
- package/dist/esm/components/Inspector/DeviceInfoTab.js +12 -24
- package/dist/esm/components/Inspector/FabLauncher.js +1 -1
- package/dist/esm/components/Inspector/InspectorContext.js +0 -2
- package/dist/esm/components/Inspector/InspectorHeader.js +7 -8
- package/dist/esm/components/Inspector/LogDetail.js +27 -29
- package/dist/esm/components/Inspector/MainScreen.js +9 -10
- package/dist/esm/components/Inspector/NetworkDetail.js +10 -11
- package/dist/esm/components/Inspector/NetworkTab.js +14 -14
- package/dist/esm/components/Inspector/NpmUpdateToast.js +6 -9
- package/dist/esm/components/Inspector/PerformanceTab.js +30 -43
- package/dist/esm/components/Inspector/ReduxDetail.js +18 -34
- package/dist/esm/components/Inspector/ReduxTab.js +11 -20
- package/dist/esm/components/Inspector/SettingsPanel.js +32 -36
- package/dist/esm/components/Inspector/SkeletonPlaceholder.js +6 -6
- package/dist/esm/components/Inspector/StorageTab.js +14 -26
- package/dist/esm/components/Inspector/UpdateAvailableModal.js +5 -6
- package/dist/esm/components/JsonViewer.js +3 -10
- package/dist/esm/components/LogCard.js +7 -7
- package/dist/esm/components/MetaAccordion.js +1 -7
- package/dist/esm/components/NetworkIcons.js +12 -16
- package/dist/esm/components/SectionHeader.js +0 -4
- package/dist/esm/components/SkeletonPlaceholder.js +6 -6
- package/dist/esm/components/Slider.js +6 -6
- package/dist/esm/components/SourcePageCard.js +0 -4
- package/dist/esm/components/TreeNode.js +0 -4
- package/dist/esm/console.d.ts +0 -4
- package/dist/esm/console.js +0 -4
- package/dist/esm/constants/index.js +6 -9
- package/dist/esm/constants/telemetryConfig.d.ts +7 -0
- package/dist/esm/constants/telemetryConfig.js +7 -0
- package/dist/esm/constants/version.d.ts +1 -1
- package/dist/esm/constants/version.js +1 -3
- package/dist/esm/crash.d.ts +0 -4
- package/dist/esm/crash.js +0 -4
- package/dist/esm/customHooks/analyticsLogger.d.ts +0 -7
- package/dist/esm/customHooks/analyticsLogger.js +3 -59
- package/dist/esm/customHooks/bundleAnalyzer.d.ts +0 -9
- package/dist/esm/customHooks/bundleAnalyzer.js +3 -86
- package/dist/esm/customHooks/consoleLogger.js +0 -16
- package/dist/esm/customHooks/crashHandler.d.ts +0 -28
- package/dist/esm/customHooks/crashHandler.js +0 -55
- package/dist/esm/customHooks/logFilters.d.ts +0 -4
- package/dist/esm/customHooks/logFilters.js +0 -11
- package/dist/esm/customHooks/networkLogger.js +2 -13
- package/dist/esm/customHooks/performanceTracker.d.ts +0 -27
- package/dist/esm/customHooks/performanceTracker.js +0 -31
- package/dist/esm/customHooks/reduxLogger.d.ts +0 -12
- package/dist/esm/customHooks/reduxLogger.js +0 -51
- package/dist/esm/customHooks/storageInspector.d.ts +0 -40
- package/dist/esm/customHooks/storageInspector.js +1 -56
- package/dist/esm/decorators/index.d.ts +0 -37
- package/dist/esm/decorators/index.js +0 -42
- package/dist/esm/helpers/gaAnalyticsRegistry.d.ts +0 -10
- package/dist/esm/helpers/gaAnalyticsRegistry.js +0 -26
- package/dist/esm/helpers/index.d.ts +0 -7
- package/dist/esm/helpers/index.js +1 -42
- package/dist/esm/helpers/memoryManager.d.ts +0 -11
- package/dist/esm/helpers/memoryManager.js +0 -13
- package/dist/esm/helpers/searchQueryParser.d.ts +0 -4
- package/dist/esm/helpers/searchQueryParser.js +0 -18
- package/dist/esm/helpers/settingsStore.js +0 -8
- package/dist/esm/helpers/telemetry.d.ts +2 -0
- package/dist/esm/helpers/telemetry.js +298 -0
- package/dist/esm/i18n/index.d.ts +0 -9
- package/dist/esm/i18n/index.js +0 -15
- package/dist/esm/index.js +15 -97
- package/dist/esm/native/NativeInspector.d.ts +0 -54
- package/dist/esm/native/NativeInspector.js +0 -56
- package/dist/esm/network.d.ts +0 -4
- package/dist/esm/network.js +0 -4
- package/dist/esm/performance.d.ts +0 -4
- package/dist/esm/performance.js +0 -4
- package/dist/esm/redux.d.ts +0 -4
- package/dist/esm/redux.js +0 -4
- package/dist/esm/storage.d.ts +0 -4
- package/dist/esm/storage.js +0 -4
- package/dist/esm/styles/AppColors.d.ts +0 -3
- package/dist/esm/styles/AppColors.js +15 -30
- package/dist/esm/styles/AppFonts.d.ts +0 -4
- package/dist/esm/styles/AppFonts.js +0 -4
- package/dist/esm/styles/common.js +0 -11
- package/dist/esm/styles/index.js +0 -8
- package/dist/esm/types/enums.js +0 -3
- package/dist/esm/types/interfaces.d.ts +3 -3
- package/package.json +2 -2
- package/src/constants/telemetryConfig.ts +16 -0
- package/src/constants/version.ts +1 -1
- package/src/helpers/telemetry.ts +341 -0
- package/src/index.tsx +15 -1
- package/src/types/interfaces.ts +3 -0
|
@@ -22,7 +22,6 @@ const setCrashModuleEnabled = (enabled) => {
|
|
|
22
22
|
exports.setCrashModuleEnabled = setCrashModuleEnabled;
|
|
23
23
|
const getCrashModuleEnabled = () => isCrashModuleEnabled;
|
|
24
24
|
exports.getCrashModuleEnabled = getCrashModuleEnabled;
|
|
25
|
-
// ─── BREADCRUMB MANAGERS ───────────────────────────────────────────────────────
|
|
26
25
|
const setMaxCrashLogsLimit = (max) => {
|
|
27
26
|
maxStoredCrashes = Math.max(10, max);
|
|
28
27
|
if (crashRecordsStore.length > maxStoredCrashes) {
|
|
@@ -101,14 +100,6 @@ const getCrashBreadcrumbs = () => {
|
|
|
101
100
|
return [...breadcrumbsStore];
|
|
102
101
|
};
|
|
103
102
|
exports.getCrashBreadcrumbs = getCrashBreadcrumbs;
|
|
104
|
-
// ─── STACK TRACE PARSING & INTELLIGENT SOURCE DETECTION ───────────────────────
|
|
105
|
-
/**
|
|
106
|
-
* Intelligent stack trace parser with multi-engine support:
|
|
107
|
-
* - Hermes bytecode & source maps
|
|
108
|
-
* - Android Java / Kotlin native frames
|
|
109
|
-
* - iOS Objective-C / Swift symbols
|
|
110
|
-
* - JavaScript standard V8 & SpiderMonkey
|
|
111
|
-
*/
|
|
112
103
|
const parseCrashStackTrace = (stack) => {
|
|
113
104
|
if (!stack || typeof stack !== 'string')
|
|
114
105
|
return [];
|
|
@@ -118,14 +109,12 @@ const parseCrashStackTrace = (stack) => {
|
|
|
118
109
|
const trimmed = line.trim();
|
|
119
110
|
if (!trimmed)
|
|
120
111
|
continue;
|
|
121
|
-
// Filter out internal wrapper noise
|
|
122
112
|
if (trimmed.includes('crashHandler.ts') ||
|
|
123
113
|
trimmed.includes('handleInterceptedCrash') ||
|
|
124
114
|
trimmed.includes('addLogFromCrash') ||
|
|
125
115
|
trimmed.includes('setupGlobalCrashHandler')) {
|
|
126
116
|
continue;
|
|
127
117
|
}
|
|
128
|
-
// Pattern 1: iOS/Hermes format: method@file:line:column or method@url:line:col
|
|
129
118
|
const iosMatch = trimmed.match(/^([^@]+)@(.*):(\d+):(\d+)$/);
|
|
130
119
|
if (iosMatch) {
|
|
131
120
|
const [, method, file, lineNum, colNum] = iosMatch;
|
|
@@ -145,7 +134,6 @@ const parseCrashStackTrace = (stack) => {
|
|
|
145
134
|
});
|
|
146
135
|
continue;
|
|
147
136
|
}
|
|
148
|
-
// Pattern 2: V8/Android JS format: at method (file:line:column)
|
|
149
137
|
const androidMatch = trimmed.match(/^at\s+(.+)\s+\((.+):(\d+):(\d+)\)$/);
|
|
150
138
|
if (androidMatch) {
|
|
151
139
|
const [, method, file, lineNum, colNum] = androidMatch;
|
|
@@ -164,7 +152,6 @@ const parseCrashStackTrace = (stack) => {
|
|
|
164
152
|
});
|
|
165
153
|
continue;
|
|
166
154
|
}
|
|
167
|
-
// Pattern 3: Simple at file:line:column
|
|
168
155
|
const simpleMatch = trimmed.match(/^at\s+(.+):(\d+):(\d+)$/);
|
|
169
156
|
if (simpleMatch) {
|
|
170
157
|
const [, file, lineNum, colNum] = simpleMatch;
|
|
@@ -180,7 +167,6 @@ const parseCrashStackTrace = (stack) => {
|
|
|
180
167
|
});
|
|
181
168
|
continue;
|
|
182
169
|
}
|
|
183
|
-
// Pattern 4: Java / Android Native Frame: at com.pkg.Class.method(Class.java:123)
|
|
184
170
|
const javaMatch = trimmed.match(/^at\s+([a-zA-Z0-9_$.]+)\(([a-zA-Z0-9_$]+\.java):(\d+)\)$/);
|
|
185
171
|
if (javaMatch) {
|
|
186
172
|
const [, methodPath, fileName, lineNum] = javaMatch;
|
|
@@ -196,7 +182,6 @@ const parseCrashStackTrace = (stack) => {
|
|
|
196
182
|
});
|
|
197
183
|
continue;
|
|
198
184
|
}
|
|
199
|
-
// Pattern 5: iOS Mach-O Symbol: 0 AppName 0x000000010... -[ViewController method] + 48
|
|
200
185
|
const machOMatch = trimmed.match(/^\d+\s+([^\s]+)\s+(0x[0-9a-fA-F]+)\s+(.+)$/);
|
|
201
186
|
if (machOMatch) {
|
|
202
187
|
const [, binaryName, address, symbol] = machOMatch;
|
|
@@ -213,7 +198,6 @@ const parseCrashStackTrace = (stack) => {
|
|
|
213
198
|
});
|
|
214
199
|
continue;
|
|
215
200
|
}
|
|
216
|
-
// Pattern 6: Fallback for generic frame lines
|
|
217
201
|
frames.push({
|
|
218
202
|
method: trimmed.startsWith('at ') ? trimmed.slice(3) : trimmed,
|
|
219
203
|
file: 'runtime',
|
|
@@ -226,7 +210,6 @@ const parseCrashStackTrace = (stack) => {
|
|
|
226
210
|
return frames;
|
|
227
211
|
};
|
|
228
212
|
exports.parseCrashStackTrace = parseCrashStackTrace;
|
|
229
|
-
// ─── DIAGNOSTICS & SYSTEM METRICS ─────────────────────────────────────────────
|
|
230
213
|
const getMemoryDiagnostics = () => {
|
|
231
214
|
try {
|
|
232
215
|
const performance = globalThis.performance;
|
|
@@ -249,9 +232,6 @@ const getScreenDimensions = () => {
|
|
|
249
232
|
return (0, i18n_1.t)('crash.unknown');
|
|
250
233
|
}
|
|
251
234
|
};
|
|
252
|
-
/**
|
|
253
|
-
* Computes a unique fingerprint signature to group recurring crash occurrences.
|
|
254
|
-
*/
|
|
255
235
|
const computeCrashFingerprint = (crash) => {
|
|
256
236
|
const type = crash.type || 'js';
|
|
257
237
|
const name = crash.name || 'Error';
|
|
@@ -264,7 +244,6 @@ const computeCrashFingerprint = (crash) => {
|
|
|
264
244
|
return `${type}_${name}_${location}`;
|
|
265
245
|
};
|
|
266
246
|
exports.computeCrashFingerprint = computeCrashFingerprint;
|
|
267
|
-
// ─── CRASH RECORD MANAGEMENT & INTERCEPTION ───────────────────────────────────
|
|
268
247
|
const getCrashRecords = () => {
|
|
269
248
|
return [...crashRecordsStore];
|
|
270
249
|
};
|
|
@@ -288,7 +267,6 @@ exports.subscribeCrashEvents = subscribeCrashEvents;
|
|
|
288
267
|
const emitCrashEvent = (payload) => {
|
|
289
268
|
if (payload.message !== '__CLEARED__') {
|
|
290
269
|
const now = Date.now();
|
|
291
|
-
// Throttle duplicate rapid crash emissions within 250ms
|
|
292
270
|
if (now - lastHandledErrorTimestamp < 250) {
|
|
293
271
|
return;
|
|
294
272
|
}
|
|
@@ -302,10 +280,6 @@ const emitCrashEvent = (payload) => {
|
|
|
302
280
|
});
|
|
303
281
|
};
|
|
304
282
|
exports.emitCrashEvent = emitCrashEvent;
|
|
305
|
-
/**
|
|
306
|
-
* Core exception interceptor. Ingests all forms of errors, parses call stacks,
|
|
307
|
-
* collects device telemetry, records breadcrumbs, and updates the store.
|
|
308
|
-
*/
|
|
309
283
|
const handleInterceptedCrash = (errorOrTitle, rawStack, isFatal = false, customType, componentStack) => {
|
|
310
284
|
try {
|
|
311
285
|
const errorObj = errorOrTitle instanceof Error
|
|
@@ -327,7 +301,6 @@ const handleInterceptedCrash = (errorOrTitle, rawStack, isFatal = false, customT
|
|
|
327
301
|
else {
|
|
328
302
|
stackString = errorObj.stack || new Error().stack || '';
|
|
329
303
|
}
|
|
330
|
-
// Determine Crash Type
|
|
331
304
|
let inferredType = customType || enums_1.CrashType.Js;
|
|
332
305
|
const lowMsg = rawMsg.toLowerCase();
|
|
333
306
|
if (!customType) {
|
|
@@ -399,7 +372,6 @@ const handleInterceptedCrash = (errorOrTitle, rawStack, isFatal = false, customT
|
|
|
399
372
|
logId: log?.id,
|
|
400
373
|
crashRecord,
|
|
401
374
|
});
|
|
402
|
-
// Ensure native floating icon is visible & badged even if React UI is broken
|
|
403
375
|
try {
|
|
404
376
|
(0, NativeInspector_1.showNativeFloatingButton)();
|
|
405
377
|
(0, NativeInspector_1.setNativeFloatingButtonBadge)(true);
|
|
@@ -421,23 +393,15 @@ const handleInterceptedCrash = (errorOrTitle, rawStack, isFatal = false, customT
|
|
|
421
393
|
}
|
|
422
394
|
};
|
|
423
395
|
exports.handleInterceptedCrash = handleInterceptedCrash;
|
|
424
|
-
/**
|
|
425
|
-
* Manually report a caught error with custom metadata.
|
|
426
|
-
*/
|
|
427
396
|
const recordCustomCrash = (error, options) => {
|
|
428
397
|
return (0, exports.handleInterceptedCrash)(error, typeof error === 'object' ? error.stack : undefined, options?.isFatal ?? false, options?.type || enums_1.CrashType.Custom, options?.componentStack);
|
|
429
398
|
};
|
|
430
399
|
exports.recordCustomCrash = recordCustomCrash;
|
|
431
|
-
/**
|
|
432
|
-
* Simulates a crash for developer testing without crashing the host app.
|
|
433
|
-
* Uses real runtime Error objects — no mocked file paths or fake stacks.
|
|
434
|
-
*/
|
|
435
400
|
const simulateTestCrash = (type = enums_1.CrashType.Js, customMessage, customStack) => {
|
|
436
401
|
const err = new Error(customMessage || _defaultSimMessage(type));
|
|
437
402
|
return (0, exports.handleInterceptedCrash)(type === enums_1.CrashType.Native ? err.message : err, customStack || err.stack, type === enums_1.CrashType.Native, type, type === enums_1.CrashType.Render ? _buildComponentStack() : undefined);
|
|
438
403
|
};
|
|
439
404
|
exports.simulateTestCrash = simulateTestCrash;
|
|
440
|
-
/** Generates a generic error message per type — no fake references. */
|
|
441
405
|
const _defaultSimMessage = (type) => {
|
|
442
406
|
switch (type) {
|
|
443
407
|
case 'native':
|
|
@@ -450,12 +414,10 @@ const _defaultSimMessage = (type) => {
|
|
|
450
414
|
return (0, i18n_1.t)('crash.simJsMessage');
|
|
451
415
|
}
|
|
452
416
|
};
|
|
453
|
-
/** Builds a component stack from the real React tree if possible. */
|
|
454
417
|
const _buildComponentStack = () => {
|
|
455
418
|
try {
|
|
456
419
|
const err = new Error();
|
|
457
420
|
if (err.stack) {
|
|
458
|
-
// Return the live stack as a pseudo component-stack
|
|
459
421
|
return err.stack
|
|
460
422
|
.split('\n')
|
|
461
423
|
.slice(1, 6)
|
|
@@ -466,10 +428,6 @@ const _buildComponentStack = () => {
|
|
|
466
428
|
catch { }
|
|
467
429
|
return undefined;
|
|
468
430
|
};
|
|
469
|
-
// ─── EXPORT & REPORTING UTILITIES ─────────────────────────────────────────────
|
|
470
|
-
/**
|
|
471
|
-
* Formats a crash into Text, Markdown, or JSON.
|
|
472
|
-
*/
|
|
473
431
|
const exportCrashReport = (crash, format = 'text') => {
|
|
474
432
|
if (format === 'json') {
|
|
475
433
|
return JSON.stringify(crash, null, 2);
|
|
@@ -517,7 +475,6 @@ const exportCrashReport = (crash, format = 'text') => {
|
|
|
517
475
|
}
|
|
518
476
|
return lines.join('\n');
|
|
519
477
|
}
|
|
520
|
-
// Standard Text format
|
|
521
478
|
const lines = [];
|
|
522
479
|
lines.push('====================================================');
|
|
523
480
|
lines.push(` ${(0, i18n_1.t)('crash.reportTitle')} `);
|
|
@@ -563,16 +520,10 @@ const exportCrashReport = (crash, format = 'text') => {
|
|
|
563
520
|
return lines.join('\n');
|
|
564
521
|
};
|
|
565
522
|
exports.exportCrashReport = exportCrashReport;
|
|
566
|
-
// ─── GLOBAL HANDLER INITIALIZATION ────────────────────────────────────────────
|
|
567
|
-
/**
|
|
568
|
-
* Natively intercepts and prevents crashes, native RedBox dialogues,
|
|
569
|
-
* unhandled JS errors, and unhandled promise rejections.
|
|
570
|
-
*/
|
|
571
523
|
const setupGlobalCrashHandler = () => {
|
|
572
524
|
if (isCrashHandlerInitialized)
|
|
573
525
|
return;
|
|
574
526
|
isCrashHandlerInitialized = true;
|
|
575
|
-
// 1. Completely silence React Native LogBox & RedBox overlays
|
|
576
527
|
try {
|
|
577
528
|
if (react_native_1.LogBox && typeof react_native_1.LogBox.ignoreAllLogs === 'function') {
|
|
578
529
|
react_native_1.LogBox.ignoreAllLogs(true);
|
|
@@ -580,14 +531,12 @@ const setupGlobalCrashHandler = () => {
|
|
|
580
531
|
}
|
|
581
532
|
catch { }
|
|
582
533
|
try {
|
|
583
|
-
// @ts-ignore
|
|
584
534
|
const LogBoxData = require('react-native/Libraries/LogBox/Data/LogBoxData');
|
|
585
535
|
if (LogBoxData && typeof LogBoxData.setDisabled === 'function') {
|
|
586
536
|
LogBoxData.setDisabled(true);
|
|
587
537
|
}
|
|
588
538
|
}
|
|
589
539
|
catch { }
|
|
590
|
-
// 2. Intercept Native Module: NetworkInspectorModule (Android & iOS)
|
|
591
540
|
try {
|
|
592
541
|
const networkInspectorModule = react_native_1.NativeModules?.NetworkInspectorModule;
|
|
593
542
|
if (networkInspectorModule) {
|
|
@@ -604,7 +553,6 @@ const setupGlobalCrashHandler = () => {
|
|
|
604
553
|
}
|
|
605
554
|
}
|
|
606
555
|
catch { }
|
|
607
|
-
// 3. Intercept Native ExceptionsManager & RedBox modules (Bridge & TurboModules)
|
|
608
556
|
try {
|
|
609
557
|
const tmReg = react_native_1.TurboModuleRegistry || globalThis.__turboModuleProxy;
|
|
610
558
|
const nativeExceptionsManager = react_native_1.NativeModules?.ExceptionsManager ||
|
|
@@ -663,7 +611,6 @@ const setupGlobalCrashHandler = () => {
|
|
|
663
611
|
}
|
|
664
612
|
}
|
|
665
613
|
catch { }
|
|
666
|
-
// 4. Hook React Native ErrorUtils
|
|
667
614
|
try {
|
|
668
615
|
const globalObj = globalThis;
|
|
669
616
|
const errorUtils = globalObj.ErrorUtils;
|
|
@@ -671,7 +618,6 @@ const setupGlobalCrashHandler = () => {
|
|
|
671
618
|
if (typeof errorUtils.setGlobalHandler === 'function') {
|
|
672
619
|
errorUtils.setGlobalHandler((error, isFatal) => {
|
|
673
620
|
(0, exports.handleInterceptedCrash)(error, error?.stack, isFatal ?? false, 'js');
|
|
674
|
-
// Suppress calling default crashing handler to prevent termination & RedBox
|
|
675
621
|
});
|
|
676
622
|
}
|
|
677
623
|
if (typeof errorUtils.reportFatalError === 'function') {
|
|
@@ -687,7 +633,6 @@ const setupGlobalCrashHandler = () => {
|
|
|
687
633
|
}
|
|
688
634
|
}
|
|
689
635
|
catch { }
|
|
690
|
-
// 5. Hook global Promise unhandled rejections
|
|
691
636
|
try {
|
|
692
637
|
const globalObj = globalThis;
|
|
693
638
|
const handleUnhandledPromise = (eventOrError) => {
|
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.IGNORED_LOG_PREFIXES = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Configuration for console logs to ignore.
|
|
6
|
-
* Logs matching any of these starting prefixes will be filtered out.
|
|
7
|
-
*/
|
|
8
4
|
exports.IGNORED_LOG_PREFIXES = {
|
|
9
5
|
info: [
|
|
10
|
-
// Add prefixes of info logs you want to ignore, e.g.:
|
|
11
|
-
// 'Starting server',
|
|
12
6
|
'VirtualizedList: You have a large list that is slow to update',
|
|
13
7
|
],
|
|
14
8
|
warn: [
|
|
15
|
-
// Add prefixes of warning logs you want to ignore, e.g.:
|
|
16
|
-
// 'Require cycle:',
|
|
17
|
-
// 'ViewPropTypes will be removed',
|
|
18
9
|
'This method is deprecated (as well as all React Native Firebase namespaced API) and will be removed in the next major release as part of move to match Firebase Web modular SDK API.',
|
|
19
10
|
'SerializableStateInvariantMiddleware took',
|
|
20
11
|
'Non-serializable values were found in the navigation state.',
|
|
@@ -26,8 +17,6 @@ exports.IGNORED_LOG_PREFIXES = {
|
|
|
26
17
|
'A non-serializable value was detected in an action',
|
|
27
18
|
],
|
|
28
19
|
error: [
|
|
29
|
-
// Add prefixes of error logs you want to ignore, e.g.:
|
|
30
|
-
// 'Warning: Each child in a list should have a unique',
|
|
31
20
|
'A non-serializable value was detected in the state, in the path: `tierStatusCalculator.date`',
|
|
32
21
|
'VirtualizedLists should never be nested inside plain ScrollViews with the same orientation because it can break windowing and other functionality - use another VirtualizedList-backed container instead.',
|
|
33
22
|
],
|
|
@@ -37,7 +37,6 @@ function shouldIgnoreUrl(url) {
|
|
|
37
37
|
return false;
|
|
38
38
|
return IGNORED_URL_PATTERNS.some((re) => re.test(url));
|
|
39
39
|
}
|
|
40
|
-
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
|
41
40
|
function normaliseHeaders(raw) {
|
|
42
41
|
if (!raw)
|
|
43
42
|
return undefined;
|
|
@@ -64,7 +63,6 @@ function normaliseHeaders(raw) {
|
|
|
64
63
|
});
|
|
65
64
|
return Object.keys(result).length > 0 ? result : undefined;
|
|
66
65
|
}
|
|
67
|
-
// ✅ Parse FormData for File Upload previews
|
|
68
66
|
function parseRequestData(data) {
|
|
69
67
|
if (!data)
|
|
70
68
|
return data;
|
|
@@ -89,7 +87,6 @@ function parseRequestData(data) {
|
|
|
89
87
|
}
|
|
90
88
|
return data;
|
|
91
89
|
}
|
|
92
|
-
// ✅ Magic function to extract file and line number from the call stack
|
|
93
90
|
function getCallerFromStack() {
|
|
94
91
|
try {
|
|
95
92
|
const stack = new Error().stack;
|
|
@@ -98,7 +95,6 @@ function getCallerFromStack() {
|
|
|
98
95
|
const lines = stack.split("\n");
|
|
99
96
|
for (let i = 0; i < lines.length; i++) {
|
|
100
97
|
const line = lines[i];
|
|
101
|
-
// Skip internal react-native network modules and the logger itself
|
|
102
98
|
if (line.includes("networkLogger") ||
|
|
103
99
|
line.includes("node_modules") ||
|
|
104
100
|
line.includes("Error") ||
|
|
@@ -111,7 +107,6 @@ function getCallerFromStack() {
|
|
|
111
107
|
catch (e) { }
|
|
112
108
|
return "Unknown";
|
|
113
109
|
}
|
|
114
|
-
// ─── Subscribe ────────────────────────────────────────────────────────────────
|
|
115
110
|
const subscribeNetworkLogs = (callback) => {
|
|
116
111
|
listeners.push(callback);
|
|
117
112
|
callback([...logs]);
|
|
@@ -148,7 +143,6 @@ const pruneNetworkLogs = (targetCount) => {
|
|
|
148
143
|
return Math.max(0, pruned);
|
|
149
144
|
};
|
|
150
145
|
exports.pruneNetworkLogs = pruneNetworkLogs;
|
|
151
|
-
// ─── Internal ─────────────────────────────────────────────────────────────────
|
|
152
146
|
const notify = () => {
|
|
153
147
|
const snapshot = [...logs];
|
|
154
148
|
listeners.forEach((cb) => cb(snapshot));
|
|
@@ -171,7 +165,6 @@ const addOrUpdateLog = (log) => {
|
|
|
171
165
|
logs = logs.slice(0, maxNetworkLogsLimit);
|
|
172
166
|
notify();
|
|
173
167
|
};
|
|
174
|
-
// ─── Setup ────────────────────────────────────────────────────────────────────
|
|
175
168
|
const setupNetworkLogger = () => {
|
|
176
169
|
if (globalThis.__NETWORK_LOGGER_INITIALIZED__)
|
|
177
170
|
return;
|
|
@@ -194,7 +187,7 @@ const setupNetworkLogger = () => {
|
|
|
194
187
|
let client = 'fetch';
|
|
195
188
|
try {
|
|
196
189
|
requestHeaders = normaliseHeaders(options?.headers);
|
|
197
|
-
caller = getCallerFromStack();
|
|
190
|
+
caller = getCallerFromStack();
|
|
198
191
|
if (requestHeaders?.['apollographql-client-name'] || finalUrl?.toLowerCase().includes('/graphql')) {
|
|
199
192
|
client = 'apollo';
|
|
200
193
|
}
|
|
@@ -278,7 +271,6 @@ const setupNetworkLogger = () => {
|
|
|
278
271
|
}
|
|
279
272
|
};
|
|
280
273
|
}
|
|
281
|
-
// Hook Axios — patches both the default instance and any future axios.create() instances
|
|
282
274
|
try {
|
|
283
275
|
if (axios_1.default) {
|
|
284
276
|
(0, exports.addAxiosInterceptors)(axios_1.default);
|
|
@@ -293,7 +285,6 @@ const setupNetworkLogger = () => {
|
|
|
293
285
|
}
|
|
294
286
|
}
|
|
295
287
|
catch (_e) {
|
|
296
|
-
// Axios not available — fetch-only mode
|
|
297
288
|
}
|
|
298
289
|
try {
|
|
299
290
|
(0, crashHandler_1.setupGlobalCrashHandler)();
|
|
@@ -302,7 +293,6 @@ const setupNetworkLogger = () => {
|
|
|
302
293
|
globalThis.__NETWORK_LOGGER_INITIALIZED__ = true;
|
|
303
294
|
};
|
|
304
295
|
exports.setupNetworkLogger = setupNetworkLogger;
|
|
305
|
-
// ─── Axios interceptor helper ─────────────────────────────────────────────────
|
|
306
296
|
const addAxiosInterceptors = (axiosInstance) => {
|
|
307
297
|
axiosInstance.interceptors.request.use(async (config) => {
|
|
308
298
|
const method = (config.method || "GET").toUpperCase();
|
|
@@ -310,11 +300,10 @@ const addAxiosInterceptors = (axiosInstance) => {
|
|
|
310
300
|
return config;
|
|
311
301
|
const id = counter++;
|
|
312
302
|
const start = Date.now();
|
|
313
|
-
const caller = getCallerFromStack();
|
|
303
|
+
const caller = getCallerFromStack();
|
|
314
304
|
let url = config.url ?? "";
|
|
315
305
|
if (!url.startsWith("http"))
|
|
316
306
|
url = `${config.baseURL ?? ""}${url}`;
|
|
317
|
-
// ✅ Leave config untagged so the response interceptor skips it too.
|
|
318
307
|
if (shouldIgnoreUrl(url))
|
|
319
308
|
return config;
|
|
320
309
|
config.__logId = id;
|
|
@@ -59,20 +59,11 @@ export interface ComponentRenderProfile {
|
|
|
59
59
|
fixKeys: PerformanceFixKey[];
|
|
60
60
|
severity: 'optimal' | 'warning' | 'critical';
|
|
61
61
|
}
|
|
62
|
-
/**
|
|
63
|
-
* Dynamically generates tailored Before/After performance optimization code snippets
|
|
64
|
-
* based on the target component's real identifier, props, and detected anti-pattern.
|
|
65
|
-
*/
|
|
66
62
|
export declare const generateFixSnippet: (fixKey: string, componentName?: string, context?: {
|
|
67
63
|
propName?: string;
|
|
68
64
|
actionName?: string;
|
|
69
65
|
itemHeight?: number;
|
|
70
66
|
}) => PerformanceFixKey;
|
|
71
|
-
/**
|
|
72
|
-
* Dynamically resolves caller file path or runtime source from the active JavaScript stack trace.
|
|
73
|
-
* Does not assume fixed directory hierarchies (such as src/ or components/) and extracts
|
|
74
|
-
* whatever relative path or symbol the host project structure uses.
|
|
75
|
-
*/
|
|
76
67
|
export declare function getCallerSourceFile(fallbackName?: string): string;
|
|
77
68
|
export declare const getInitialRenderProfiles: () => ComponentRenderProfile[];
|
|
78
69
|
export declare const getInitialPerformanceEvents: () => PerformanceEvent[];
|
|
@@ -91,41 +82,23 @@ export declare const trackComponentRender: (params: {
|
|
|
91
82
|
reason?: string;
|
|
92
83
|
fixKeys?: PerformanceFixKey[];
|
|
93
84
|
}) => void;
|
|
94
|
-
/**
|
|
95
|
-
* Dynamically queries Hermes or JavaScript runtime memory statistics.
|
|
96
|
-
*/
|
|
97
85
|
export declare const getHermesMemoryStats: () => LiveMemoryStats;
|
|
98
|
-
/**
|
|
99
|
-
* Dynamically records and evaluates screen navigation transition performance.
|
|
100
|
-
*/
|
|
101
86
|
export declare const trackNavigationTransition: (screenName: string, durationMs: number, options?: {
|
|
102
87
|
ttiMs?: number;
|
|
103
88
|
droppedFrames?: number;
|
|
104
89
|
source?: string;
|
|
105
90
|
}) => PerformanceEvent;
|
|
106
|
-
/**
|
|
107
|
-
* React Hook that automatically profiles screen mounts and navigation transitions.
|
|
108
|
-
*/
|
|
109
91
|
export declare const useNavigationProfiler: (screenName: string, options?: {
|
|
110
92
|
onTransitionEnd?: (durationMs: number) => void;
|
|
111
93
|
}) => void;
|
|
112
|
-
/**
|
|
113
|
-
* Measures synchronous execution duration and alerts on frame budget spikes (>16ms).
|
|
114
|
-
*/
|
|
115
94
|
export declare const trackHeavyTask: <T>(taskName: string, syncFn: () => T, options?: {
|
|
116
95
|
thresholdMs?: number;
|
|
117
96
|
source?: string;
|
|
118
97
|
}) => T;
|
|
119
|
-
/**
|
|
120
|
-
* Measures async operation / Promise latency and records slow network or disk tasks.
|
|
121
|
-
*/
|
|
122
98
|
export declare const measureAsync: <T>(taskName: string, asyncFn: () => Promise<T>, options?: {
|
|
123
99
|
thresholdMs?: number;
|
|
124
100
|
source?: string;
|
|
125
101
|
}) => Promise<T>;
|
|
126
|
-
/**
|
|
127
|
-
* Custom React Hook to profile any component or screen renders dynamically in runtime.
|
|
128
|
-
*/
|
|
129
102
|
export declare const useComponentProfiler: (componentName: string, options?: {
|
|
130
103
|
type?: ComponentRenderProfile["type"];
|
|
131
104
|
sourceFile?: string;
|
|
@@ -5,10 +5,6 @@ exports.getCallerSourceFile = getCallerSourceFile;
|
|
|
5
5
|
const AppColors_1 = require("../styles/AppColors");
|
|
6
6
|
const i18n_1 = require("../i18n");
|
|
7
7
|
const react_1 = require("react");
|
|
8
|
-
/**
|
|
9
|
-
* Dynamically generates tailored Before/After performance optimization code snippets
|
|
10
|
-
* based on the target component's real identifier, props, and detected anti-pattern.
|
|
11
|
-
*/
|
|
12
8
|
const generateFixSnippet = (fixKey, componentName = 'Component', context) => {
|
|
13
9
|
const comp = componentName || 'Component';
|
|
14
10
|
const prop = context?.propName || 'onPress';
|
|
@@ -139,11 +135,6 @@ const generateFixSnippet = (fixKey, componentName = 'Component', context) => {
|
|
|
139
135
|
}
|
|
140
136
|
};
|
|
141
137
|
exports.generateFixSnippet = generateFixSnippet;
|
|
142
|
-
/**
|
|
143
|
-
* Dynamically resolves caller file path or runtime source from the active JavaScript stack trace.
|
|
144
|
-
* Does not assume fixed directory hierarchies (such as src/ or components/) and extracts
|
|
145
|
-
* whatever relative path or symbol the host project structure uses.
|
|
146
|
-
*/
|
|
147
138
|
function getCallerSourceFile(fallbackName) {
|
|
148
139
|
try {
|
|
149
140
|
const stack = new Error().stack;
|
|
@@ -269,9 +260,6 @@ const trackComponentRender = (params) => {
|
|
|
269
260
|
notifyRenderListeners();
|
|
270
261
|
};
|
|
271
262
|
exports.trackComponentRender = trackComponentRender;
|
|
272
|
-
/**
|
|
273
|
-
* Dynamically queries Hermes or JavaScript runtime memory statistics.
|
|
274
|
-
*/
|
|
275
263
|
const getHermesMemoryStats = () => {
|
|
276
264
|
try {
|
|
277
265
|
const hermes = globalThis.HermesInternal;
|
|
@@ -301,9 +289,6 @@ const getHermesMemoryStats = () => {
|
|
|
301
289
|
};
|
|
302
290
|
};
|
|
303
291
|
exports.getHermesMemoryStats = getHermesMemoryStats;
|
|
304
|
-
/**
|
|
305
|
-
* Dynamically records and evaluates screen navigation transition performance.
|
|
306
|
-
*/
|
|
307
292
|
const trackNavigationTransition = (screenName, durationMs, options) => {
|
|
308
293
|
const duration = Math.max(1, Number(durationMs.toFixed(1)));
|
|
309
294
|
const tti = options?.ttiMs ? Number(options.ttiMs.toFixed(1)) : duration;
|
|
@@ -328,9 +313,6 @@ const trackNavigationTransition = (screenName, durationMs, options) => {
|
|
|
328
313
|
});
|
|
329
314
|
};
|
|
330
315
|
exports.trackNavigationTransition = trackNavigationTransition;
|
|
331
|
-
/**
|
|
332
|
-
* React Hook that automatically profiles screen mounts and navigation transitions.
|
|
333
|
-
*/
|
|
334
316
|
const useNavigationProfiler = (screenName, options) => {
|
|
335
317
|
const mountTimeRef = (0, react_1.useRef)(Date.now());
|
|
336
318
|
(0, react_1.useEffect)(() => {
|
|
@@ -342,9 +324,6 @@ const useNavigationProfiler = (screenName, options) => {
|
|
|
342
324
|
}, [screenName]);
|
|
343
325
|
};
|
|
344
326
|
exports.useNavigationProfiler = useNavigationProfiler;
|
|
345
|
-
/**
|
|
346
|
-
* Measures synchronous execution duration and alerts on frame budget spikes (>16ms).
|
|
347
|
-
*/
|
|
348
327
|
const trackHeavyTask = (taskName, syncFn, options) => {
|
|
349
328
|
const start = Date.now();
|
|
350
329
|
try {
|
|
@@ -373,9 +352,6 @@ const trackHeavyTask = (taskName, syncFn, options) => {
|
|
|
373
352
|
}
|
|
374
353
|
};
|
|
375
354
|
exports.trackHeavyTask = trackHeavyTask;
|
|
376
|
-
/**
|
|
377
|
-
* Measures async operation / Promise latency and records slow network or disk tasks.
|
|
378
|
-
*/
|
|
379
355
|
const measureAsync = async (taskName, asyncFn, options) => {
|
|
380
356
|
const start = Date.now();
|
|
381
357
|
try {
|
|
@@ -401,9 +377,6 @@ const measureAsync = async (taskName, asyncFn, options) => {
|
|
|
401
377
|
}
|
|
402
378
|
};
|
|
403
379
|
exports.measureAsync = measureAsync;
|
|
404
|
-
/**
|
|
405
|
-
* Custom React Hook to profile any component or screen renders dynamically in runtime.
|
|
406
|
-
*/
|
|
407
380
|
const useComponentProfiler = (componentName, options) => {
|
|
408
381
|
const renderCountRef = (0, react_1.useRef)(0);
|
|
409
382
|
const prevPropsRef = (0, react_1.useRef)(options?.propsToCompare);
|
|
@@ -414,7 +387,6 @@ const useComponentProfiler = (componentName, options) => {
|
|
|
414
387
|
const duration = Date.now() - startTimeRef.current;
|
|
415
388
|
const now = Date.now();
|
|
416
389
|
renderCountRef.current += 1;
|
|
417
|
-
// Detect rapid re-render loop spikes (>= 10 renders within 500ms)
|
|
418
390
|
renderTimestampsRef.current = [
|
|
419
391
|
...renderTimestampsRef.current.filter(ts => now - ts <= 500),
|
|
420
392
|
now,
|
|
@@ -493,7 +465,6 @@ const usePerformanceTracker = (enabled = true) => {
|
|
|
493
465
|
const lastFrameTimeRef = (0, react_1.useRef)(Date.now());
|
|
494
466
|
const rafIdRef = (0, react_1.useRef)(null);
|
|
495
467
|
const appStartTimestampRef = (0, react_1.useRef)(Date.now());
|
|
496
|
-
// Live Frame Measurement Loop
|
|
497
468
|
(0, react_1.useEffect)(() => {
|
|
498
469
|
if (!isTrackerActive || !isRecording)
|
|
499
470
|
return;
|
|
@@ -529,7 +500,6 @@ const usePerformanceTracker = (enabled = true) => {
|
|
|
529
500
|
setAvgFps(Math.round(sum / next.length));
|
|
530
501
|
return next;
|
|
531
502
|
});
|
|
532
|
-
// Update live memory telemetry from Hermes / engine
|
|
533
503
|
const liveMem = (0, exports.getHermesMemoryStats)();
|
|
534
504
|
setMemoryStats(prev => ({
|
|
535
505
|
...prev,
|
|
@@ -596,7 +566,6 @@ const usePerformanceTracker = (enabled = true) => {
|
|
|
596
566
|
: 'Poor',
|
|
597
567
|
};
|
|
598
568
|
}, [totalFrames, jankyFrameCount, jsLagMs, events]);
|
|
599
|
-
// Aggregate re-render stats
|
|
600
569
|
const reRenderSummary = (0, react_1.useMemo)(() => {
|
|
601
570
|
const totalRenders = renderProfiles.reduce((sum, p) => sum + p.renderCount, 0);
|
|
602
571
|
const totalWasteful = renderProfiles.reduce((sum, p) => sum + p.wastefulCount, 0);
|
|
@@ -15,17 +15,5 @@ export declare const getActionHistory: () => ReduxHistoryEntry[];
|
|
|
15
15
|
export declare const clearActionHistory: () => void;
|
|
16
16
|
export declare const setReduxState: (state: any) => void;
|
|
17
17
|
export declare const subscribeReduxState: (cb: () => void) => () => void;
|
|
18
|
-
/**
|
|
19
|
-
* Standard Redux middleware — add it to your store to capture every action,
|
|
20
|
-
* including those dispatched from thunks, sagas and RTK Query:
|
|
21
|
-
*
|
|
22
|
-
* const store = configureStore({
|
|
23
|
-
* reducer,
|
|
24
|
-
* middleware: gDM => gDM().concat(inspectorReduxMiddleware),
|
|
25
|
-
* });
|
|
26
|
-
*
|
|
27
|
-
* Pair with `connectReduxStore(store)` (safe — they de-duplicate) or rely on
|
|
28
|
-
* the middleware alone; the initial snapshot is taken on the first action.
|
|
29
|
-
*/
|
|
30
18
|
export declare const inspectorReduxMiddleware: (storeApi: any) => (next: (action: any) => any) => (action: any) => any;
|
|
31
19
|
export declare const connectReduxStore: (store: any) => void;
|