react-native-inapp-inspector 2.3.18 ā 2.3.20
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/src/main/java/com/inappinspector/NetworkInspectorModule.kt +57 -0
- package/dist/commonjs/analytics.js +1 -24
- package/dist/commonjs/bundle.js +1 -16
- package/dist/commonjs/capture.d.ts +2 -0
- package/dist/commonjs/capture.js +1 -32
- 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.d.ts +1 -0
- 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 +351 -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 +64 -871
- package/dist/commonjs/components/Inspector/DeviceInfoTab.js +143 -907
- package/dist/commonjs/components/Inspector/FabLauncher.js +85 -54
- package/dist/commonjs/components/Inspector/FeatureUnderDevNotice.js +6 -99
- package/dist/commonjs/components/Inspector/FeedbackModal.d.ts +9 -0
- package/dist/commonjs/components/Inspector/FeedbackModal.js +167 -521
- package/dist/commonjs/components/Inspector/InspectorContext.js +1 -21
- package/dist/commonjs/components/Inspector/InspectorHeader.js +219 -1093
- package/dist/commonjs/components/Inspector/LogDetail.js +168 -994
- package/dist/commonjs/components/Inspector/MainScreen.js +60 -332
- package/dist/commonjs/components/Inspector/MediaGalleryTab.js +136 -278
- package/dist/commonjs/components/Inspector/MediaPreviewModal.js +134 -361
- package/dist/commonjs/components/Inspector/NavigationTracker.js +1 -12
- package/dist/commonjs/components/Inspector/NetworkDetail.js +96 -432
- 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 +17 -433
- 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 +431 -3431
- 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 +47 -183
- package/dist/commonjs/components/Inspector/UpdateAvailableModal.js +34 -408
- package/dist/commonjs/components/JsonViewer.js +168 -380
- 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 +7 -0
- package/dist/commonjs/components/NetworkIcons.js +479 -997
- package/dist/commonjs/components/QRCodeView.js +5 -79
- package/dist/commonjs/components/SectionHeader.js +15 -37
- package/dist/commonjs/components/SegmentedTabs.js +7 -61
- 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.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 -1122
- package/dist/commonjs/index.js +5 -2153
- package/dist/commonjs/metro.js +6 -468
- package/dist/commonjs/native/NativeInspector.d.ts +3 -0
- package/dist/commonjs/native/NativeInspector.js +1 -402
- package/dist/commonjs/native/NativeNetworkInspector.d.ts +1 -0
- 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 +2 -1
- package/dist/commonjs/types/enums.js +1 -150
- package/dist/commonjs/types/index.js +1 -18
- package/dist/commonjs/types/interfaces.d.ts +7 -0
- 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.d.ts +2 -0
- package/dist/esm/capture.js +1 -29
- 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.d.ts +1 -0
- 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 +351 -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 +156 -923
- package/dist/esm/components/Inspector/DeviceInfoTab.js +199 -924
- package/dist/esm/components/Inspector/FabLauncher.js +85 -49
- package/dist/esm/components/Inspector/FeatureUnderDevNotice.js +14 -70
- package/dist/esm/components/Inspector/FeedbackModal.d.ts +9 -0
- package/dist/esm/components/Inspector/FeedbackModal.js +182 -499
- package/dist/esm/components/Inspector/InspectorContext.js +1 -12
- package/dist/esm/components/Inspector/InspectorHeader.js +309 -1145
- package/dist/esm/components/Inspector/LogDetail.js +235 -1023
- package/dist/esm/components/Inspector/MainScreen.js +86 -320
- package/dist/esm/components/Inspector/MediaGalleryTab.js +157 -259
- package/dist/esm/components/Inspector/MediaPreviewModal.js +153 -340
- package/dist/esm/components/Inspector/NavigationTracker.js +1 -10
- package/dist/esm/components/Inspector/NetworkDetail.js +141 -472
- 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 +647 -3609
- 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 +52 -183
- package/dist/esm/components/Inspector/UpdateAvailableModal.js +79 -416
- package/dist/esm/components/JsonViewer.js +179 -353
- 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 +7 -0
- package/dist/esm/components/NetworkIcons.js +481 -817
- package/dist/esm/components/QRCodeView.js +8 -45
- package/dist/esm/components/SectionHeader.js +22 -39
- package/dist/esm/components/SegmentedTabs.js +8 -57
- 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.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 -1122
- package/dist/esm/index.js +7 -1967
- package/dist/esm/metro.js +6 -459
- package/dist/esm/native/NativeInspector.d.ts +3 -0
- package/dist/esm/native/NativeInspector.js +1 -370
- package/dist/esm/native/NativeNetworkInspector.d.ts +1 -0
- 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 +2 -1
- package/dist/esm/types/enums.js +1 -147
- package/dist/esm/types/index.js +1 -2
- package/dist/esm/types/interfaces.d.ts +7 -0
- package/dist/esm/types/interfaces.js +1 -1
- package/ios/NetworkInspectorModule.mm +253 -136
- package/package.json +5 -3
- package/react-native-inapp-inspector.podspec +1 -1
- package/src/native/NativeInspector.ts +17 -0
- package/src/native/NativeNetworkInspector.ts +1 -0
- package/src/analytics.ts +0 -35
- package/src/bundle.ts +0 -25
- package/src/capture.ts +0 -101
- 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 -95
- 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 -80
- 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 -1545
- package/src/components/Inspector/LogDetail.tsx +0 -1431
- package/src/components/Inspector/MainScreen.tsx +0 -459
- package/src/components/Inspector/MediaGalleryTab.tsx +0 -355
- package/src/components/Inspector/MediaPreviewModal.tsx +0 -435
- package/src/components/Inspector/NavigationTracker.tsx +0 -13
- package/src/components/Inspector/NetworkDetail.tsx +0 -795
- 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 -4580
- package/src/components/Inspector/SkeletonPlaceholder.tsx +0 -206
- package/src/components/Inspector/StorageTab.tsx +0 -1159
- package/src/components/Inspector/TabBar.tsx +0 -263
- package/src/components/Inspector/UpdateAvailableModal.tsx +0 -555
- package/src/components/JsonViewer.tsx +0 -547
- 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 -2599
- package/src/components/QRCodeView.tsx +0 -75
- package/src/components/SectionHeader.tsx +0 -101
- package/src/components/SegmentedTabs.tsx +0 -83
- 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 -1125
- package/src/index.tsx +0 -2635
- 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 -208
- package/src/types/index.ts +0 -34
- package/src/types/interfaces.ts +0 -530
package/src/metro.ts
DELETED
|
@@ -1,598 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import os from 'os';
|
|
4
|
-
import { spawn } from 'child_process';
|
|
5
|
-
|
|
6
|
-
export interface InAppInspectorMetroOptions {
|
|
7
|
-
apkPath?: string;
|
|
8
|
-
endpoint?: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface BuildJob {
|
|
12
|
-
status: 'idle' | 'running' | 'completed' | 'failed';
|
|
13
|
-
scheme: string;
|
|
14
|
-
clean: boolean;
|
|
15
|
-
progress: number;
|
|
16
|
-
currentTask: string;
|
|
17
|
-
logs: string[];
|
|
18
|
-
error: string | null;
|
|
19
|
-
startedAt: string | null;
|
|
20
|
-
completedAt: string | null;
|
|
21
|
-
apkName: string | null;
|
|
22
|
-
apkSize: number | null;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
let activeBuildJob: BuildJob = {
|
|
26
|
-
status: 'idle',
|
|
27
|
-
scheme: 'assembleRelease',
|
|
28
|
-
clean: true,
|
|
29
|
-
progress: 0,
|
|
30
|
-
currentTask: '',
|
|
31
|
-
logs: [],
|
|
32
|
-
error: null,
|
|
33
|
-
startedAt: null,
|
|
34
|
-
completedAt: null,
|
|
35
|
-
apkName: null,
|
|
36
|
-
apkSize: null,
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Dynamically discovers all active LAN IPv4 addresses of this machine.
|
|
41
|
-
* Prioritizes Wi-Fi / Ethernet standard local subnets (192.168.x.x, 10.x.x.x, 172.16-31.x.x).
|
|
42
|
-
*/
|
|
43
|
-
export function getLanIpAddresses(): { primary: string; all: string[] } {
|
|
44
|
-
const interfaces = os.networkInterfaces();
|
|
45
|
-
const validIps: string[] = [];
|
|
46
|
-
|
|
47
|
-
for (const name of Object.keys(interfaces)) {
|
|
48
|
-
const netList = interfaces[name];
|
|
49
|
-
if (!netList) continue;
|
|
50
|
-
for (const net of netList) {
|
|
51
|
-
if (
|
|
52
|
-
(net.family === 'IPv4' || (net as any).family === 4) &&
|
|
53
|
-
!net.internal &&
|
|
54
|
-
net.address
|
|
55
|
-
) {
|
|
56
|
-
validIps.push(net.address);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const prioritized =
|
|
62
|
-
validIps.find(ip => ip.startsWith('192.168.')) ||
|
|
63
|
-
validIps.find(ip => ip.startsWith('10.')) ||
|
|
64
|
-
validIps.find(ip => /^172\.(1[6-9]|2\d|3[01])\./.test(ip)) ||
|
|
65
|
-
validIps[0] ||
|
|
66
|
-
'127.0.0.1';
|
|
67
|
-
|
|
68
|
-
return { primary: prioritized, all: validIps };
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Searches common Android build output directories for any built APK dynamically.
|
|
73
|
-
*/
|
|
74
|
-
function findDebugApk(customPath?: string): string | null {
|
|
75
|
-
if (customPath && fs.existsSync(customPath)) {
|
|
76
|
-
return customPath;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const root = process.cwd();
|
|
80
|
-
const searchCandidates = [
|
|
81
|
-
path.join(root, 'android', 'app', 'build', 'outputs', 'apk', 'release'),
|
|
82
|
-
path.join(root, 'android', 'app', 'build', 'outputs', 'apk', 'debug'),
|
|
83
|
-
path.join(root, 'example', 'android', 'app', 'build', 'outputs', 'apk', 'release'),
|
|
84
|
-
path.join(root, 'example', 'android', 'app', 'build', 'outputs', 'apk', 'debug'),
|
|
85
|
-
path.join(root, 'app', 'build', 'outputs', 'apk', 'release'),
|
|
86
|
-
path.join(root, 'app', 'build', 'outputs', 'apk', 'debug'),
|
|
87
|
-
path.join(root, 'build', 'outputs', 'apk', 'release'),
|
|
88
|
-
path.join(root, 'build', 'outputs', 'apk', 'debug'),
|
|
89
|
-
];
|
|
90
|
-
|
|
91
|
-
for (const candidate of searchCandidates) {
|
|
92
|
-
if (fs.existsSync(candidate)) {
|
|
93
|
-
const stats = fs.statSync(candidate);
|
|
94
|
-
if (stats.isFile() && candidate.endsWith('.apk')) {
|
|
95
|
-
return candidate;
|
|
96
|
-
}
|
|
97
|
-
if (stats.isDirectory()) {
|
|
98
|
-
try {
|
|
99
|
-
const files = fs.readdirSync(candidate);
|
|
100
|
-
// Find newest APK in folder
|
|
101
|
-
const apkFiles = files
|
|
102
|
-
.filter(f => f.endsWith('.apk'))
|
|
103
|
-
.map(f => ({
|
|
104
|
-
file: path.join(candidate, f),
|
|
105
|
-
mtime: fs.statSync(path.join(candidate, f)).mtimeMs,
|
|
106
|
-
}))
|
|
107
|
-
.sort((a, b) => b.mtime - a.mtime);
|
|
108
|
-
|
|
109
|
-
if (apkFiles.length > 0 && apkFiles[0]) {
|
|
110
|
-
return apkFiles[0].file;
|
|
111
|
-
}
|
|
112
|
-
} catch {}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
return null;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Dynamically discovers the project directory that contains Gradle wrapper (gradlew).
|
|
122
|
-
*/
|
|
123
|
-
function findGradleDirectory(): { dir: string; cmd: string } {
|
|
124
|
-
const root = process.cwd();
|
|
125
|
-
const isWindows = process.platform === 'win32';
|
|
126
|
-
const gradlewName = isWindows ? 'gradlew.bat' : 'gradlew';
|
|
127
|
-
|
|
128
|
-
const candidates = [
|
|
129
|
-
path.join(root, 'android'),
|
|
130
|
-
path.join(root, 'example', 'android'),
|
|
131
|
-
path.join(root, '..', 'android'),
|
|
132
|
-
root,
|
|
133
|
-
];
|
|
134
|
-
|
|
135
|
-
for (const candidate of candidates) {
|
|
136
|
-
const fullGradlew = path.join(candidate, gradlewName);
|
|
137
|
-
if (fs.existsSync(fullGradlew)) {
|
|
138
|
-
return { dir: candidate, cmd: fullGradlew };
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
return {
|
|
143
|
-
dir: path.join(root, 'android'),
|
|
144
|
-
cmd: isWindows ? 'gradlew.bat' : './gradlew',
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
let currentGradleProcess: any = null;
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Spawns Gradle build process with live progress parsing.
|
|
152
|
-
*/
|
|
153
|
-
function startGradleBuild(scheme = 'assembleRelease', clean = true): BuildJob {
|
|
154
|
-
if (activeBuildJob.status === 'running') {
|
|
155
|
-
return activeBuildJob;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
const isWindows = process.platform === 'win32';
|
|
159
|
-
const { dir: androidDir, cmd: gradlewCmd } = findGradleDirectory();
|
|
160
|
-
|
|
161
|
-
// Ensure execution permissions on macOS/Linux
|
|
162
|
-
if (!isWindows && fs.existsSync(gradlewCmd)) {
|
|
163
|
-
try {
|
|
164
|
-
fs.chmodSync(gradlewCmd, '755');
|
|
165
|
-
} catch {}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
const args = clean ? ['clean', scheme, '--console=plain'] : [scheme, '--console=plain'];
|
|
169
|
-
|
|
170
|
-
activeBuildJob = {
|
|
171
|
-
status: 'running',
|
|
172
|
-
scheme,
|
|
173
|
-
clean,
|
|
174
|
-
progress: 5,
|
|
175
|
-
currentTask: clean ? 'Cleaning build cache...' : 'Starting build...',
|
|
176
|
-
logs: [
|
|
177
|
-
`š Initializing Gradle build (${scheme})...`,
|
|
178
|
-
`š Working Directory: ${androidDir}`,
|
|
179
|
-
clean ? 'š§¹ Running: gradlew clean ' + scheme : 'ā” Running: gradlew ' + scheme,
|
|
180
|
-
],
|
|
181
|
-
error: null,
|
|
182
|
-
startedAt: new Date().toISOString(),
|
|
183
|
-
completedAt: null,
|
|
184
|
-
apkName: null,
|
|
185
|
-
apkSize: null,
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
try {
|
|
189
|
-
const child = spawn(gradlewCmd, args, {
|
|
190
|
-
cwd: androidDir,
|
|
191
|
-
env: { ...process.env, CI: 'true' },
|
|
192
|
-
});
|
|
193
|
-
currentGradleProcess = child;
|
|
194
|
-
|
|
195
|
-
let taskCount = 0;
|
|
196
|
-
const estimatedTotalTasks = clean ? 42 : 32;
|
|
197
|
-
|
|
198
|
-
child.stdout.on('data', data => {
|
|
199
|
-
const output = data.toString();
|
|
200
|
-
const lines = output.split('\n');
|
|
201
|
-
|
|
202
|
-
for (const line of lines) {
|
|
203
|
-
const trimmed = line.trim();
|
|
204
|
-
if (trimmed) {
|
|
205
|
-
activeBuildJob.logs.push(trimmed);
|
|
206
|
-
if (activeBuildJob.logs.length > 150) {
|
|
207
|
-
activeBuildJob.logs.shift();
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
if (trimmed.startsWith('> Task :')) {
|
|
211
|
-
taskCount++;
|
|
212
|
-
const taskName = trimmed.replace('> Task ', '');
|
|
213
|
-
const calculatedProgress = Math.min(
|
|
214
|
-
94,
|
|
215
|
-
Math.round(10 + (taskCount / estimatedTotalTasks) * 80),
|
|
216
|
-
);
|
|
217
|
-
activeBuildJob.progress = calculatedProgress;
|
|
218
|
-
activeBuildJob.currentTask = taskName;
|
|
219
|
-
} else if (trimmed.includes('BUILD SUCCESSFUL')) {
|
|
220
|
-
activeBuildJob.progress = 98;
|
|
221
|
-
activeBuildJob.currentTask = 'Finalizing APK package...';
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
child.stderr.on('data', data => {
|
|
227
|
-
const errStr = data.toString();
|
|
228
|
-
const lines = errStr.split('\n');
|
|
229
|
-
for (const line of lines) {
|
|
230
|
-
const trimmed = line.trim();
|
|
231
|
-
if (trimmed) {
|
|
232
|
-
activeBuildJob.logs.push(trimmed);
|
|
233
|
-
if (activeBuildJob.logs.length > 150) {
|
|
234
|
-
activeBuildJob.logs.shift();
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
if (errStr.includes('FAILURE') || errStr.includes('error:')) {
|
|
239
|
-
activeBuildJob.error = (activeBuildJob.error || '') + errStr.slice(0, 300);
|
|
240
|
-
}
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
child.on('close', code => {
|
|
244
|
-
currentGradleProcess = null;
|
|
245
|
-
activeBuildJob.completedAt = new Date().toISOString();
|
|
246
|
-
if (code === 0) {
|
|
247
|
-
activeBuildJob.status = 'completed';
|
|
248
|
-
activeBuildJob.progress = 100;
|
|
249
|
-
activeBuildJob.currentTask = 'Build finished successfully!';
|
|
250
|
-
activeBuildJob.logs.push('⨠BUILD SUCCESSFUL! APK generated.');
|
|
251
|
-
const apk = findDebugApk();
|
|
252
|
-
if (apk && fs.existsSync(apk)) {
|
|
253
|
-
const stats = fs.statSync(apk);
|
|
254
|
-
activeBuildJob.apkName = path.basename(apk);
|
|
255
|
-
activeBuildJob.apkSize = stats.size;
|
|
256
|
-
}
|
|
257
|
-
} else {
|
|
258
|
-
activeBuildJob.status = 'failed';
|
|
259
|
-
activeBuildJob.currentTask = 'Build failed';
|
|
260
|
-
activeBuildJob.logs.push(`ā Gradle build failed with exit code ${code}`);
|
|
261
|
-
if (!activeBuildJob.error) {
|
|
262
|
-
activeBuildJob.error = `Gradle exited with code ${code}`;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
child.on('error', err => {
|
|
268
|
-
currentGradleProcess = null;
|
|
269
|
-
activeBuildJob.status = 'failed';
|
|
270
|
-
activeBuildJob.error = err.message;
|
|
271
|
-
activeBuildJob.currentTask = 'Failed to spawn Gradle';
|
|
272
|
-
activeBuildJob.logs.push(`ā Failed to spawn Gradle: ${err.message}`);
|
|
273
|
-
});
|
|
274
|
-
} catch (err: any) {
|
|
275
|
-
currentGradleProcess = null;
|
|
276
|
-
activeBuildJob.status = 'failed';
|
|
277
|
-
activeBuildJob.error = err?.message || 'Unknown spawn error';
|
|
278
|
-
activeBuildJob.currentTask = 'Error launching build';
|
|
279
|
-
activeBuildJob.logs.push(`ā Error: ${err?.message || 'Unknown spawn error'}`);
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
return activeBuildJob;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* Stops any actively running Gradle build process.
|
|
287
|
-
*/
|
|
288
|
-
export function stopGradleBuild(): BuildJob {
|
|
289
|
-
if (currentGradleProcess) {
|
|
290
|
-
try {
|
|
291
|
-
if (process.platform === 'win32') {
|
|
292
|
-
const { exec } = require('child_process');
|
|
293
|
-
exec(`taskkill /pid ${currentGradleProcess.pid} /T /F`);
|
|
294
|
-
} else {
|
|
295
|
-
currentGradleProcess.kill('SIGTERM');
|
|
296
|
-
setTimeout(() => {
|
|
297
|
-
try {
|
|
298
|
-
currentGradleProcess?.kill('SIGKILL');
|
|
299
|
-
} catch {}
|
|
300
|
-
}, 1000);
|
|
301
|
-
}
|
|
302
|
-
} catch {}
|
|
303
|
-
currentGradleProcess = null;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
activeBuildJob.status = 'idle';
|
|
307
|
-
activeBuildJob.currentTask = 'Build cancelled';
|
|
308
|
-
activeBuildJob.error = 'Build cancelled by user';
|
|
309
|
-
activeBuildJob.logs.push('š Build cancelled by user.');
|
|
310
|
-
activeBuildJob.completedAt = new Date().toISOString();
|
|
311
|
-
return activeBuildJob;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
/**
|
|
315
|
-
* Metro Bundler Middleware for react-native-inapp-inspector.
|
|
316
|
-
* Automatically serves debug APK directly from Metro dev server (port 8081)
|
|
317
|
-
* with ZERO extra commands or servers needed.
|
|
318
|
-
* Dynamic IP, port, and APK filename detection included.
|
|
319
|
-
*/
|
|
320
|
-
export function withInAppInspector(
|
|
321
|
-
metroConfig: any = {},
|
|
322
|
-
options: InAppInspectorMetroOptions = {},
|
|
323
|
-
): any {
|
|
324
|
-
const customMiddleware = (req: any, res: any, next: any) => {
|
|
325
|
-
const url = req.url || '';
|
|
326
|
-
const cleanUrl = url.split('?')[0];
|
|
327
|
-
const serverPort = req.socket?.localPort || 8081;
|
|
328
|
-
const { primary: hostIp, all: allIps } = getLanIpAddresses();
|
|
329
|
-
|
|
330
|
-
// Build status endpoint
|
|
331
|
-
if (cleanUrl === '/__inapp_inspector/build-status') {
|
|
332
|
-
res.writeHead(200, {
|
|
333
|
-
'Content-Type': 'application/json',
|
|
334
|
-
'Access-Control-Allow-Origin': '*',
|
|
335
|
-
});
|
|
336
|
-
return res.end(JSON.stringify(activeBuildJob));
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
// Stop / Cancel Build endpoint
|
|
340
|
-
if (
|
|
341
|
-
cleanUrl === '/__inapp_inspector/stop-build' ||
|
|
342
|
-
cleanUrl === '/__inapp_inspector/cancel-build'
|
|
343
|
-
) {
|
|
344
|
-
const job = stopGradleBuild();
|
|
345
|
-
res.writeHead(200, {
|
|
346
|
-
'Content-Type': 'application/json',
|
|
347
|
-
'Access-Control-Allow-Origin': '*',
|
|
348
|
-
});
|
|
349
|
-
return res.end(JSON.stringify(job));
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
// Build trigger endpoint (POST or GET with query params: scheme=assembleRelease&clean=true)
|
|
353
|
-
if (cleanUrl === '/__inapp_inspector/build-apk') {
|
|
354
|
-
res.writeHead(200, {
|
|
355
|
-
'Content-Type': 'application/json',
|
|
356
|
-
'Access-Control-Allow-Origin': '*',
|
|
357
|
-
});
|
|
358
|
-
const queryParams = new URLSearchParams(url.includes('?') ? url.split('?')[1] : '');
|
|
359
|
-
const scheme = queryParams.get('scheme') || 'assembleRelease';
|
|
360
|
-
const clean = queryParams.get('clean') !== 'false';
|
|
361
|
-
|
|
362
|
-
const job = startGradleBuild(scheme, clean);
|
|
363
|
-
return res.end(JSON.stringify(job));
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
// Status / Dynamic telemetry endpoint
|
|
367
|
-
if (
|
|
368
|
-
cleanUrl === '/__inapp_inspector/status' ||
|
|
369
|
-
cleanUrl === '/__inapp_inspector/apk-info'
|
|
370
|
-
) {
|
|
371
|
-
const apk = findDebugApk(options.apkPath);
|
|
372
|
-
res.writeHead(200, {
|
|
373
|
-
'Content-Type': 'application/json',
|
|
374
|
-
'Access-Control-Allow-Origin': '*',
|
|
375
|
-
});
|
|
376
|
-
const apkName = apk ? path.basename(apk) : 'app-debug.apk';
|
|
377
|
-
const dynamicApkUrl = `http://${hostIp}:${serverPort}/${apkName}`;
|
|
378
|
-
|
|
379
|
-
if (apk && fs.existsSync(apk)) {
|
|
380
|
-
const stats = fs.statSync(apk);
|
|
381
|
-
return res.end(
|
|
382
|
-
JSON.stringify({
|
|
383
|
-
status: 'ready',
|
|
384
|
-
hasApk: true,
|
|
385
|
-
hostIp,
|
|
386
|
-
allIps,
|
|
387
|
-
port: serverPort,
|
|
388
|
-
apkName,
|
|
389
|
-
apkUrl: dynamicApkUrl,
|
|
390
|
-
apkSize: stats.size,
|
|
391
|
-
apkSizeBytes: stats.size,
|
|
392
|
-
modifiedAt: stats.mtime.toISOString(),
|
|
393
|
-
}),
|
|
394
|
-
);
|
|
395
|
-
} else {
|
|
396
|
-
return res.end(
|
|
397
|
-
JSON.stringify({
|
|
398
|
-
status: 'ready',
|
|
399
|
-
hasApk: false,
|
|
400
|
-
hostIp,
|
|
401
|
-
allIps,
|
|
402
|
-
port: serverPort,
|
|
403
|
-
apkName,
|
|
404
|
-
apkUrl: dynamicApkUrl,
|
|
405
|
-
message:
|
|
406
|
-
'Debug APK not built yet. Run ./gradlew assembleDebug inside android directory.',
|
|
407
|
-
}),
|
|
408
|
-
);
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
// Direct APK download endpoint (matches /app-debug.apk, /__inapp_inspector/apk, or any *.apk)
|
|
413
|
-
if (
|
|
414
|
-
cleanUrl === '/app-debug.apk' ||
|
|
415
|
-
cleanUrl === '/__inapp_inspector/apk' ||
|
|
416
|
-
cleanUrl.endsWith('.apk') ||
|
|
417
|
-
(options.endpoint && cleanUrl === options.endpoint)
|
|
418
|
-
) {
|
|
419
|
-
const apk = findDebugApk(options.apkPath);
|
|
420
|
-
if (apk && fs.existsSync(apk)) {
|
|
421
|
-
const stats = fs.statSync(apk);
|
|
422
|
-
const fileName = path.basename(apk);
|
|
423
|
-
res.writeHead(200, {
|
|
424
|
-
'Content-Type': 'application/vnd.android.package-archive',
|
|
425
|
-
'Content-Disposition': `attachment; filename="${fileName}"`,
|
|
426
|
-
'Content-Length': stats.size,
|
|
427
|
-
'Access-Control-Allow-Origin': '*',
|
|
428
|
-
});
|
|
429
|
-
return fs.createReadStream(apk).pipe(res);
|
|
430
|
-
} else {
|
|
431
|
-
res.writeHead(404, {
|
|
432
|
-
'Content-Type': 'text/html; charset=utf-8',
|
|
433
|
-
'Access-Control-Allow-Origin': '*',
|
|
434
|
-
});
|
|
435
|
-
return res.end(`
|
|
436
|
-
<!DOCTYPE html>
|
|
437
|
-
<html>
|
|
438
|
-
<head><title>Debug APK Not Found</title></head>
|
|
439
|
-
<body style="font-family: sans-serif; padding: 30px; text-align: center;">
|
|
440
|
-
<h2>Debug APK not built yet</h2>
|
|
441
|
-
<p>Please build the debug APK on your computer:</p>
|
|
442
|
-
<pre style="background: #f4f4f5; padding: 12px; display: inline-block; border-radius: 6px;">cd android && ./gradlew assembleDebug</pre>
|
|
443
|
-
<p>Once built, refresh this page or re-scan the QR code to install!</p>
|
|
444
|
-
</body>
|
|
445
|
-
</html>
|
|
446
|
-
`);
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
return next();
|
|
451
|
-
};
|
|
452
|
-
|
|
453
|
-
const prevEnhanceMiddleware = metroConfig.server?.enhanceMiddleware;
|
|
454
|
-
metroConfig.server = metroConfig.server || {};
|
|
455
|
-
metroConfig.server.enhanceMiddleware = (middleware: any, server: any) => {
|
|
456
|
-
const enhanced = prevEnhanceMiddleware
|
|
457
|
-
? prevEnhanceMiddleware(middleware, server)
|
|
458
|
-
: middleware;
|
|
459
|
-
return (req: any, res: any, next: any) => {
|
|
460
|
-
customMiddleware(req, res, () => {
|
|
461
|
-
if (typeof enhanced === 'function') {
|
|
462
|
-
return enhanced(req, res, next);
|
|
463
|
-
}
|
|
464
|
-
return next();
|
|
465
|
-
});
|
|
466
|
-
};
|
|
467
|
-
};
|
|
468
|
-
|
|
469
|
-
return metroConfig;
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
/**
|
|
473
|
-
* Starts a standalone zero-config APK & telemetry HTTP server on any port (default: 8083).
|
|
474
|
-
* Perfect when you don't want to edit metro.config.js.
|
|
475
|
-
*/
|
|
476
|
-
export function startStandaloneServer(port = 8083): any {
|
|
477
|
-
const http = require('http');
|
|
478
|
-
const { primary: hostIp, all: allIps } = getLanIpAddresses();
|
|
479
|
-
|
|
480
|
-
const server = http.createServer((req: any, res: any) => {
|
|
481
|
-
const url = req.url || '';
|
|
482
|
-
const cleanUrl = url.split('?')[0];
|
|
483
|
-
// Build status endpoint
|
|
484
|
-
if (cleanUrl === '/__inapp_inspector/build-status') {
|
|
485
|
-
res.writeHead(200, {
|
|
486
|
-
'Content-Type': 'application/json',
|
|
487
|
-
'Access-Control-Allow-Origin': '*',
|
|
488
|
-
});
|
|
489
|
-
return res.end(JSON.stringify(activeBuildJob));
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
// Stop / Cancel Build endpoint
|
|
493
|
-
if (
|
|
494
|
-
cleanUrl === '/__inapp_inspector/stop-build' ||
|
|
495
|
-
cleanUrl === '/__inapp_inspector/cancel-build'
|
|
496
|
-
) {
|
|
497
|
-
const job = stopGradleBuild();
|
|
498
|
-
res.writeHead(200, {
|
|
499
|
-
'Content-Type': 'application/json',
|
|
500
|
-
'Access-Control-Allow-Origin': '*',
|
|
501
|
-
});
|
|
502
|
-
return res.end(JSON.stringify(job));
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
// Build trigger endpoint (POST or GET with query params: scheme=assembleRelease&clean=true)
|
|
506
|
-
if (cleanUrl === '/__inapp_inspector/build-apk') {
|
|
507
|
-
res.writeHead(200, {
|
|
508
|
-
'Content-Type': 'application/json',
|
|
509
|
-
'Access-Control-Allow-Origin': '*',
|
|
510
|
-
});
|
|
511
|
-
const queryParams = new URLSearchParams(url.includes('?') ? url.split('?')[1] : '');
|
|
512
|
-
const scheme = queryParams.get('scheme') || 'assembleRelease';
|
|
513
|
-
const clean = queryParams.get('clean') !== 'false';
|
|
514
|
-
|
|
515
|
-
const job = startGradleBuild(scheme, clean);
|
|
516
|
-
return res.end(JSON.stringify(job));
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
// Status / Health check
|
|
520
|
-
if (
|
|
521
|
-
cleanUrl === '/__inapp_inspector/status' ||
|
|
522
|
-
cleanUrl === '/__inapp_inspector/apk-info' ||
|
|
523
|
-
cleanUrl === '/apk-info'
|
|
524
|
-
) {
|
|
525
|
-
const apk = findDebugApk();
|
|
526
|
-
res.writeHead(200, {
|
|
527
|
-
'Content-Type': 'application/json',
|
|
528
|
-
'Access-Control-Allow-Origin': '*',
|
|
529
|
-
});
|
|
530
|
-
const apkName = apk ? path.basename(apk) : 'app-debug.apk';
|
|
531
|
-
const dynamicApkUrl = `http://${hostIp}:${port}/${apkName}`;
|
|
532
|
-
|
|
533
|
-
if (apk && fs.existsSync(apk)) {
|
|
534
|
-
const stats = fs.statSync(apk);
|
|
535
|
-
return res.end(
|
|
536
|
-
JSON.stringify({
|
|
537
|
-
status: 'ready',
|
|
538
|
-
hasApk: true,
|
|
539
|
-
hostIp,
|
|
540
|
-
allIps,
|
|
541
|
-
port,
|
|
542
|
-
apkName,
|
|
543
|
-
apkUrl: dynamicApkUrl,
|
|
544
|
-
apkSize: stats.size,
|
|
545
|
-
apkSizeBytes: stats.size,
|
|
546
|
-
modifiedAt: stats.mtime.toISOString(),
|
|
547
|
-
}),
|
|
548
|
-
);
|
|
549
|
-
} else {
|
|
550
|
-
return res.end(
|
|
551
|
-
JSON.stringify({
|
|
552
|
-
status: 'ready',
|
|
553
|
-
hasApk: false,
|
|
554
|
-
hostIp,
|
|
555
|
-
allIps,
|
|
556
|
-
port,
|
|
557
|
-
apkName,
|
|
558
|
-
apkUrl: dynamicApkUrl,
|
|
559
|
-
message:
|
|
560
|
-
'Debug APK not built yet. Run ./gradlew assembleDebug inside android directory.',
|
|
561
|
-
}),
|
|
562
|
-
);
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
// Direct APK download
|
|
567
|
-
if (
|
|
568
|
-
cleanUrl === '/app-debug.apk' ||
|
|
569
|
-
cleanUrl === '/__inapp_inspector/apk' ||
|
|
570
|
-
cleanUrl.endsWith('.apk')
|
|
571
|
-
) {
|
|
572
|
-
const apk = findDebugApk();
|
|
573
|
-
if (apk && fs.existsSync(apk)) {
|
|
574
|
-
const stats = fs.statSync(apk);
|
|
575
|
-
const fileName = path.basename(apk);
|
|
576
|
-
res.writeHead(200, {
|
|
577
|
-
'Content-Type': 'application/vnd.android.package-archive',
|
|
578
|
-
'Content-Disposition': `attachment; filename="${fileName}"`,
|
|
579
|
-
'Content-Length': stats.size,
|
|
580
|
-
'Access-Control-Allow-Origin': '*',
|
|
581
|
-
});
|
|
582
|
-
return fs.createReadStream(apk).pipe(res);
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
res.writeHead(404, { 'Content-Type': 'text/plain', 'Access-Control-Allow-Origin': '*' });
|
|
587
|
-
return res.end('Not Found');
|
|
588
|
-
});
|
|
589
|
-
|
|
590
|
-
server.listen(port, '0.0.0.0', () => {
|
|
591
|
-
console.log(`\nš¦ [InAppInspector] APK Server listening at http://0.0.0.0:${port}`);
|
|
592
|
-
console.log(`š² Dynamic LAN IP: http://${hostIp}:${port}/app-debug.apk\n`);
|
|
593
|
-
});
|
|
594
|
-
|
|
595
|
-
return server;
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
export default withInAppInspector;
|
package/src/network.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sub-module entry point: react-native-inapp-inspector/network
|
|
3
|
-
* Clean tree-shaking & isolated network logger without UI or React Context dependencies.
|
|
4
|
-
*/
|
|
5
|
-
export {
|
|
6
|
-
setupNetworkLogger,
|
|
7
|
-
clearNetworkLogs,
|
|
8
|
-
subscribeNetworkLogs,
|
|
9
|
-
getNetworkLogs,
|
|
10
|
-
setNetworkModuleEnabled,
|
|
11
|
-
getNetworkModuleEnabled,
|
|
12
|
-
setMaxNetworkLogsLimit,
|
|
13
|
-
getMaxNetworkLogsLimit,
|
|
14
|
-
pruneNetworkLogs,
|
|
15
|
-
} from './customHooks/networkLogger';
|
|
16
|
-
|
|
17
|
-
export type {
|
|
18
|
-
NetworkLog,
|
|
19
|
-
Method,
|
|
20
|
-
StatusFilter,
|
|
21
|
-
SortOrder,
|
|
22
|
-
} from './types';
|
package/src/performance.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sub-module entry point: react-native-inapp-inspector/performance
|
|
3
|
-
* Clean tree-shaking & isolated performance tracker and profiler.
|
|
4
|
-
*/
|
|
5
|
-
export {
|
|
6
|
-
usePerformanceTracker,
|
|
7
|
-
useComponentProfiler,
|
|
8
|
-
useNavigationProfiler,
|
|
9
|
-
trackComponentRender,
|
|
10
|
-
trackNavigationTransition,
|
|
11
|
-
trackHeavyTask,
|
|
12
|
-
measureAsync,
|
|
13
|
-
getHermesMemoryStats,
|
|
14
|
-
registerComponentProfile,
|
|
15
|
-
subscribeRenderProfiles,
|
|
16
|
-
getRenderProfiles,
|
|
17
|
-
logPerformanceEvent,
|
|
18
|
-
clearPerformanceEvents,
|
|
19
|
-
subscribePerformanceEvents,
|
|
20
|
-
getPerformanceEvents,
|
|
21
|
-
getInitialRenderProfiles,
|
|
22
|
-
getInitialPerformanceEvents,
|
|
23
|
-
generateFixSnippet,
|
|
24
|
-
setPerformanceModuleEnabled,
|
|
25
|
-
getPerformanceModuleEnabled,
|
|
26
|
-
setMaxPerformanceEventsLimit,
|
|
27
|
-
getMaxPerformanceEventsLimit,
|
|
28
|
-
prunePerformanceEvents,
|
|
29
|
-
type PerformanceEvent,
|
|
30
|
-
type LiveMemoryStats,
|
|
31
|
-
type ComponentRenderProfile,
|
|
32
|
-
type CoreMobileVitals,
|
|
33
|
-
type PerformanceFixKey,
|
|
34
|
-
} from './customHooks/performanceTracker';
|
|
35
|
-
|
|
36
|
-
export {
|
|
37
|
-
PerformanceSubTab,
|
|
38
|
-
} from './types';
|
package/src/redux.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sub-module entry point: react-native-inapp-inspector/redux
|
|
3
|
-
* Clean tree-shaking & isolated Redux middleware and state inspector.
|
|
4
|
-
*/
|
|
5
|
-
export {
|
|
6
|
-
connectReduxStore,
|
|
7
|
-
inspectorReduxMiddleware,
|
|
8
|
-
getReduxState,
|
|
9
|
-
subscribeReduxState,
|
|
10
|
-
getActionHistory,
|
|
11
|
-
clearActionHistory,
|
|
12
|
-
getLastActionForReducer,
|
|
13
|
-
clearLastActionForReducer,
|
|
14
|
-
setReduxAutoRefresh,
|
|
15
|
-
getReduxAutoRefresh,
|
|
16
|
-
isReduxConnected,
|
|
17
|
-
setReduxModuleEnabled,
|
|
18
|
-
getReduxModuleEnabled,
|
|
19
|
-
setMaxReduxHistoryLimit,
|
|
20
|
-
getMaxReduxHistoryLimit,
|
|
21
|
-
pruneReduxHistory,
|
|
22
|
-
type ReduxHistoryEntry,
|
|
23
|
-
} from './customHooks/reduxLogger';
|
package/src/storage.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sub-module entry point: react-native-inapp-inspector/storage
|
|
3
|
-
* Universal AsyncStorage and MMKV live inspector with full CRUD operations.
|
|
4
|
-
*/
|
|
5
|
-
export {
|
|
6
|
-
connectAsyncStorage,
|
|
7
|
-
connectMMKV,
|
|
8
|
-
isAsyncStorageConnected,
|
|
9
|
-
isMMKVConnected,
|
|
10
|
-
getRegisteredMMKVInstanceIds,
|
|
11
|
-
fetchStorageEntries,
|
|
12
|
-
setStorageEntry,
|
|
13
|
-
removeStorageEntry,
|
|
14
|
-
clearStorageDriver,
|
|
15
|
-
subscribeToStorageChanges,
|
|
16
|
-
type StorageEntry,
|
|
17
|
-
type StorageDriver,
|
|
18
|
-
} from './customHooks/storageInspector';
|