react-native-inapp-inspector 2.3.19 → 2.3.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -14
- package/android/src/main/java/com/inappinspector/NetworkInspectorModule.kt +67 -0
- package/dist/commonjs/analytics.js +1 -24
- package/dist/commonjs/bundle.js +1 -16
- package/dist/commonjs/capture.js +1 -35
- package/dist/commonjs/components/AnalyticsDetail.js +92 -623
- package/dist/commonjs/components/AnalyticsEventCard.js +54 -350
- package/dist/commonjs/components/AnalyticsGraph.js +70 -370
- package/dist/commonjs/components/AnimatedEntrance.js +1 -11
- package/dist/commonjs/components/AppHeaderLogo.js +7 -134
- package/dist/commonjs/components/BrandCircleIcon.js +73 -118
- package/dist/commonjs/components/BrandSquareIcon.js +63 -108
- package/dist/commonjs/components/CodeSnippet.js +48 -623
- package/dist/commonjs/components/ConsoleLogCard.js +63 -537
- package/dist/commonjs/components/CopyButton.js +3 -89
- package/dist/commonjs/components/DiffViewer.js +19 -83
- package/dist/commonjs/components/DomainHeader.js +27 -127
- package/dist/commonjs/components/EmptyState.js +10 -87
- package/dist/commonjs/components/EndOfListFooter.js +7 -81
- package/dist/commonjs/components/ErrorBoundary.js +72 -566
- package/dist/commonjs/components/HeadersSection.js +31 -110
- package/dist/commonjs/components/HighlightText.js +17 -58
- package/dist/commonjs/components/Inspector/AboutModal.d.ts +6 -0
- package/dist/commonjs/components/Inspector/AboutModal.js +243 -0
- package/dist/commonjs/components/Inspector/AnalyticsFilterModal.js +98 -797
- package/dist/commonjs/components/Inspector/AnalyticsTab.js +284 -930
- package/dist/commonjs/components/Inspector/BundleTab.js +551 -2918
- package/dist/commonjs/components/Inspector/ConsoleTab.js +79 -492
- package/dist/commonjs/components/Inspector/CrashDetail.js +123 -672
- package/dist/commonjs/components/Inspector/CrashFilterModal.js +66 -498
- package/dist/commonjs/components/Inspector/CrashTab.js +98 -670
- package/dist/commonjs/components/Inspector/DebuggingTab.js +74 -875
- package/dist/commonjs/components/Inspector/DeviceInfoTab.js +143 -907
- package/dist/commonjs/components/Inspector/FabLauncher.js +42 -466
- package/dist/commonjs/components/Inspector/FeatureUnderDevNotice.js +6 -99
- package/dist/commonjs/components/Inspector/InspectorContext.js +1 -21
- package/dist/commonjs/components/Inspector/InspectorHeader.js +191 -1110
- package/dist/commonjs/components/Inspector/LogDetail.js +168 -994
- package/dist/commonjs/components/Inspector/MainScreen.js +52 -335
- package/dist/commonjs/components/Inspector/MediaGalleryTab.js +97 -644
- package/dist/commonjs/components/Inspector/MediaPreviewModal.js +90 -605
- package/dist/commonjs/components/Inspector/NavigationTracker.js +1 -12
- package/dist/commonjs/components/Inspector/NetworkDetail.js +89 -411
- package/dist/commonjs/components/Inspector/NetworkFilterModal.js +60 -576
- package/dist/commonjs/components/Inspector/NetworkTab.js +84 -514
- package/dist/commonjs/components/Inspector/NpmStarPrompt.js +18 -434
- package/dist/commonjs/components/Inspector/NpmUpdateToast.js +25 -298
- package/dist/commonjs/components/Inspector/PerformanceTab.js +182 -1397
- package/dist/commonjs/components/Inspector/ReduxDetail.js +188 -1089
- package/dist/commonjs/components/Inspector/ReduxTab.js +85 -701
- package/dist/commonjs/components/Inspector/SettingsPanel.js +427 -3807
- package/dist/commonjs/components/Inspector/SkeletonPlaceholder.js +11 -180
- package/dist/commonjs/components/Inspector/StorageTab.js +93 -826
- package/dist/commonjs/components/Inspector/TabBar.js +36 -334
- package/dist/commonjs/components/Inspector/UpdateAvailableModal.js +37 -412
- package/dist/commonjs/components/JsonViewer.js +168 -381
- package/dist/commonjs/components/LogCard.js +57 -567
- package/dist/commonjs/components/LogSyntaxHighlighter.js +11 -130
- package/dist/commonjs/components/MetaAccordion.js +69 -238
- package/dist/commonjs/components/MiniBarChart.js +3 -56
- package/dist/commonjs/components/MiniLineChart.js +3 -58
- package/dist/commonjs/components/NetworkIcons.d.ts +13 -0
- package/dist/commonjs/components/NetworkIcons.js +521 -1022
- package/dist/commonjs/components/QRCodeView.js +5 -79
- package/dist/commonjs/components/SectionHeader.js +15 -37
- package/dist/commonjs/components/SegmentedTabs.js +7 -62
- package/dist/commonjs/components/SkeletonPlaceholder.js +11 -180
- package/dist/commonjs/components/Slider.js +15 -243
- package/dist/commonjs/components/SourcePageCard.js +30 -89
- package/dist/commonjs/components/Toast.js +5 -147
- package/dist/commonjs/components/TouchableScale.js +3 -24
- package/dist/commonjs/components/TreeNode.js +55 -130
- package/dist/commonjs/console.js +1 -16
- package/dist/commonjs/constants/index.js +1 -32
- package/dist/commonjs/constants/telemetryConfig.js +1 -6
- package/dist/commonjs/constants/version.d.ts +1 -1
- package/dist/commonjs/constants/version.js +1 -4
- package/dist/commonjs/crash.js +1 -23
- package/dist/commonjs/customHooks/analyticsLogger.js +1 -250
- package/dist/commonjs/customHooks/bundleAnalyzer.js +1 -957
- package/dist/commonjs/customHooks/consoleLogger.js +6 -445
- package/dist/commonjs/customHooks/crashHandler.js +7 -656
- package/dist/commonjs/customHooks/logFilters.js +1 -23
- package/dist/commonjs/customHooks/networkLogger.js +2 -536
- package/dist/commonjs/customHooks/performanceTracker.js +63 -750
- package/dist/commonjs/customHooks/reduxLogger.js +2 -313
- package/dist/commonjs/customHooks/storageInspector.js +1 -435
- package/dist/commonjs/customHooks/useAccordion.js +1 -18
- package/dist/commonjs/decorators/index.js +1 -100
- package/dist/commonjs/helpers/gaAnalyticsRegistry.js +1 -148
- package/dist/commonjs/helpers/index.d.ts +1 -0
- package/dist/commonjs/helpers/index.js +8 -921
- package/dist/commonjs/helpers/memoryManager.js +1 -99
- package/dist/commonjs/helpers/qrGenerator.js +1 -367
- package/dist/commonjs/helpers/remoteConfig.js +1 -165
- package/dist/commonjs/helpers/searchQueryParser.js +1 -62
- package/dist/commonjs/helpers/settingsStore.js +1 -144
- package/dist/commonjs/helpers/telemetry.js +1 -501
- package/dist/commonjs/helpers/toast.js +1 -20
- package/dist/commonjs/i18n/index.js +1 -90
- package/dist/commonjs/i18n/locales/en.json +1 -1140
- package/dist/commonjs/index.js +5 -2168
- package/dist/commonjs/metro.js +6 -468
- package/dist/commonjs/native/NativeInspector.d.ts +1 -0
- package/dist/commonjs/native/NativeInspector.js +1 -415
- package/dist/commonjs/native/NativeNetworkInspector.js +1 -4
- package/dist/commonjs/network.js +1 -13
- package/dist/commonjs/performance.js +1 -29
- package/dist/commonjs/redux.js +1 -20
- package/dist/commonjs/storage.js +1 -14
- package/dist/commonjs/styles/AppColors.js +1 -423
- package/dist/commonjs/styles/AppFonts.js +1 -17
- package/dist/commonjs/styles/common.js +1 -190
- package/dist/commonjs/styles/index.d.ts +6 -0
- package/dist/commonjs/styles/index.js +1 -1589
- package/dist/commonjs/types/enums.d.ts +0 -1
- package/dist/commonjs/types/enums.js +1 -152
- package/dist/commonjs/types/index.js +1 -18
- package/dist/commonjs/types/interfaces.d.ts +2 -2
- package/dist/commonjs/types/interfaces.js +1 -2
- package/dist/esm/analytics.js +1 -2
- package/dist/esm/bundle.js +1 -2
- package/dist/esm/capture.js +1 -32
- package/dist/esm/components/AnalyticsDetail.js +171 -664
- package/dist/esm/components/AnalyticsEventCard.js +77 -335
- package/dist/esm/components/AnalyticsGraph.js +95 -357
- package/dist/esm/components/AnimatedEntrance.js +1 -6
- package/dist/esm/components/AppHeaderLogo.js +7 -94
- package/dist/esm/components/BrandCircleIcon.js +114 -119
- package/dist/esm/components/BrandSquareIcon.js +73 -78
- package/dist/esm/components/CodeSnippet.js +58 -595
- package/dist/esm/components/ConsoleLogCard.js +91 -526
- package/dist/esm/components/CopyButton.js +3 -51
- package/dist/esm/components/DiffViewer.js +22 -48
- package/dist/esm/components/DomainHeader.js +43 -138
- package/dist/esm/components/EmptyState.js +17 -56
- package/dist/esm/components/EndOfListFooter.js +15 -83
- package/dist/esm/components/ErrorBoundary.js +125 -582
- package/dist/esm/components/HeadersSection.js +52 -93
- package/dist/esm/components/HighlightText.js +17 -53
- package/dist/esm/components/Inspector/AboutModal.d.ts +6 -0
- package/dist/esm/components/Inspector/AboutModal.js +243 -0
- package/dist/esm/components/Inspector/AnalyticsFilterModal.js +225 -886
- package/dist/esm/components/Inspector/AnalyticsTab.js +296 -904
- package/dist/esm/components/Inspector/BundleTab.js +1175 -3502
- package/dist/esm/components/Inspector/ConsoleTab.js +113 -488
- package/dist/esm/components/Inspector/CrashDetail.js +236 -747
- package/dist/esm/components/Inspector/CrashFilterModal.js +149 -541
- package/dist/esm/components/Inspector/CrashTab.js +177 -711
- package/dist/esm/components/Inspector/DebuggingTab.js +164 -925
- package/dist/esm/components/Inspector/DeviceInfoTab.js +199 -924
- package/dist/esm/components/Inspector/FabLauncher.js +68 -454
- package/dist/esm/components/Inspector/FeatureUnderDevNotice.js +14 -70
- package/dist/esm/components/Inspector/InspectorContext.js +1 -12
- package/dist/esm/components/Inspector/InspectorHeader.js +282 -1163
- package/dist/esm/components/Inspector/LogDetail.js +235 -1023
- package/dist/esm/components/Inspector/MainScreen.js +78 -323
- package/dist/esm/components/Inspector/MediaGalleryTab.js +143 -650
- package/dist/esm/components/Inspector/MediaPreviewModal.js +138 -613
- package/dist/esm/components/Inspector/NavigationTracker.js +1 -10
- package/dist/esm/components/Inspector/NetworkDetail.js +138 -455
- package/dist/esm/components/Inspector/NetworkFilterModal.js +122 -597
- package/dist/esm/components/Inspector/NetworkTab.js +125 -517
- package/dist/esm/components/Inspector/NpmStarPrompt.js +58 -434
- package/dist/esm/components/Inspector/NpmUpdateToast.js +45 -281
- package/dist/esm/components/Inspector/PerformanceTab.js +393 -1570
- package/dist/esm/components/Inspector/ReduxDetail.js +307 -1170
- package/dist/esm/components/Inspector/ReduxTab.js +144 -722
- package/dist/esm/components/Inspector/SettingsPanel.js +643 -3985
- package/dist/esm/components/Inspector/SkeletonPlaceholder.js +30 -163
- package/dist/esm/components/Inspector/StorageTab.js +172 -866
- package/dist/esm/components/Inspector/TabBar.js +45 -305
- package/dist/esm/components/Inspector/UpdateAvailableModal.js +80 -418
- package/dist/esm/components/JsonViewer.js +179 -354
- package/dist/esm/components/LogCard.js +93 -565
- package/dist/esm/components/LogSyntaxHighlighter.js +11 -123
- package/dist/esm/components/MetaAccordion.js +136 -267
- package/dist/esm/components/MiniBarChart.js +3 -18
- package/dist/esm/components/MiniLineChart.js +3 -20
- package/dist/esm/components/NetworkIcons.d.ts +13 -0
- package/dist/esm/components/NetworkIcons.js +523 -838
- package/dist/esm/components/QRCodeView.js +8 -45
- package/dist/esm/components/SectionHeader.js +22 -39
- package/dist/esm/components/SegmentedTabs.js +8 -58
- package/dist/esm/components/SkeletonPlaceholder.js +30 -163
- package/dist/esm/components/Slider.js +24 -213
- package/dist/esm/components/SourcePageCard.js +65 -86
- package/dist/esm/components/Toast.js +10 -117
- package/dist/esm/components/TouchableScale.js +3 -19
- package/dist/esm/components/TreeNode.js +58 -95
- package/dist/esm/console.js +1 -2
- package/dist/esm/constants/index.js +1 -28
- package/dist/esm/constants/telemetryConfig.js +1 -3
- package/dist/esm/constants/version.d.ts +1 -1
- package/dist/esm/constants/version.js +1 -1
- package/dist/esm/crash.js +1 -2
- package/dist/esm/customHooks/analyticsLogger.js +1 -230
- package/dist/esm/customHooks/bundleAnalyzer.js +1 -944
- package/dist/esm/customHooks/consoleLogger.js +6 -432
- package/dist/esm/customHooks/crashHandler.js +7 -630
- package/dist/esm/customHooks/logFilters.js +1 -20
- package/dist/esm/customHooks/networkLogger.js +2 -519
- package/dist/esm/customHooks/performanceTracker.js +63 -723
- package/dist/esm/customHooks/reduxLogger.js +2 -293
- package/dist/esm/customHooks/storageInspector.js +1 -418
- package/dist/esm/customHooks/useAccordion.js +1 -16
- package/dist/esm/decorators/index.js +1 -95
- package/dist/esm/helpers/gaAnalyticsRegistry.js +1 -143
- package/dist/esm/helpers/index.d.ts +1 -0
- package/dist/esm/helpers/index.js +8 -861
- package/dist/esm/helpers/memoryManager.js +1 -91
- package/dist/esm/helpers/qrGenerator.js +1 -364
- package/dist/esm/helpers/remoteConfig.js +1 -160
- package/dist/esm/helpers/searchQueryParser.js +1 -59
- package/dist/esm/helpers/settingsStore.js +1 -134
- package/dist/esm/helpers/telemetry.js +1 -489
- package/dist/esm/helpers/toast.js +1 -15
- package/dist/esm/i18n/index.js +1 -78
- package/dist/esm/i18n/locales/en.json +1 -1140
- package/dist/esm/index.js +7 -1982
- package/dist/esm/metro.js +6 -459
- package/dist/esm/native/NativeInspector.d.ts +1 -0
- package/dist/esm/native/NativeInspector.js +1 -382
- package/dist/esm/native/NativeNetworkInspector.js +1 -2
- package/dist/esm/network.js +1 -1
- package/dist/esm/performance.js +1 -2
- package/dist/esm/redux.js +1 -1
- package/dist/esm/storage.js +1 -1
- package/dist/esm/styles/AppColors.js +1 -417
- package/dist/esm/styles/AppFonts.js +1 -13
- package/dist/esm/styles/common.js +1 -186
- package/dist/esm/styles/index.d.ts +6 -0
- package/dist/esm/styles/index.js +1 -1551
- package/dist/esm/types/enums.d.ts +0 -1
- package/dist/esm/types/enums.js +1 -149
- package/dist/esm/types/index.js +1 -2
- package/dist/esm/types/interfaces.d.ts +2 -2
- package/dist/esm/types/interfaces.js +1 -1
- package/ios/NetworkInspectorModule.mm +60 -12
- package/package.json +5 -3
- package/src/native/NativeInspector.ts +18 -0
- package/dist/commonjs/components/Inspector/FeedbackModal.d.ts +0 -7
- package/dist/commonjs/components/Inspector/FeedbackModal.js +0 -552
- package/dist/esm/components/Inspector/FeedbackModal.d.ts +0 -7
- package/dist/esm/components/Inspector/FeedbackModal.js +0 -515
- package/src/analytics.ts +0 -35
- package/src/bundle.ts +0 -25
- package/src/capture.ts +0 -109
- package/src/components/AnalyticsDetail.tsx +0 -870
- package/src/components/AnalyticsEventCard.tsx +0 -444
- package/src/components/AnalyticsGraph.tsx +0 -583
- package/src/components/AnimatedEntrance.tsx +0 -20
- package/src/components/AppHeaderLogo.tsx +0 -143
- package/src/components/BrandCircleIcon.tsx +0 -144
- package/src/components/BrandSquareIcon.tsx +0 -184
- package/src/components/CodeSnippet.tsx +0 -725
- package/src/components/ConsoleLogCard.tsx +0 -679
- package/src/components/CopyButton.tsx +0 -87
- package/src/components/DiffViewer.tsx +0 -82
- package/src/components/DomainHeader.tsx +0 -224
- package/src/components/EmptyState.tsx +0 -97
- package/src/components/EndOfListFooter.tsx +0 -100
- package/src/components/ErrorBoundary.tsx +0 -688
- package/src/components/HeadersSection.tsx +0 -172
- package/src/components/HighlightText.tsx +0 -100
- package/src/components/Inspector/AnalyticsFilterModal.tsx +0 -1250
- package/src/components/Inspector/AnalyticsTab.tsx +0 -1362
- package/src/components/Inspector/BundleTab.tsx +0 -4768
- package/src/components/Inspector/ConsoleTab.tsx +0 -726
- package/src/components/Inspector/CrashDetail.tsx +0 -997
- package/src/components/Inspector/CrashFilterModal.tsx +0 -721
- package/src/components/Inspector/CrashTab.tsx +0 -933
- package/src/components/Inspector/DebuggingTab.tsx +0 -1103
- package/src/components/Inspector/DeviceInfoTab.tsx +0 -1397
- package/src/components/Inspector/FabLauncher.tsx +0 -590
- package/src/components/Inspector/FeatureUnderDevNotice.tsx +0 -94
- package/src/components/Inspector/FeedbackModal.tsx +0 -626
- package/src/components/Inspector/InspectorContext.tsx +0 -28
- package/src/components/Inspector/InspectorHeader.tsx +0 -1583
- package/src/components/Inspector/LogDetail.tsx +0 -1431
- package/src/components/Inspector/MainScreen.tsx +0 -460
- package/src/components/Inspector/MediaGalleryTab.tsx +0 -829
- package/src/components/Inspector/MediaPreviewModal.tsx +0 -783
- package/src/components/Inspector/NavigationTracker.tsx +0 -13
- package/src/components/Inspector/NetworkDetail.tsx +0 -778
- package/src/components/Inspector/NetworkFilterModal.tsx +0 -730
- package/src/components/Inspector/NetworkTab.tsx +0 -820
- package/src/components/Inspector/NpmStarPrompt.tsx +0 -532
- package/src/components/Inspector/NpmUpdateToast.tsx +0 -387
- package/src/components/Inspector/PerformanceTab.tsx +0 -1967
- package/src/components/Inspector/ReduxDetail.tsx +0 -1651
- package/src/components/Inspector/ReduxTab.tsx +0 -987
- package/src/components/Inspector/SettingsPanel.tsx +0 -5136
- package/src/components/Inspector/SkeletonPlaceholder.tsx +0 -206
- package/src/components/Inspector/StorageTab.tsx +0 -1159
- package/src/components/Inspector/TabBar.tsx +0 -431
- package/src/components/Inspector/UpdateAvailableModal.tsx +0 -555
- package/src/components/JsonViewer.tsx +0 -549
- package/src/components/LogCard.tsx +0 -694
- package/src/components/LogSyntaxHighlighter.tsx +0 -178
- package/src/components/MetaAccordion.tsx +0 -355
- package/src/components/MiniBarChart.tsx +0 -42
- package/src/components/MiniLineChart.tsx +0 -33
- package/src/components/NetworkIcons.tsx +0 -2655
- package/src/components/QRCodeView.tsx +0 -75
- package/src/components/SectionHeader.tsx +0 -101
- package/src/components/SegmentedTabs.tsx +0 -84
- package/src/components/SkeletonPlaceholder.tsx +0 -206
- package/src/components/Slider.tsx +0 -300
- package/src/components/SourcePageCard.tsx +0 -150
- package/src/components/Toast.tsx +0 -131
- package/src/components/TouchableScale.tsx +0 -61
- package/src/components/TreeNode.tsx +0 -171
- package/src/console.ts +0 -24
- package/src/constants/index.ts +0 -41
- package/src/constants/telemetryConfig.ts +0 -4
- package/src/constants/version.ts +0 -3
- package/src/crash.ts +0 -32
- package/src/customHooks/analyticsLogger.ts +0 -336
- package/src/customHooks/bundleAnalyzer.ts +0 -1256
- package/src/customHooks/consoleLogger.ts +0 -530
- package/src/customHooks/crashHandler.ts +0 -944
- package/src/customHooks/logFilters.ts +0 -32
- package/src/customHooks/networkLogger.ts +0 -624
- package/src/customHooks/performanceTracker.ts +0 -1014
- package/src/customHooks/reduxLogger.ts +0 -406
- package/src/customHooks/storageInspector.ts +0 -513
- package/src/customHooks/useAccordion.tsx +0 -27
- package/src/decorators/index.ts +0 -184
- package/src/helpers/gaAnalyticsRegistry.ts +0 -204
- package/src/helpers/index.ts +0 -1092
- package/src/helpers/memoryManager.ts +0 -138
- package/src/helpers/qrGenerator.ts +0 -430
- package/src/helpers/remoteConfig.ts +0 -212
- package/src/helpers/searchQueryParser.ts +0 -84
- package/src/helpers/settingsStore.ts +0 -171
- package/src/helpers/telemetry.ts +0 -568
- package/src/helpers/toast.ts +0 -17
- package/src/i18n/index.ts +0 -104
- package/src/i18n/locales/en.json +0 -1141
- package/src/index.tsx +0 -2650
- package/src/metro.ts +0 -598
- package/src/network.ts +0 -22
- package/src/performance.ts +0 -38
- package/src/redux.ts +0 -23
- package/src/storage.ts +0 -18
- package/src/styles/AppColors.ts +0 -455
- package/src/styles/AppFonts.ts +0 -26
- package/src/styles/common.ts +0 -209
- package/src/styles/index.ts +0 -1606
- package/src/types/enums.ts +0 -210
- package/src/types/index.ts +0 -34
- package/src/types/interfaces.ts +0 -535
|
@@ -1,445 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
let logs = [];
|
|
8
|
-
let listeners = [];
|
|
9
|
-
let counter = 0;
|
|
10
|
-
let isIntercepting = false;
|
|
11
|
-
let isConsoleModuleEnabled = true;
|
|
12
|
-
const setConsoleModuleEnabled = (enabled) => {
|
|
13
|
-
isConsoleModuleEnabled = enabled;
|
|
14
|
-
};
|
|
15
|
-
exports.setConsoleModuleEnabled = setConsoleModuleEnabled;
|
|
16
|
-
const getConsoleModuleEnabled = () => isConsoleModuleEnabled;
|
|
17
|
-
exports.getConsoleModuleEnabled = getConsoleModuleEnabled;
|
|
18
|
-
let maxConsoleLogsLimit = 250;
|
|
19
|
-
const setMaxConsoleLogsLimit = (limit) => {
|
|
20
|
-
maxConsoleLogsLimit = Math.max(10, limit);
|
|
21
|
-
if (logs.length > maxConsoleLogsLimit) {
|
|
22
|
-
logs = logs.slice(0, maxConsoleLogsLimit);
|
|
23
|
-
notify();
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
exports.setMaxConsoleLogsLimit = setMaxConsoleLogsLimit;
|
|
27
|
-
const getMaxConsoleLogsLimit = () => maxConsoleLogsLimit;
|
|
28
|
-
exports.getMaxConsoleLogsLimit = getMaxConsoleLogsLimit;
|
|
29
|
-
const pruneConsoleLogs = (targetCount) => {
|
|
30
|
-
const countToKeep = targetCount !== undefined ? Math.max(0, targetCount) : Math.floor(logs.length / 2);
|
|
31
|
-
const pruned = logs.length - countToKeep;
|
|
32
|
-
if (pruned > 0) {
|
|
33
|
-
logs = logs.slice(0, countToKeep);
|
|
34
|
-
notify();
|
|
35
|
-
}
|
|
36
|
-
return Math.max(0, pruned);
|
|
37
|
-
};
|
|
38
|
-
exports.pruneConsoleLogs = pruneConsoleLogs;
|
|
39
|
-
const formatArgs = (args) => {
|
|
40
|
-
return args
|
|
41
|
-
.map(arg => {
|
|
42
|
-
if (arg === null)
|
|
43
|
-
return 'null';
|
|
44
|
-
if (arg === undefined)
|
|
45
|
-
return 'undefined';
|
|
46
|
-
if (typeof arg === 'object') {
|
|
47
|
-
try {
|
|
48
|
-
return JSON.stringify(arg, null, 2);
|
|
49
|
-
}
|
|
50
|
-
catch {
|
|
51
|
-
return Object.prototype.toString.call(arg);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return String(arg);
|
|
55
|
-
})
|
|
56
|
-
.join(' ');
|
|
57
|
-
};
|
|
58
|
-
const getMetroSymbolicateUrl = () => {
|
|
59
|
-
try {
|
|
60
|
-
const scriptURL = react_native_1.NativeModules.SourceCode?.scriptURL ||
|
|
61
|
-
react_native_1.NativeModules?.PlatformConstants?.serverHost ||
|
|
62
|
-
react_native_1.NativeModules?.DevSettings?.serverHost;
|
|
63
|
-
if (typeof scriptURL === 'string' && scriptURL.length > 0) {
|
|
64
|
-
const match = scriptURL.match(/^(https?:\/\/[^\/]+)/);
|
|
65
|
-
if (match) {
|
|
66
|
-
return `${match[1]}/symbolicate`;
|
|
67
|
-
}
|
|
68
|
-
else if (!scriptURL.startsWith('http') && scriptURL.includes(':')) {
|
|
69
|
-
return `http://${scriptURL}/symbolicate`;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
catch { }
|
|
74
|
-
return 'http://localhost:8081/symbolicate';
|
|
75
|
-
};
|
|
76
|
-
const symbolicateStack = async (stackString) => {
|
|
77
|
-
if (typeof __DEV__ === 'undefined' || !__DEV__ || !stackString)
|
|
78
|
-
return null;
|
|
79
|
-
try {
|
|
80
|
-
let symModule = null;
|
|
81
|
-
try {
|
|
82
|
-
symModule = require('react-native/Libraries/Core/Devtools/symbolicateStackTrace');
|
|
83
|
-
}
|
|
84
|
-
catch { }
|
|
85
|
-
const symFn = symModule?.default || symModule;
|
|
86
|
-
if (typeof symFn === 'function') {
|
|
87
|
-
const res = await symFn(stackString);
|
|
88
|
-
if (res && Array.isArray(res.stack) && res.stack.length > 0) {
|
|
89
|
-
return res.stack;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
catch { }
|
|
94
|
-
try {
|
|
95
|
-
const metroUrl = getMetroSymbolicateUrl();
|
|
96
|
-
const scriptURL = react_native_1.NativeModules.SourceCode?.scriptURL || 'http://localhost:8081/index.bundle?platform=ios&dev=true';
|
|
97
|
-
const lines = stackString.split('\n');
|
|
98
|
-
const inputFrames = [];
|
|
99
|
-
for (const rawLine of lines) {
|
|
100
|
-
const line = rawLine.trim().replace(/^at /, '');
|
|
101
|
-
if (!line)
|
|
102
|
-
continue;
|
|
103
|
-
let methodName = '<anonymous>';
|
|
104
|
-
let locationPart = line;
|
|
105
|
-
const parenMatch = line.match(/^(.*?)\s*\((.*?)\)$/);
|
|
106
|
-
if (parenMatch) {
|
|
107
|
-
methodName = parenMatch[1].trim() || '<anonymous>';
|
|
108
|
-
locationPart = parenMatch[2].trim();
|
|
109
|
-
}
|
|
110
|
-
else if (line.includes('@')) {
|
|
111
|
-
const atIdx = line.indexOf('@');
|
|
112
|
-
methodName = line.substring(0, atIdx).trim() || '<anonymous>';
|
|
113
|
-
locationPart = line.substring(atIdx + 1).trim();
|
|
114
|
-
}
|
|
115
|
-
locationPart = locationPart.replace(/^address at /, '');
|
|
116
|
-
const locMatch = locationPart.match(/^(.*?):(\d+):(\d+)$/);
|
|
117
|
-
if (locMatch) {
|
|
118
|
-
let file = locMatch[1];
|
|
119
|
-
if (!file.startsWith('http') && file !== 'native' && !file.includes('InternalBytecode')) {
|
|
120
|
-
file = scriptURL;
|
|
121
|
-
}
|
|
122
|
-
inputFrames.push({
|
|
123
|
-
file,
|
|
124
|
-
lineNumber: parseInt(locMatch[2], 10),
|
|
125
|
-
column: parseInt(locMatch[3], 10),
|
|
126
|
-
methodName,
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
if (inputFrames.length > 0) {
|
|
131
|
-
const response = await fetch(metroUrl, {
|
|
132
|
-
method: 'POST',
|
|
133
|
-
headers: { 'Content-Type': 'application/json' },
|
|
134
|
-
body: JSON.stringify({ stack: inputFrames }),
|
|
135
|
-
});
|
|
136
|
-
if (response.ok) {
|
|
137
|
-
const json = await response.json();
|
|
138
|
-
if (json && Array.isArray(json.stack) && json.stack.length > 0) {
|
|
139
|
-
return json.stack;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
catch { }
|
|
145
|
-
return null;
|
|
146
|
-
};
|
|
147
|
-
const isLoggerInternal = (line) => {
|
|
148
|
-
const l = line.toLowerCase();
|
|
149
|
-
return (l.includes('getstackdetails') ||
|
|
150
|
-
l.includes('addlog') ||
|
|
151
|
-
l.includes('consolelogger') ||
|
|
152
|
-
l.includes('setupconsolelogger') ||
|
|
153
|
-
l.includes('formatargs') ||
|
|
154
|
-
l.includes('react-native-inapp-inspector') ||
|
|
155
|
-
l.trim() === 'error');
|
|
156
|
-
};
|
|
157
|
-
const getStackDetails = (args) => {
|
|
158
|
-
try {
|
|
159
|
-
let errorStack;
|
|
160
|
-
if (args && args.length > 0) {
|
|
161
|
-
for (const arg of args) {
|
|
162
|
-
if (arg instanceof Error && arg.stack) {
|
|
163
|
-
errorStack = arg.stack;
|
|
164
|
-
break;
|
|
165
|
-
}
|
|
166
|
-
else if (arg &&
|
|
167
|
-
typeof arg === 'object' &&
|
|
168
|
-
typeof arg.stack === 'string') {
|
|
169
|
-
errorStack = arg.stack;
|
|
170
|
-
break;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
const rawStack = new Error().stack;
|
|
175
|
-
const stackToUse = errorStack || rawStack;
|
|
176
|
-
if (!stackToUse)
|
|
177
|
-
return { caller: 'Unknown', errorStack };
|
|
178
|
-
const lines = stackToUse.split('\n');
|
|
179
|
-
let userCaller;
|
|
180
|
-
let fallbackCaller;
|
|
181
|
-
for (let i = 0; i < lines.length; i++) {
|
|
182
|
-
const line = lines[i];
|
|
183
|
-
if (!line || isLoggerInternal(line)) {
|
|
184
|
-
continue;
|
|
185
|
-
}
|
|
186
|
-
const isInternal = line.includes('react-native/Libraries') ||
|
|
187
|
-
line.includes('setUpConsole') ||
|
|
188
|
-
line.includes('ExceptionsManager') ||
|
|
189
|
-
line.includes('MessageQueue') ||
|
|
190
|
-
line.includes('metro-runtime') ||
|
|
191
|
-
line.includes('regenerator-runtime');
|
|
192
|
-
if (!fallbackCaller && !line.includes('setUpConsole')) {
|
|
193
|
-
fallbackCaller = line.trim().replace(/^at /, '');
|
|
194
|
-
}
|
|
195
|
-
if (!isInternal) {
|
|
196
|
-
userCaller = line.trim().replace(/^at /, '');
|
|
197
|
-
break;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
const cleanedStack = lines.filter(l => !isLoggerInternal(l)).join('\n');
|
|
201
|
-
const caller = userCaller || fallbackCaller || 'Unknown';
|
|
202
|
-
return { caller, stack: cleanedStack || stackToUse, errorStack, stackToUse };
|
|
203
|
-
}
|
|
204
|
-
catch (e) {
|
|
205
|
-
return { caller: 'Unknown' };
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
const notify = () => {
|
|
209
|
-
const snapshot = [...logs];
|
|
210
|
-
listeners.forEach(cb => cb(snapshot));
|
|
211
|
-
};
|
|
212
|
-
const addLog = (type, args, sourceMethod) => {
|
|
213
|
-
if (!isConsoleModuleEnabled)
|
|
214
|
-
return;
|
|
215
|
-
if (isIntercepting)
|
|
216
|
-
return;
|
|
217
|
-
isIntercepting = true;
|
|
218
|
-
try {
|
|
219
|
-
const message = formatArgs(args);
|
|
220
|
-
const allPrefixes = [
|
|
221
|
-
...((logFilters_1.IGNORED_LOG_PREFIXES && logFilters_1.IGNORED_LOG_PREFIXES.info) || []),
|
|
222
|
-
...((logFilters_1.IGNORED_LOG_PREFIXES && logFilters_1.IGNORED_LOG_PREFIXES.warn) || []),
|
|
223
|
-
...((logFilters_1.IGNORED_LOG_PREFIXES && logFilters_1.IGNORED_LOG_PREFIXES.error) || []),
|
|
224
|
-
].filter(p => typeof p === 'string' && p.trim().length > 0);
|
|
225
|
-
if (allPrefixes.some(prefix => message
|
|
226
|
-
.toLowerCase()
|
|
227
|
-
.trim()
|
|
228
|
-
.startsWith(prefix.toLowerCase().trim()) ||
|
|
229
|
-
message.toLowerCase().trim().includes(prefix.toLowerCase().trim()))) {
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
const { caller, stack, errorStack, stackToUse } = getStackDetails(args);
|
|
233
|
-
const newLog = {
|
|
234
|
-
id: counter++,
|
|
235
|
-
type,
|
|
236
|
-
message,
|
|
237
|
-
timestamp: Date.now(),
|
|
238
|
-
caller,
|
|
239
|
-
stack,
|
|
240
|
-
errorStack,
|
|
241
|
-
rawArgs: args,
|
|
242
|
-
sourceMethod,
|
|
243
|
-
};
|
|
244
|
-
logs.unshift(newLog);
|
|
245
|
-
logs = logs.slice(0, maxConsoleLogsLimit);
|
|
246
|
-
notify();
|
|
247
|
-
const stackToSymbolicate = errorStack || stackToUse || stack;
|
|
248
|
-
if (type === 'error' && stackToSymbolicate && typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
249
|
-
const currentLogId = newLog.id;
|
|
250
|
-
symbolicateStack(stackToSymbolicate)
|
|
251
|
-
.then(symFrames => {
|
|
252
|
-
if (symFrames && Array.isArray(symFrames) && symFrames.length > 0) {
|
|
253
|
-
const symLines = [];
|
|
254
|
-
let symUserCaller;
|
|
255
|
-
for (const frame of symFrames) {
|
|
256
|
-
const file = (frame.file || '').replace(/^webpack:\/\/\/?/, '');
|
|
257
|
-
const method = frame.methodName || '<anonymous>';
|
|
258
|
-
const line = frame.lineNumber != null ? `:${frame.lineNumber}` : '';
|
|
259
|
-
const col = frame.column != null ? `:${frame.column}` : '';
|
|
260
|
-
const isInternal = file.includes('customHooks/consoleLogger') ||
|
|
261
|
-
file.includes('setupConsoleLogger') ||
|
|
262
|
-
file.includes('getStackDetails') ||
|
|
263
|
-
file.includes('react-native-inapp-inspector/dist') ||
|
|
264
|
-
file.includes('react-native-inapp-inspector/src') ||
|
|
265
|
-
method === 'getStackDetails' ||
|
|
266
|
-
method === 'addLog' ||
|
|
267
|
-
(method === 'log' && file.includes('consoleLogger'));
|
|
268
|
-
if (isInternal) {
|
|
269
|
-
continue;
|
|
270
|
-
}
|
|
271
|
-
const lineStr = `at ${method} (${file}${line}${col})`;
|
|
272
|
-
symLines.push(lineStr);
|
|
273
|
-
const isUserFile = file &&
|
|
274
|
-
!file.includes('node_modules') &&
|
|
275
|
-
!file.includes('react-native/') &&
|
|
276
|
-
(file.endsWith('.tsx') ||
|
|
277
|
-
file.endsWith('.jsx') ||
|
|
278
|
-
file.endsWith('.ts') ||
|
|
279
|
-
file.endsWith('.js'));
|
|
280
|
-
if (!symUserCaller && isUserFile) {
|
|
281
|
-
const cleanFile = file.split('/').pop() || file;
|
|
282
|
-
symUserCaller = `${method} (${cleanFile}${line}${col})`;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
const targetLog = logs.find(l => l.id === currentLogId);
|
|
286
|
-
if (targetLog) {
|
|
287
|
-
if (symUserCaller) {
|
|
288
|
-
targetLog.caller = symUserCaller;
|
|
289
|
-
}
|
|
290
|
-
else if (symLines.length > 0) {
|
|
291
|
-
targetLog.caller = symLines[0].replace(/^at /, '');
|
|
292
|
-
}
|
|
293
|
-
if (symLines.length > 0) {
|
|
294
|
-
targetLog.stack = symLines.join('\n');
|
|
295
|
-
}
|
|
296
|
-
notify();
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
})
|
|
300
|
-
.catch(() => { });
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
catch (e) {
|
|
304
|
-
}
|
|
305
|
-
finally {
|
|
306
|
-
isIntercepting = false;
|
|
307
|
-
}
|
|
308
|
-
};
|
|
309
|
-
const addLogFromCrash = (error, message, stack, isFatal) => {
|
|
310
|
-
const { caller, errorStack } = getStackDetails([error]);
|
|
311
|
-
const newLog = {
|
|
312
|
-
id: counter++,
|
|
313
|
-
type: 'error',
|
|
314
|
-
message: message || (error?.message ?? 'Runtime Crash'),
|
|
315
|
-
timestamp: Date.now(),
|
|
316
|
-
caller: caller !== 'Unknown'
|
|
317
|
-
? caller
|
|
318
|
-
: isFatal
|
|
319
|
-
? 'Fatal Crash'
|
|
320
|
-
: 'Unhandled Exception',
|
|
321
|
-
stack: stack || error?.stack || errorStack,
|
|
322
|
-
errorStack: stack || error?.stack,
|
|
323
|
-
rawArgs: [error],
|
|
324
|
-
sourceMethod: 'error',
|
|
325
|
-
};
|
|
326
|
-
logs.unshift(newLog);
|
|
327
|
-
logs = logs.slice(0, maxConsoleLogsLimit);
|
|
328
|
-
notify();
|
|
329
|
-
const stackToSym = stack || error?.stack || errorStack;
|
|
330
|
-
if (stackToSym && typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
331
|
-
symbolicateStack(stackToSym)
|
|
332
|
-
.then(symFrames => {
|
|
333
|
-
if (symFrames && Array.isArray(symFrames) && symFrames.length > 0) {
|
|
334
|
-
const symLines = symFrames.map(f => `at ${f.methodName || '<anonymous>'} (${(f.file || '').replace(/^webpack:\/\/\/?/, '')}:${f.lineNumber ?? 0}:${f.column ?? 0})`);
|
|
335
|
-
const target = logs.find(l => l.id === newLog.id);
|
|
336
|
-
if (target) {
|
|
337
|
-
target.stack = symLines.join('\n');
|
|
338
|
-
notify();
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
})
|
|
342
|
-
.catch(() => { });
|
|
343
|
-
}
|
|
344
|
-
return newLog;
|
|
345
|
-
};
|
|
346
|
-
exports.addLogFromCrash = addLogFromCrash;
|
|
347
|
-
const subscribeConsoleLogs = (callback) => {
|
|
348
|
-
listeners.push(callback);
|
|
349
|
-
callback([...logs]);
|
|
350
|
-
return () => {
|
|
351
|
-
listeners = listeners.filter(l => l !== callback);
|
|
352
|
-
};
|
|
353
|
-
};
|
|
354
|
-
exports.subscribeConsoleLogs = subscribeConsoleLogs;
|
|
355
|
-
const clearConsoleLogs = () => {
|
|
356
|
-
logs = [];
|
|
357
|
-
notify();
|
|
358
|
-
};
|
|
359
|
-
exports.clearConsoleLogs = clearConsoleLogs;
|
|
360
|
-
const getConsoleLogs = () => [...logs];
|
|
361
|
-
exports.getConsoleLogs = getConsoleLogs;
|
|
362
|
-
const setupConsoleLogger = () => {
|
|
363
|
-
if (globalThis.__CONSOLE_LOGGER_INITIALIZED__)
|
|
364
|
-
return;
|
|
365
|
-
const originalConsole = {
|
|
366
|
-
log: console.log,
|
|
367
|
-
info: console.info,
|
|
368
|
-
warn: console.warn,
|
|
369
|
-
error: console.error,
|
|
370
|
-
debug: console.debug,
|
|
371
|
-
trace: console.trace,
|
|
372
|
-
};
|
|
373
|
-
console.log = (...args) => {
|
|
374
|
-
try {
|
|
375
|
-
addLog('info', args, 'log');
|
|
376
|
-
}
|
|
377
|
-
catch { }
|
|
378
|
-
originalConsole.log(...args);
|
|
379
|
-
};
|
|
380
|
-
console.info = (...args) => {
|
|
381
|
-
try {
|
|
382
|
-
addLog('info', args, 'info');
|
|
383
|
-
}
|
|
384
|
-
catch { }
|
|
385
|
-
originalConsole.info(...args);
|
|
386
|
-
};
|
|
387
|
-
console.debug = (...args) => {
|
|
388
|
-
try {
|
|
389
|
-
addLog('info', args, 'info');
|
|
390
|
-
}
|
|
391
|
-
catch { }
|
|
392
|
-
if (typeof originalConsole.debug === 'function') {
|
|
393
|
-
originalConsole.debug(...args);
|
|
394
|
-
}
|
|
395
|
-
else {
|
|
396
|
-
originalConsole.log(...args);
|
|
397
|
-
}
|
|
398
|
-
};
|
|
399
|
-
console.trace = (...args) => {
|
|
400
|
-
try {
|
|
401
|
-
addLog('info', args, 'info');
|
|
402
|
-
}
|
|
403
|
-
catch { }
|
|
404
|
-
if (typeof originalConsole.trace === 'function') {
|
|
405
|
-
originalConsole.trace(...args);
|
|
406
|
-
}
|
|
407
|
-
else {
|
|
408
|
-
originalConsole.log(...args);
|
|
409
|
-
}
|
|
410
|
-
};
|
|
411
|
-
console.warn = (...args) => {
|
|
412
|
-
try {
|
|
413
|
-
addLog('warn', args, 'warn');
|
|
414
|
-
}
|
|
415
|
-
catch { }
|
|
416
|
-
originalConsole.warn(...args);
|
|
417
|
-
};
|
|
418
|
-
console.error = (...args) => {
|
|
419
|
-
try {
|
|
420
|
-
addLog('error', args, 'error');
|
|
421
|
-
}
|
|
422
|
-
catch { }
|
|
423
|
-
const firstArg = args && args[0];
|
|
424
|
-
const isRenderError = typeof firstArg === 'string' &&
|
|
425
|
-
(firstArg.includes('The above error occurred in') ||
|
|
426
|
-
firstArg.includes('Render Error') ||
|
|
427
|
-
firstArg.includes('ReferenceError') ||
|
|
428
|
-
firstArg.includes('TypeError'));
|
|
429
|
-
if (!isRenderError) {
|
|
430
|
-
originalConsole.error(...args);
|
|
431
|
-
}
|
|
432
|
-
};
|
|
433
|
-
try {
|
|
434
|
-
(0, crashHandler_1.setupGlobalCrashHandler)();
|
|
435
|
-
}
|
|
436
|
-
catch { }
|
|
437
|
-
globalThis.__CONSOLE_LOGGER_INITIALIZED__ = true;
|
|
438
|
-
};
|
|
439
|
-
exports.setupConsoleLogger = setupConsoleLogger;
|
|
440
|
-
if (typeof globalThis !== 'undefined') {
|
|
441
|
-
try {
|
|
442
|
-
(0, exports.setupConsoleLogger)();
|
|
443
|
-
}
|
|
444
|
-
catch { }
|
|
445
|
-
}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.setupConsoleLogger=exports.getConsoleLogs=exports.clearConsoleLogs=exports.subscribeConsoleLogs=exports.addLogFromCrash=exports.pruneConsoleLogs=exports.getMaxConsoleLogsLimit=exports.setMaxConsoleLogsLimit=exports.getConsoleModuleEnabled=exports.setConsoleModuleEnabled=void 0;const react_native_1=require("react-native"),logFilters_1=require("./logFilters"),crashHandler_1=require("./crashHandler");let logs=[],listeners=[],counter=0,isIntercepting=!1,isConsoleModuleEnabled=!0;const setConsoleModuleEnabled=t=>{isConsoleModuleEnabled=t};exports.setConsoleModuleEnabled=setConsoleModuleEnabled;const getConsoleModuleEnabled=()=>isConsoleModuleEnabled;exports.getConsoleModuleEnabled=getConsoleModuleEnabled;let maxConsoleLogsLimit=250;const setMaxConsoleLogsLimit=t=>{maxConsoleLogsLimit=Math.max(10,t),logs.length>maxConsoleLogsLimit&&(logs=logs.slice(0,maxConsoleLogsLimit),notify())};exports.setMaxConsoleLogsLimit=setMaxConsoleLogsLimit;const getMaxConsoleLogsLimit=()=>maxConsoleLogsLimit;exports.getMaxConsoleLogsLimit=getMaxConsoleLogsLimit;const pruneConsoleLogs=t=>{const e=t!==void 0?Math.max(0,t):Math.floor(logs.length/2),l=logs.length-e;return l>0&&(logs=logs.slice(0,e),notify()),Math.max(0,l)};exports.pruneConsoleLogs=pruneConsoleLogs;const formatArgs=t=>t.map(e=>{if(e===null)return"null";if(e===void 0)return"undefined";if(typeof e=="object")try{return JSON.stringify(e,null,2)}catch{return Object.prototype.toString.call(e)}return String(e)}).join(" "),getMetroSymbolicateUrl=()=>{try{const t=react_native_1.NativeModules.SourceCode?.scriptURL||react_native_1.NativeModules?.PlatformConstants?.serverHost||react_native_1.NativeModules?.DevSettings?.serverHost;if(typeof t=="string"&&t.length>0){const e=t.match(/^(https?:\/\/[^\/]+)/);if(e)return`${e[1]}/symbolicate`;if(!t.startsWith("http")&&t.includes(":"))return`http://${t}/symbolicate`}}catch{}return"http://localhost:8081/symbolicate"},symbolicateStack=async t=>{if(typeof __DEV__>"u"||!__DEV__||!t)return null;try{let e=null;try{e=require("react-native/Libraries/Core/Devtools/symbolicateStackTrace")}catch{}const l=e?.default||e;if(typeof l=="function"){const c=await l(t);if(c&&Array.isArray(c.stack)&&c.stack.length>0)return c.stack}}catch{}try{const e=getMetroSymbolicateUrl(),l=react_native_1.NativeModules.SourceCode?.scriptURL||"http://localhost:8081/index.bundle?platform=ios&dev=true",c=t.split(`
|
|
2
|
+
`),d=[];for(const u of c){const n=u.trim().replace(/^at /,"");if(!n)continue;let f="<anonymous>",a=n;const s=n.match(/^(.*?)\s*\((.*?)\)$/);if(s)f=s[1].trim()||"<anonymous>",a=s[2].trim();else if(n.includes("@")){const o=n.indexOf("@");f=n.substring(0,o).trim()||"<anonymous>",a=n.substring(o+1).trim()}a=a.replace(/^address at /,"");const r=a.match(/^(.*?):(\d+):(\d+)$/);if(r){let o=r[1];!o.startsWith("http")&&o!=="native"&&!o.includes("InternalBytecode")&&(o=l),d.push({file:o,lineNumber:parseInt(r[2],10),column:parseInt(r[3],10),methodName:f})}}if(d.length>0){const u=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({stack:d})});if(u.ok){const n=await u.json();if(n&&Array.isArray(n.stack)&&n.stack.length>0)return n.stack}}}catch{}return null},isLoggerInternal=t=>{const e=t.toLowerCase();return e.includes("getstackdetails")||e.includes("addlog")||e.includes("consolelogger")||e.includes("setupconsolelogger")||e.includes("formatargs")||e.includes("react-native-inapp-inspector")||e.trim()==="error"},getStackDetails=t=>{try{let e;if(t&&t.length>0){for(const s of t)if(s instanceof Error&&s.stack){e=s.stack;break}else if(s&&typeof s=="object"&&typeof s.stack=="string"){e=s.stack;break}}const l=new Error().stack,c=e||l;if(!c)return{caller:"Unknown",errorStack:e};const d=c.split(`
|
|
3
|
+
`);let u,n;for(let s=0;s<d.length;s++){const r=d[s];if(!r||isLoggerInternal(r))continue;const o=r.includes("react-native/Libraries")||r.includes("setUpConsole")||r.includes("ExceptionsManager")||r.includes("MessageQueue")||r.includes("metro-runtime")||r.includes("regenerator-runtime");if(!n&&!r.includes("setUpConsole")&&(n=r.trim().replace(/^at /,"")),!o){u=r.trim().replace(/^at /,"");break}}const f=d.filter(s=>!isLoggerInternal(s)).join(`
|
|
4
|
+
`);return{caller:u||n||"Unknown",stack:f||c,errorStack:e,stackToUse:c}}catch{return{caller:"Unknown"}}},notify=()=>{const t=[...logs];listeners.forEach(e=>e(t))},addLog=(t,e,l)=>{if(isConsoleModuleEnabled&&!isIntercepting){isIntercepting=!0;try{const c=formatArgs(e);if([...logFilters_1.IGNORED_LOG_PREFIXES&&logFilters_1.IGNORED_LOG_PREFIXES.info||[],...logFilters_1.IGNORED_LOG_PREFIXES&&logFilters_1.IGNORED_LOG_PREFIXES.warn||[],...logFilters_1.IGNORED_LOG_PREFIXES&&logFilters_1.IGNORED_LOG_PREFIXES.error||[]].filter(o=>typeof o=="string"&&o.trim().length>0).some(o=>c.toLowerCase().trim().startsWith(o.toLowerCase().trim())||c.toLowerCase().trim().includes(o.toLowerCase().trim())))return;const{caller:u,stack:n,errorStack:f,stackToUse:a}=getStackDetails(e),s={id:counter++,type:t,message:c,timestamp:Date.now(),caller:u,stack:n,errorStack:f,rawArgs:e,sourceMethod:l};logs.unshift(s),logs=logs.slice(0,maxConsoleLogsLimit),notify();const r=f||a||n;if(t==="error"&&r&&typeof __DEV__<"u"&&__DEV__){const o=s.id;symbolicateStack(r).then(m=>{if(m&&Array.isArray(m)&&m.length>0){const g=[];let L;for(const p of m){const i=(p.file||"").replace(/^webpack:\/\/\/?/,""),h=p.methodName||"<anonymous>",_=p.lineNumber!=null?`:${p.lineNumber}`:"",C=p.column!=null?`:${p.column}`:"";if(i.includes("customHooks/consoleLogger")||i.includes("setupConsoleLogger")||i.includes("getStackDetails")||i.includes("react-native-inapp-inspector/dist")||i.includes("react-native-inapp-inspector/src")||h==="getStackDetails"||h==="addLog"||h==="log"&&i.includes("consoleLogger"))continue;const b=`at ${h} (${i}${_}${C})`;g.push(b);const E=i&&!i.includes("node_modules")&&!i.includes("react-native/")&&(i.endsWith(".tsx")||i.endsWith(".jsx")||i.endsWith(".ts")||i.endsWith(".js"));if(!L&&E){const k=i.split("/").pop()||i;L=`${h} (${k}${_}${C})`}}const y=logs.find(p=>p.id===o);y&&(L?y.caller=L:g.length>0&&(y.caller=g[0].replace(/^at /,"")),g.length>0&&(y.stack=g.join(`
|
|
5
|
+
`)),notify())}}).catch(()=>{})}}catch{}finally{isIntercepting=!1}}},addLogFromCrash=(t,e,l,c)=>{const{caller:d,errorStack:u}=getStackDetails([t]),n={id:counter++,type:"error",message:e||(t?.message??"Runtime Crash"),timestamp:Date.now(),caller:d!=="Unknown"?d:c?"Fatal Crash":"Unhandled Exception",stack:l||t?.stack||u,errorStack:l||t?.stack,rawArgs:[t],sourceMethod:"error"};logs.unshift(n),logs=logs.slice(0,maxConsoleLogsLimit),notify();const f=l||t?.stack||u;return f&&typeof __DEV__<"u"&&__DEV__&&symbolicateStack(f).then(a=>{if(a&&Array.isArray(a)&&a.length>0){const s=a.map(o=>`at ${o.methodName||"<anonymous>"} (${(o.file||"").replace(/^webpack:\/\/\/?/,"")}:${o.lineNumber??0}:${o.column??0})`),r=logs.find(o=>o.id===n.id);r&&(r.stack=s.join(`
|
|
6
|
+
`),notify())}}).catch(()=>{}),n};exports.addLogFromCrash=addLogFromCrash;const subscribeConsoleLogs=t=>(listeners.push(t),t([...logs]),()=>{listeners=listeners.filter(e=>e!==t)});exports.subscribeConsoleLogs=subscribeConsoleLogs;const clearConsoleLogs=()=>{logs=[],notify()};exports.clearConsoleLogs=clearConsoleLogs;const getConsoleLogs=()=>[...logs];exports.getConsoleLogs=getConsoleLogs;const setupConsoleLogger=()=>{if(globalThis.__CONSOLE_LOGGER_INITIALIZED__)return;const t={log:console.log,info:console.info,warn:console.warn,error:console.error,debug:console.debug,trace:console.trace};console.log=(...e)=>{try{addLog("info",e,"log")}catch{}t.log(...e)},console.info=(...e)=>{try{addLog("info",e,"info")}catch{}t.info(...e)},console.debug=(...e)=>{try{addLog("info",e,"info")}catch{}typeof t.debug=="function"?t.debug(...e):t.log(...e)},console.trace=(...e)=>{try{addLog("info",e,"info")}catch{}typeof t.trace=="function"?t.trace(...e):t.log(...e)},console.warn=(...e)=>{try{addLog("warn",e,"warn")}catch{}t.warn(...e)},console.error=(...e)=>{try{addLog("error",e,"error")}catch{}const l=e&&e[0];typeof l=="string"&&(l.includes("The above error occurred in")||l.includes("Render Error")||l.includes("ReferenceError")||l.includes("TypeError"))||t.error(...e)};try{(0,crashHandler_1.setupGlobalCrashHandler)()}catch{}globalThis.__CONSOLE_LOGGER_INITIALIZED__=!0};if(exports.setupConsoleLogger=setupConsoleLogger,typeof globalThis<"u")try{(0,exports.setupConsoleLogger)()}catch{}
|