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
package/dist/commonjs/metro.js
CHANGED
|
@@ -1,352 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getLanIpAddresses = getLanIpAddresses;
|
|
7
|
-
exports.stopGradleBuild = stopGradleBuild;
|
|
8
|
-
exports.withInAppInspector = withInAppInspector;
|
|
9
|
-
exports.startStandaloneServer = startStandaloneServer;
|
|
10
|
-
const fs_1 = __importDefault(require("fs"));
|
|
11
|
-
const path_1 = __importDefault(require("path"));
|
|
12
|
-
const os_1 = __importDefault(require("os"));
|
|
13
|
-
const child_process_1 = require("child_process");
|
|
14
|
-
let activeBuildJob = {
|
|
15
|
-
status: 'idle',
|
|
16
|
-
scheme: 'assembleRelease',
|
|
17
|
-
clean: true,
|
|
18
|
-
progress: 0,
|
|
19
|
-
currentTask: '',
|
|
20
|
-
logs: [],
|
|
21
|
-
error: null,
|
|
22
|
-
startedAt: null,
|
|
23
|
-
completedAt: null,
|
|
24
|
-
apkName: null,
|
|
25
|
-
apkSize: null,
|
|
26
|
-
};
|
|
27
|
-
function getLanIpAddresses() {
|
|
28
|
-
const interfaces = os_1.default.networkInterfaces();
|
|
29
|
-
const validIps = [];
|
|
30
|
-
for (const name of Object.keys(interfaces)) {
|
|
31
|
-
const netList = interfaces[name];
|
|
32
|
-
if (!netList)
|
|
33
|
-
continue;
|
|
34
|
-
for (const net of netList) {
|
|
35
|
-
if ((net.family === 'IPv4' || net.family === 4) &&
|
|
36
|
-
!net.internal &&
|
|
37
|
-
net.address) {
|
|
38
|
-
validIps.push(net.address);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
const prioritized = validIps.find(ip => ip.startsWith('192.168.')) ||
|
|
43
|
-
validIps.find(ip => ip.startsWith('10.')) ||
|
|
44
|
-
validIps.find(ip => /^172\.(1[6-9]|2\d|3[01])\./.test(ip)) ||
|
|
45
|
-
validIps[0] ||
|
|
46
|
-
'127.0.0.1';
|
|
47
|
-
return { primary: prioritized, all: validIps };
|
|
48
|
-
}
|
|
49
|
-
function findDebugApk(customPath) {
|
|
50
|
-
if (customPath && fs_1.default.existsSync(customPath)) {
|
|
51
|
-
return customPath;
|
|
52
|
-
}
|
|
53
|
-
const root = process.cwd();
|
|
54
|
-
const searchCandidates = [
|
|
55
|
-
path_1.default.join(root, 'android', 'app', 'build', 'outputs', 'apk', 'release'),
|
|
56
|
-
path_1.default.join(root, 'android', 'app', 'build', 'outputs', 'apk', 'debug'),
|
|
57
|
-
path_1.default.join(root, 'example', 'android', 'app', 'build', 'outputs', 'apk', 'release'),
|
|
58
|
-
path_1.default.join(root, 'example', 'android', 'app', 'build', 'outputs', 'apk', 'debug'),
|
|
59
|
-
path_1.default.join(root, 'app', 'build', 'outputs', 'apk', 'release'),
|
|
60
|
-
path_1.default.join(root, 'app', 'build', 'outputs', 'apk', 'debug'),
|
|
61
|
-
path_1.default.join(root, 'build', 'outputs', 'apk', 'release'),
|
|
62
|
-
path_1.default.join(root, 'build', 'outputs', 'apk', 'debug'),
|
|
63
|
-
];
|
|
64
|
-
for (const candidate of searchCandidates) {
|
|
65
|
-
if (fs_1.default.existsSync(candidate)) {
|
|
66
|
-
const stats = fs_1.default.statSync(candidate);
|
|
67
|
-
if (stats.isFile() && candidate.endsWith('.apk')) {
|
|
68
|
-
return candidate;
|
|
69
|
-
}
|
|
70
|
-
if (stats.isDirectory()) {
|
|
71
|
-
try {
|
|
72
|
-
const files = fs_1.default.readdirSync(candidate);
|
|
73
|
-
const apkFiles = files
|
|
74
|
-
.filter(f => f.endsWith('.apk'))
|
|
75
|
-
.map(f => ({
|
|
76
|
-
file: path_1.default.join(candidate, f),
|
|
77
|
-
mtime: fs_1.default.statSync(path_1.default.join(candidate, f)).mtimeMs,
|
|
78
|
-
}))
|
|
79
|
-
.sort((a, b) => b.mtime - a.mtime);
|
|
80
|
-
if (apkFiles.length > 0 && apkFiles[0]) {
|
|
81
|
-
return apkFiles[0].file;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
catch { }
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
function findGradleDirectory() {
|
|
91
|
-
const root = process.cwd();
|
|
92
|
-
const isWindows = process.platform === 'win32';
|
|
93
|
-
const gradlewName = isWindows ? 'gradlew.bat' : 'gradlew';
|
|
94
|
-
const candidates = [
|
|
95
|
-
path_1.default.join(root, 'android'),
|
|
96
|
-
path_1.default.join(root, 'example', 'android'),
|
|
97
|
-
path_1.default.join(root, '..', 'android'),
|
|
98
|
-
root,
|
|
99
|
-
];
|
|
100
|
-
for (const candidate of candidates) {
|
|
101
|
-
const fullGradlew = path_1.default.join(candidate, gradlewName);
|
|
102
|
-
if (fs_1.default.existsSync(fullGradlew)) {
|
|
103
|
-
return { dir: candidate, cmd: fullGradlew };
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
return {
|
|
107
|
-
dir: path_1.default.join(root, 'android'),
|
|
108
|
-
cmd: isWindows ? 'gradlew.bat' : './gradlew',
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
let currentGradleProcess = null;
|
|
112
|
-
function startGradleBuild(scheme = 'assembleRelease', clean = true) {
|
|
113
|
-
if (activeBuildJob.status === 'running') {
|
|
114
|
-
return activeBuildJob;
|
|
115
|
-
}
|
|
116
|
-
const isWindows = process.platform === 'win32';
|
|
117
|
-
const { dir: androidDir, cmd: gradlewCmd } = findGradleDirectory();
|
|
118
|
-
if (!isWindows && fs_1.default.existsSync(gradlewCmd)) {
|
|
119
|
-
try {
|
|
120
|
-
fs_1.default.chmodSync(gradlewCmd, '755');
|
|
121
|
-
}
|
|
122
|
-
catch { }
|
|
123
|
-
}
|
|
124
|
-
const args = clean ? ['clean', scheme, '--console=plain'] : [scheme, '--console=plain'];
|
|
125
|
-
activeBuildJob = {
|
|
126
|
-
status: 'running',
|
|
127
|
-
scheme,
|
|
128
|
-
clean,
|
|
129
|
-
progress: 5,
|
|
130
|
-
currentTask: clean ? 'Cleaning build cache...' : 'Starting build...',
|
|
131
|
-
logs: [
|
|
132
|
-
`š Initializing Gradle build (${scheme})...`,
|
|
133
|
-
`š Working Directory: ${androidDir}`,
|
|
134
|
-
clean ? 'š§¹ Running: gradlew clean ' + scheme : 'ā” Running: gradlew ' + scheme,
|
|
135
|
-
],
|
|
136
|
-
error: null,
|
|
137
|
-
startedAt: new Date().toISOString(),
|
|
138
|
-
completedAt: null,
|
|
139
|
-
apkName: null,
|
|
140
|
-
apkSize: null,
|
|
141
|
-
};
|
|
142
|
-
try {
|
|
143
|
-
const child = (0, child_process_1.spawn)(gradlewCmd, args, {
|
|
144
|
-
cwd: androidDir,
|
|
145
|
-
env: { ...process.env, CI: 'true' },
|
|
146
|
-
});
|
|
147
|
-
currentGradleProcess = child;
|
|
148
|
-
let taskCount = 0;
|
|
149
|
-
const estimatedTotalTasks = clean ? 42 : 32;
|
|
150
|
-
child.stdout.on('data', data => {
|
|
151
|
-
const output = data.toString();
|
|
152
|
-
const lines = output.split('\n');
|
|
153
|
-
for (const line of lines) {
|
|
154
|
-
const trimmed = line.trim();
|
|
155
|
-
if (trimmed) {
|
|
156
|
-
activeBuildJob.logs.push(trimmed);
|
|
157
|
-
if (activeBuildJob.logs.length > 150) {
|
|
158
|
-
activeBuildJob.logs.shift();
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
if (trimmed.startsWith('> Task :')) {
|
|
162
|
-
taskCount++;
|
|
163
|
-
const taskName = trimmed.replace('> Task ', '');
|
|
164
|
-
const calculatedProgress = Math.min(94, Math.round(10 + (taskCount / estimatedTotalTasks) * 80));
|
|
165
|
-
activeBuildJob.progress = calculatedProgress;
|
|
166
|
-
activeBuildJob.currentTask = taskName;
|
|
167
|
-
}
|
|
168
|
-
else if (trimmed.includes('BUILD SUCCESSFUL')) {
|
|
169
|
-
activeBuildJob.progress = 98;
|
|
170
|
-
activeBuildJob.currentTask = 'Finalizing APK package...';
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
child.stderr.on('data', data => {
|
|
175
|
-
const errStr = data.toString();
|
|
176
|
-
const lines = errStr.split('\n');
|
|
177
|
-
for (const line of lines) {
|
|
178
|
-
const trimmed = line.trim();
|
|
179
|
-
if (trimmed) {
|
|
180
|
-
activeBuildJob.logs.push(trimmed);
|
|
181
|
-
if (activeBuildJob.logs.length > 150) {
|
|
182
|
-
activeBuildJob.logs.shift();
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
if (errStr.includes('FAILURE') || errStr.includes('error:')) {
|
|
187
|
-
activeBuildJob.error = (activeBuildJob.error || '') + errStr.slice(0, 300);
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
child.on('close', code => {
|
|
191
|
-
currentGradleProcess = null;
|
|
192
|
-
activeBuildJob.completedAt = new Date().toISOString();
|
|
193
|
-
if (code === 0) {
|
|
194
|
-
activeBuildJob.status = 'completed';
|
|
195
|
-
activeBuildJob.progress = 100;
|
|
196
|
-
activeBuildJob.currentTask = 'Build finished successfully!';
|
|
197
|
-
activeBuildJob.logs.push('⨠BUILD SUCCESSFUL! APK generated.');
|
|
198
|
-
const apk = findDebugApk();
|
|
199
|
-
if (apk && fs_1.default.existsSync(apk)) {
|
|
200
|
-
const stats = fs_1.default.statSync(apk);
|
|
201
|
-
activeBuildJob.apkName = path_1.default.basename(apk);
|
|
202
|
-
activeBuildJob.apkSize = stats.size;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
else {
|
|
206
|
-
activeBuildJob.status = 'failed';
|
|
207
|
-
activeBuildJob.currentTask = 'Build failed';
|
|
208
|
-
activeBuildJob.logs.push(`ā Gradle build failed with exit code ${code}`);
|
|
209
|
-
if (!activeBuildJob.error) {
|
|
210
|
-
activeBuildJob.error = `Gradle exited with code ${code}`;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
child.on('error', err => {
|
|
215
|
-
currentGradleProcess = null;
|
|
216
|
-
activeBuildJob.status = 'failed';
|
|
217
|
-
activeBuildJob.error = err.message;
|
|
218
|
-
activeBuildJob.currentTask = 'Failed to spawn Gradle';
|
|
219
|
-
activeBuildJob.logs.push(`ā Failed to spawn Gradle: ${err.message}`);
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
catch (err) {
|
|
223
|
-
currentGradleProcess = null;
|
|
224
|
-
activeBuildJob.status = 'failed';
|
|
225
|
-
activeBuildJob.error = err?.message || 'Unknown spawn error';
|
|
226
|
-
activeBuildJob.currentTask = 'Error launching build';
|
|
227
|
-
activeBuildJob.logs.push(`ā Error: ${err?.message || 'Unknown spawn error'}`);
|
|
228
|
-
}
|
|
229
|
-
return activeBuildJob;
|
|
230
|
-
}
|
|
231
|
-
function stopGradleBuild() {
|
|
232
|
-
if (currentGradleProcess) {
|
|
233
|
-
try {
|
|
234
|
-
if (process.platform === 'win32') {
|
|
235
|
-
const { exec } = require('child_process');
|
|
236
|
-
exec(`taskkill /pid ${currentGradleProcess.pid} /T /F`);
|
|
237
|
-
}
|
|
238
|
-
else {
|
|
239
|
-
currentGradleProcess.kill('SIGTERM');
|
|
240
|
-
setTimeout(() => {
|
|
241
|
-
try {
|
|
242
|
-
currentGradleProcess?.kill('SIGKILL');
|
|
243
|
-
}
|
|
244
|
-
catch { }
|
|
245
|
-
}, 1000);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
catch { }
|
|
249
|
-
currentGradleProcess = null;
|
|
250
|
-
}
|
|
251
|
-
activeBuildJob.status = 'idle';
|
|
252
|
-
activeBuildJob.currentTask = 'Build cancelled';
|
|
253
|
-
activeBuildJob.error = 'Build cancelled by user';
|
|
254
|
-
activeBuildJob.logs.push('š Build cancelled by user.');
|
|
255
|
-
activeBuildJob.completedAt = new Date().toISOString();
|
|
256
|
-
return activeBuildJob;
|
|
257
|
-
}
|
|
258
|
-
function withInAppInspector(metroConfig = {}, options = {}) {
|
|
259
|
-
const customMiddleware = (req, res, next) => {
|
|
260
|
-
const url = req.url || '';
|
|
261
|
-
const cleanUrl = url.split('?')[0];
|
|
262
|
-
const serverPort = req.socket?.localPort || 8081;
|
|
263
|
-
const { primary: hostIp, all: allIps } = getLanIpAddresses();
|
|
264
|
-
if (cleanUrl === '/__inapp_inspector/build-status') {
|
|
265
|
-
res.writeHead(200, {
|
|
266
|
-
'Content-Type': 'application/json',
|
|
267
|
-
'Access-Control-Allow-Origin': '*',
|
|
268
|
-
});
|
|
269
|
-
return res.end(JSON.stringify(activeBuildJob));
|
|
270
|
-
}
|
|
271
|
-
if (cleanUrl === '/__inapp_inspector/stop-build' ||
|
|
272
|
-
cleanUrl === '/__inapp_inspector/cancel-build') {
|
|
273
|
-
const job = stopGradleBuild();
|
|
274
|
-
res.writeHead(200, {
|
|
275
|
-
'Content-Type': 'application/json',
|
|
276
|
-
'Access-Control-Allow-Origin': '*',
|
|
277
|
-
});
|
|
278
|
-
return res.end(JSON.stringify(job));
|
|
279
|
-
}
|
|
280
|
-
if (cleanUrl === '/__inapp_inspector/build-apk') {
|
|
281
|
-
res.writeHead(200, {
|
|
282
|
-
'Content-Type': 'application/json',
|
|
283
|
-
'Access-Control-Allow-Origin': '*',
|
|
284
|
-
});
|
|
285
|
-
const queryParams = new URLSearchParams(url.includes('?') ? url.split('?')[1] : '');
|
|
286
|
-
const scheme = queryParams.get('scheme') || 'assembleRelease';
|
|
287
|
-
const clean = queryParams.get('clean') !== 'false';
|
|
288
|
-
const job = startGradleBuild(scheme, clean);
|
|
289
|
-
return res.end(JSON.stringify(job));
|
|
290
|
-
}
|
|
291
|
-
if (cleanUrl === '/__inapp_inspector/status' ||
|
|
292
|
-
cleanUrl === '/__inapp_inspector/apk-info') {
|
|
293
|
-
const apk = findDebugApk(options.apkPath);
|
|
294
|
-
res.writeHead(200, {
|
|
295
|
-
'Content-Type': 'application/json',
|
|
296
|
-
'Access-Control-Allow-Origin': '*',
|
|
297
|
-
});
|
|
298
|
-
const apkName = apk ? path_1.default.basename(apk) : 'app-debug.apk';
|
|
299
|
-
const dynamicApkUrl = `http://${hostIp}:${serverPort}/${apkName}`;
|
|
300
|
-
if (apk && fs_1.default.existsSync(apk)) {
|
|
301
|
-
const stats = fs_1.default.statSync(apk);
|
|
302
|
-
return res.end(JSON.stringify({
|
|
303
|
-
status: 'ready',
|
|
304
|
-
hasApk: true,
|
|
305
|
-
hostIp,
|
|
306
|
-
allIps,
|
|
307
|
-
port: serverPort,
|
|
308
|
-
apkName,
|
|
309
|
-
apkUrl: dynamicApkUrl,
|
|
310
|
-
apkSize: stats.size,
|
|
311
|
-
apkSizeBytes: stats.size,
|
|
312
|
-
modifiedAt: stats.mtime.toISOString(),
|
|
313
|
-
}));
|
|
314
|
-
}
|
|
315
|
-
else {
|
|
316
|
-
return res.end(JSON.stringify({
|
|
317
|
-
status: 'ready',
|
|
318
|
-
hasApk: false,
|
|
319
|
-
hostIp,
|
|
320
|
-
allIps,
|
|
321
|
-
port: serverPort,
|
|
322
|
-
apkName,
|
|
323
|
-
apkUrl: dynamicApkUrl,
|
|
324
|
-
message: 'Debug APK not built yet. Run ./gradlew assembleDebug inside android directory.',
|
|
325
|
-
}));
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
if (cleanUrl === '/app-debug.apk' ||
|
|
329
|
-
cleanUrl === '/__inapp_inspector/apk' ||
|
|
330
|
-
cleanUrl.endsWith('.apk') ||
|
|
331
|
-
(options.endpoint && cleanUrl === options.endpoint)) {
|
|
332
|
-
const apk = findDebugApk(options.apkPath);
|
|
333
|
-
if (apk && fs_1.default.existsSync(apk)) {
|
|
334
|
-
const stats = fs_1.default.statSync(apk);
|
|
335
|
-
const fileName = path_1.default.basename(apk);
|
|
336
|
-
res.writeHead(200, {
|
|
337
|
-
'Content-Type': 'application/vnd.android.package-archive',
|
|
338
|
-
'Content-Disposition': `attachment; filename="${fileName}"`,
|
|
339
|
-
'Content-Length': stats.size,
|
|
340
|
-
'Access-Control-Allow-Origin': '*',
|
|
341
|
-
});
|
|
342
|
-
return fs_1.default.createReadStream(apk).pipe(res);
|
|
343
|
-
}
|
|
344
|
-
else {
|
|
345
|
-
res.writeHead(404, {
|
|
346
|
-
'Content-Type': 'text/html; charset=utf-8',
|
|
347
|
-
'Access-Control-Allow-Origin': '*',
|
|
348
|
-
});
|
|
349
|
-
return res.end(`
|
|
1
|
+
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getLanIpAddresses=getLanIpAddresses,exports.stopGradleBuild=stopGradleBuild,exports.withInAppInspector=withInAppInspector,exports.startStandaloneServer=startStandaloneServer;const fs_1=__importDefault(require("fs")),path_1=__importDefault(require("path")),os_1=__importDefault(require("os")),child_process_1=require("child_process");let activeBuildJob={status:"idle",scheme:"assembleRelease",clean:!0,progress:0,currentTask:"",logs:[],error:null,startedAt:null,completedAt:null,apkName:null,apkSize:null};function getLanIpAddresses(){const e=os_1.default.networkInterfaces(),n=[];for(const r of Object.keys(e)){const d=e[r];if(d)for(const a of d)(a.family==="IPv4"||a.family===4)&&!a.internal&&a.address&&n.push(a.address)}return{primary:n.find(r=>r.startsWith("192.168."))||n.find(r=>r.startsWith("10."))||n.find(r=>/^172\.(1[6-9]|2\d|3[01])\./.test(r))||n[0]||"127.0.0.1",all:n}}function findDebugApk(e){if(e&&fs_1.default.existsSync(e))return e;const n=process.cwd(),f=[path_1.default.join(n,"android","app","build","outputs","apk","release"),path_1.default.join(n,"android","app","build","outputs","apk","debug"),path_1.default.join(n,"example","android","app","build","outputs","apk","release"),path_1.default.join(n,"example","android","app","build","outputs","apk","debug"),path_1.default.join(n,"app","build","outputs","apk","release"),path_1.default.join(n,"app","build","outputs","apk","debug"),path_1.default.join(n,"build","outputs","apk","release"),path_1.default.join(n,"build","outputs","apk","debug")];for(const r of f)if(fs_1.default.existsSync(r)){const d=fs_1.default.statSync(r);if(d.isFile()&&r.endsWith(".apk"))return r;if(d.isDirectory())try{const s=fs_1.default.readdirSync(r).filter(c=>c.endsWith(".apk")).map(c=>({file:path_1.default.join(r,c),mtime:fs_1.default.statSync(path_1.default.join(r,c)).mtimeMs})).sort((c,i)=>i.mtime-c.mtime);if(s.length>0&&s[0])return s[0].file}catch{}}return null}function findGradleDirectory(){const e=process.cwd(),n=process.platform==="win32",f=n?"gradlew.bat":"gradlew",r=[path_1.default.join(e,"android"),path_1.default.join(e,"example","android"),path_1.default.join(e,"..","android"),e];for(const d of r){const a=path_1.default.join(d,f);if(fs_1.default.existsSync(a))return{dir:d,cmd:a}}return{dir:path_1.default.join(e,"android"),cmd:n?"gradlew.bat":"./gradlew"}}let currentGradleProcess=null;function startGradleBuild(e="assembleRelease",n=!0){if(activeBuildJob.status==="running")return activeBuildJob;const f=process.platform==="win32",{dir:r,cmd:d}=findGradleDirectory();if(!f&&fs_1.default.existsSync(d))try{fs_1.default.chmodSync(d,"755")}catch{}const a=n?["clean",e,"--console=plain"]:[e,"--console=plain"];activeBuildJob={status:"running",scheme:e,clean:n,progress:5,currentTask:n?"Cleaning build cache...":"Starting build...",logs:[`\u{1F680} Initializing Gradle build (${e})...`,`\u{1F4C1} Working Directory: ${r}`,n?"\u{1F9F9} Running: gradlew clean "+e:"\u26A1 Running: gradlew "+e],error:null,startedAt:new Date().toISOString(),completedAt:null,apkName:null,apkSize:null};try{const s=(0,child_process_1.spawn)(d,a,{cwd:r,env:{...process.env,CI:"true"}});currentGradleProcess=s;let c=0;const i=n?42:32;s.stdout.on("data",t=>{const u=t.toString().split(`
|
|
2
|
+
`);for(const l of u){const p=l.trim();if(p&&(activeBuildJob.logs.push(p),activeBuildJob.logs.length>150&&activeBuildJob.logs.shift()),p.startsWith("> Task :")){c++;const g=p.replace("> Task ",""),m=Math.min(94,Math.round(10+c/i*80));activeBuildJob.progress=m,activeBuildJob.currentTask=g}else p.includes("BUILD SUCCESSFUL")&&(activeBuildJob.progress=98,activeBuildJob.currentTask="Finalizing APK package...")}}),s.stderr.on("data",t=>{const o=t.toString(),u=o.split(`
|
|
3
|
+
`);for(const l of u){const p=l.trim();p&&(activeBuildJob.logs.push(p),activeBuildJob.logs.length>150&&activeBuildJob.logs.shift())}(o.includes("FAILURE")||o.includes("error:"))&&(activeBuildJob.error=(activeBuildJob.error||"")+o.slice(0,300))}),s.on("close",t=>{if(currentGradleProcess=null,activeBuildJob.completedAt=new Date().toISOString(),t===0){activeBuildJob.status="completed",activeBuildJob.progress=100,activeBuildJob.currentTask="Build finished successfully!",activeBuildJob.logs.push("\u2728 BUILD SUCCESSFUL! APK generated.");const o=findDebugApk();if(o&&fs_1.default.existsSync(o)){const u=fs_1.default.statSync(o);activeBuildJob.apkName=path_1.default.basename(o),activeBuildJob.apkSize=u.size}}else activeBuildJob.status="failed",activeBuildJob.currentTask="Build failed",activeBuildJob.logs.push(`\u274C Gradle build failed with exit code ${t}`),activeBuildJob.error||(activeBuildJob.error=`Gradle exited with code ${t}`)}),s.on("error",t=>{currentGradleProcess=null,activeBuildJob.status="failed",activeBuildJob.error=t.message,activeBuildJob.currentTask="Failed to spawn Gradle",activeBuildJob.logs.push(`\u274C Failed to spawn Gradle: ${t.message}`)})}catch(s){currentGradleProcess=null,activeBuildJob.status="failed",activeBuildJob.error=s?.message||"Unknown spawn error",activeBuildJob.currentTask="Error launching build",activeBuildJob.logs.push(`\u274C Error: ${s?.message||"Unknown spawn error"}`)}return activeBuildJob}function stopGradleBuild(){if(currentGradleProcess){try{if(process.platform==="win32"){const{exec:e}=require("child_process");e(`taskkill /pid ${currentGradleProcess.pid} /T /F`)}else currentGradleProcess.kill("SIGTERM"),setTimeout(()=>{try{currentGradleProcess?.kill("SIGKILL")}catch{}},1e3)}catch{}currentGradleProcess=null}return activeBuildJob.status="idle",activeBuildJob.currentTask="Build cancelled",activeBuildJob.error="Build cancelled by user",activeBuildJob.logs.push("\u{1F6D1} Build cancelled by user."),activeBuildJob.completedAt=new Date().toISOString(),activeBuildJob}function withInAppInspector(e={},n={}){const f=(d,a,s)=>{const c=d.url||"",i=c.split("?")[0],t=d.socket?.localPort||8081,{primary:o,all:u}=getLanIpAddresses();if(i==="/__inapp_inspector/build-status")return a.writeHead(200,{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"}),a.end(JSON.stringify(activeBuildJob));if(i==="/__inapp_inspector/stop-build"||i==="/__inapp_inspector/cancel-build"){const l=stopGradleBuild();return a.writeHead(200,{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"}),a.end(JSON.stringify(l))}if(i==="/__inapp_inspector/build-apk"){a.writeHead(200,{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"});const l=new URLSearchParams(c.includes("?")?c.split("?")[1]:""),p=l.get("scheme")||"assembleRelease",g=l.get("clean")!=="false",m=startGradleBuild(p,g);return a.end(JSON.stringify(m))}if(i==="/__inapp_inspector/status"||i==="/__inapp_inspector/apk-info"){const l=findDebugApk(n.apkPath);a.writeHead(200,{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"});const p=l?path_1.default.basename(l):"app-debug.apk",g=`http://${o}:${t}/${p}`;if(l&&fs_1.default.existsSync(l)){const m=fs_1.default.statSync(l);return a.end(JSON.stringify({status:"ready",hasApk:!0,hostIp:o,allIps:u,port:t,apkName:p,apkUrl:g,apkSize:m.size,apkSizeBytes:m.size,modifiedAt:m.mtime.toISOString()}))}else return a.end(JSON.stringify({status:"ready",hasApk:!1,hostIp:o,allIps:u,port:t,apkName:p,apkUrl:g,message:"Debug APK not built yet. Run ./gradlew assembleDebug inside android directory."}))}if(i==="/app-debug.apk"||i==="/__inapp_inspector/apk"||i.endsWith(".apk")||n.endpoint&&i===n.endpoint){const l=findDebugApk(n.apkPath);if(l&&fs_1.default.existsSync(l)){const p=fs_1.default.statSync(l),g=path_1.default.basename(l);return a.writeHead(200,{"Content-Type":"application/vnd.android.package-archive","Content-Disposition":`attachment; filename="${g}"`,"Content-Length":p.size,"Access-Control-Allow-Origin":"*"}),fs_1.default.createReadStream(l).pipe(a)}else return a.writeHead(404,{"Content-Type":"text/html; charset=utf-8","Access-Control-Allow-Origin":"*"}),a.end(`
|
|
350
4
|
<!DOCTYPE html>
|
|
351
5
|
<html>
|
|
352
6
|
<head><title>Debug APK Not Found</title></head>
|
|
@@ -357,122 +11,6 @@ function withInAppInspector(metroConfig = {}, options = {}) {
|
|
|
357
11
|
<p>Once built, refresh this page or re-scan the QR code to install!</p>
|
|
358
12
|
</body>
|
|
359
13
|
</html>
|
|
360
|
-
`);
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
return next();
|
|
364
|
-
};
|
|
365
|
-
const prevEnhanceMiddleware = metroConfig.server?.enhanceMiddleware;
|
|
366
|
-
metroConfig.server = metroConfig.server || {};
|
|
367
|
-
metroConfig.server.enhanceMiddleware = (middleware, server) => {
|
|
368
|
-
const enhanced = prevEnhanceMiddleware
|
|
369
|
-
? prevEnhanceMiddleware(middleware, server)
|
|
370
|
-
: middleware;
|
|
371
|
-
return (req, res, next) => {
|
|
372
|
-
customMiddleware(req, res, () => {
|
|
373
|
-
if (typeof enhanced === 'function') {
|
|
374
|
-
return enhanced(req, res, next);
|
|
375
|
-
}
|
|
376
|
-
return next();
|
|
377
|
-
});
|
|
378
|
-
};
|
|
379
|
-
};
|
|
380
|
-
return metroConfig;
|
|
381
|
-
}
|
|
382
|
-
function startStandaloneServer(port = 8083) {
|
|
383
|
-
const http = require('http');
|
|
384
|
-
const { primary: hostIp, all: allIps } = getLanIpAddresses();
|
|
385
|
-
const server = http.createServer((req, res) => {
|
|
386
|
-
const url = req.url || '';
|
|
387
|
-
const cleanUrl = url.split('?')[0];
|
|
388
|
-
if (cleanUrl === '/__inapp_inspector/build-status') {
|
|
389
|
-
res.writeHead(200, {
|
|
390
|
-
'Content-Type': 'application/json',
|
|
391
|
-
'Access-Control-Allow-Origin': '*',
|
|
392
|
-
});
|
|
393
|
-
return res.end(JSON.stringify(activeBuildJob));
|
|
394
|
-
}
|
|
395
|
-
if (cleanUrl === '/__inapp_inspector/stop-build' ||
|
|
396
|
-
cleanUrl === '/__inapp_inspector/cancel-build') {
|
|
397
|
-
const job = stopGradleBuild();
|
|
398
|
-
res.writeHead(200, {
|
|
399
|
-
'Content-Type': 'application/json',
|
|
400
|
-
'Access-Control-Allow-Origin': '*',
|
|
401
|
-
});
|
|
402
|
-
return res.end(JSON.stringify(job));
|
|
403
|
-
}
|
|
404
|
-
if (cleanUrl === '/__inapp_inspector/build-apk') {
|
|
405
|
-
res.writeHead(200, {
|
|
406
|
-
'Content-Type': 'application/json',
|
|
407
|
-
'Access-Control-Allow-Origin': '*',
|
|
408
|
-
});
|
|
409
|
-
const queryParams = new URLSearchParams(url.includes('?') ? url.split('?')[1] : '');
|
|
410
|
-
const scheme = queryParams.get('scheme') || 'assembleRelease';
|
|
411
|
-
const clean = queryParams.get('clean') !== 'false';
|
|
412
|
-
const job = startGradleBuild(scheme, clean);
|
|
413
|
-
return res.end(JSON.stringify(job));
|
|
414
|
-
}
|
|
415
|
-
if (cleanUrl === '/__inapp_inspector/status' ||
|
|
416
|
-
cleanUrl === '/__inapp_inspector/apk-info' ||
|
|
417
|
-
cleanUrl === '/apk-info') {
|
|
418
|
-
const apk = findDebugApk();
|
|
419
|
-
res.writeHead(200, {
|
|
420
|
-
'Content-Type': 'application/json',
|
|
421
|
-
'Access-Control-Allow-Origin': '*',
|
|
422
|
-
});
|
|
423
|
-
const apkName = apk ? path_1.default.basename(apk) : 'app-debug.apk';
|
|
424
|
-
const dynamicApkUrl = `http://${hostIp}:${port}/${apkName}`;
|
|
425
|
-
if (apk && fs_1.default.existsSync(apk)) {
|
|
426
|
-
const stats = fs_1.default.statSync(apk);
|
|
427
|
-
return res.end(JSON.stringify({
|
|
428
|
-
status: 'ready',
|
|
429
|
-
hasApk: true,
|
|
430
|
-
hostIp,
|
|
431
|
-
allIps,
|
|
432
|
-
port,
|
|
433
|
-
apkName,
|
|
434
|
-
apkUrl: dynamicApkUrl,
|
|
435
|
-
apkSize: stats.size,
|
|
436
|
-
apkSizeBytes: stats.size,
|
|
437
|
-
modifiedAt: stats.mtime.toISOString(),
|
|
438
|
-
}));
|
|
439
|
-
}
|
|
440
|
-
else {
|
|
441
|
-
return res.end(JSON.stringify({
|
|
442
|
-
status: 'ready',
|
|
443
|
-
hasApk: false,
|
|
444
|
-
hostIp,
|
|
445
|
-
allIps,
|
|
446
|
-
port,
|
|
447
|
-
apkName,
|
|
448
|
-
apkUrl: dynamicApkUrl,
|
|
449
|
-
message: 'Debug APK not built yet. Run ./gradlew assembleDebug inside android directory.',
|
|
450
|
-
}));
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
if (cleanUrl === '/app-debug.apk' ||
|
|
454
|
-
cleanUrl === '/__inapp_inspector/apk' ||
|
|
455
|
-
cleanUrl.endsWith('.apk')) {
|
|
456
|
-
const apk = findDebugApk();
|
|
457
|
-
if (apk && fs_1.default.existsSync(apk)) {
|
|
458
|
-
const stats = fs_1.default.statSync(apk);
|
|
459
|
-
const fileName = path_1.default.basename(apk);
|
|
460
|
-
res.writeHead(200, {
|
|
461
|
-
'Content-Type': 'application/vnd.android.package-archive',
|
|
462
|
-
'Content-Disposition': `attachment; filename="${fileName}"`,
|
|
463
|
-
'Content-Length': stats.size,
|
|
464
|
-
'Access-Control-Allow-Origin': '*',
|
|
465
|
-
});
|
|
466
|
-
return fs_1.default.createReadStream(apk).pipe(res);
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
res.writeHead(404, { 'Content-Type': 'text/plain', 'Access-Control-Allow-Origin': '*' });
|
|
470
|
-
return res.end('Not Found');
|
|
471
|
-
});
|
|
472
|
-
server.listen(port, '0.0.0.0', () => {
|
|
473
|
-
console.log(`\nš¦ [InAppInspector] APK Server listening at http://0.0.0.0:${port}`);
|
|
474
|
-
console.log(`š² Dynamic LAN IP: http://${hostIp}:${port}/app-debug.apk\n`);
|
|
475
|
-
});
|
|
476
|
-
return server;
|
|
477
|
-
}
|
|
478
|
-
exports.default = withInAppInspector;
|
|
14
|
+
`)}return s()},r=e.server?.enhanceMiddleware;return e.server=e.server||{},e.server.enhanceMiddleware=(d,a)=>{const s=r?r(d,a):d;return(c,i,t)=>{f(c,i,()=>typeof s=="function"?s(c,i,t):t())}},e}function startStandaloneServer(e=8083){const n=require("http"),{primary:f,all:r}=getLanIpAddresses(),d=n.createServer((a,s)=>{const c=a.url||"",i=c.split("?")[0];if(i==="/__inapp_inspector/build-status")return s.writeHead(200,{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"}),s.end(JSON.stringify(activeBuildJob));if(i==="/__inapp_inspector/stop-build"||i==="/__inapp_inspector/cancel-build"){const t=stopGradleBuild();return s.writeHead(200,{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"}),s.end(JSON.stringify(t))}if(i==="/__inapp_inspector/build-apk"){s.writeHead(200,{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"});const t=new URLSearchParams(c.includes("?")?c.split("?")[1]:""),o=t.get("scheme")||"assembleRelease",u=t.get("clean")!=="false",l=startGradleBuild(o,u);return s.end(JSON.stringify(l))}if(i==="/__inapp_inspector/status"||i==="/__inapp_inspector/apk-info"||i==="/apk-info"){const t=findDebugApk();s.writeHead(200,{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"});const o=t?path_1.default.basename(t):"app-debug.apk",u=`http://${f}:${e}/${o}`;if(t&&fs_1.default.existsSync(t)){const l=fs_1.default.statSync(t);return s.end(JSON.stringify({status:"ready",hasApk:!0,hostIp:f,allIps:r,port:e,apkName:o,apkUrl:u,apkSize:l.size,apkSizeBytes:l.size,modifiedAt:l.mtime.toISOString()}))}else return s.end(JSON.stringify({status:"ready",hasApk:!1,hostIp:f,allIps:r,port:e,apkName:o,apkUrl:u,message:"Debug APK not built yet. Run ./gradlew assembleDebug inside android directory."}))}if(i==="/app-debug.apk"||i==="/__inapp_inspector/apk"||i.endsWith(".apk")){const t=findDebugApk();if(t&&fs_1.default.existsSync(t)){const o=fs_1.default.statSync(t),u=path_1.default.basename(t);return s.writeHead(200,{"Content-Type":"application/vnd.android.package-archive","Content-Disposition":`attachment; filename="${u}"`,"Content-Length":o.size,"Access-Control-Allow-Origin":"*"}),fs_1.default.createReadStream(t).pipe(s)}}return s.writeHead(404,{"Content-Type":"text/plain","Access-Control-Allow-Origin":"*"}),s.end("Not Found")});return d.listen(e,"0.0.0.0",()=>{console.log(`
|
|
15
|
+
\u{1F4E6} [InAppInspector] APK Server listening at http://0.0.0.0:${e}`),console.log(`\u{1F4F2} Dynamic LAN IP: http://${f}:${e}/app-debug.apk
|
|
16
|
+
`)}),d}exports.default=withInAppInspector;
|
|
@@ -137,3 +137,4 @@ export declare const convertNativeVideoToGif: (videoUri: string, options?: GifCo
|
|
|
137
137
|
export declare const fetchCapturedMediaList: () => Promise<CapturedMediaItem[]>;
|
|
138
138
|
export declare const deleteCapturedMediaFile: (uri: string) => Promise<boolean>;
|
|
139
139
|
export declare const clearAllCapturedMediaFiles: () => Promise<boolean>;
|
|
140
|
+
export declare const copyMediaToClipboard: (filePath: string) => Promise<boolean>;
|