react-native-debug-toolkit 3.3.4 → 3.5.0
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 +48 -46
- package/README.zh-CN.md +48 -46
- package/android/src/main/java/com/reactnativedebugtoolkit/DebugToolkitDevConnectModule.java +0 -187
- package/bin/debug-toolkit.js +0 -16
- package/ios/DebugToolkitDevConnect.h +0 -12
- package/ios/DebugToolkitDevConnect.mm +0 -321
- package/lib/commonjs/constants/logLevels.js +19 -0
- package/lib/commonjs/constants/logLevels.js.map +1 -0
- package/lib/commonjs/core/initialize.js +36 -18
- package/lib/commonjs/core/initialize.js.map +1 -1
- package/lib/commonjs/features/console/ConsoleLogTab.js +4 -15
- package/lib/commonjs/features/console/ConsoleLogTab.js.map +1 -1
- package/lib/commonjs/features/console/index.js +15 -8
- package/lib/commonjs/features/console/index.js.map +1 -1
- package/lib/commonjs/features/devConnect/DevConnectTab.js +18 -470
- package/lib/commonjs/features/devConnect/DevConnectTab.js.map +1 -1
- package/lib/commonjs/features/devConnect/devConnectPreferences.js +0 -12
- package/lib/commonjs/features/devConnect/devConnectPreferences.js.map +1 -1
- package/lib/commonjs/features/devConnect/devConnectUtils.js +2 -57
- package/lib/commonjs/features/devConnect/devConnectUtils.js.map +1 -1
- package/lib/commonjs/features/devConnect/index.js +1 -23
- package/lib/commonjs/features/devConnect/index.js.map +1 -1
- package/lib/commonjs/features/devConnect/nativeDevConnect.js +1 -103
- package/lib/commonjs/features/devConnect/nativeDevConnect.js.map +1 -1
- package/lib/commonjs/features/network/NetworkLogTab.js +91 -93
- package/lib/commonjs/features/network/NetworkLogTab.js.map +1 -1
- package/lib/commonjs/features/network/index.js +7 -4
- package/lib/commonjs/features/network/index.js.map +1 -1
- package/lib/commonjs/features/sessionHistory/SessionHistoryTab.js +1044 -0
- package/lib/commonjs/features/sessionHistory/SessionHistoryTab.js.map +1 -0
- package/lib/commonjs/features/sessionHistory/index.js +103 -0
- package/lib/commonjs/features/sessionHistory/index.js.map +1 -0
- package/lib/commonjs/features/track/index.js +4 -3
- package/lib/commonjs/features/track/index.js.map +1 -1
- package/lib/commonjs/index.js +27 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/ui/DebugView.js +3 -0
- package/lib/commonjs/ui/DebugView.js.map +1 -1
- package/lib/commonjs/ui/panel/DebugPanel.js +67 -34
- package/lib/commonjs/ui/panel/DebugPanel.js.map +1 -1
- package/lib/commonjs/ui/panel/FeatureIntroCard.js +131 -0
- package/lib/commonjs/ui/panel/FeatureIntroCard.js.map +1 -0
- package/lib/commonjs/ui/panel/FeatureRail.js +163 -0
- package/lib/commonjs/ui/panel/FeatureRail.js.map +1 -0
- package/lib/commonjs/ui/panel/FloatPanelView.js +169 -32
- package/lib/commonjs/ui/panel/FloatPanelView.js.map +1 -1
- package/lib/commonjs/ui/panel/buildFeatureSummary.js +207 -0
- package/lib/commonjs/ui/panel/buildFeatureSummary.js.map +1 -0
- package/lib/commonjs/ui/panel/filterFeatureSnapshot.js +43 -0
- package/lib/commonjs/ui/panel/filterFeatureSnapshot.js.map +1 -0
- package/lib/commonjs/ui/panel/tabPersistence.js +17 -0
- package/lib/commonjs/ui/panel/tabPersistence.js.map +1 -0
- package/lib/commonjs/ui/theme/colors.js +6 -0
- package/lib/commonjs/ui/theme/colors.js.map +1 -1
- package/lib/commonjs/utils/DaemonClient.js +30 -8
- package/lib/commonjs/utils/DaemonClient.js.map +1 -1
- package/lib/commonjs/utils/SessionManager.js +132 -0
- package/lib/commonjs/utils/SessionManager.js.map +1 -0
- package/lib/commonjs/utils/StorageAdapter.js +104 -0
- package/lib/commonjs/utils/StorageAdapter.js.map +1 -0
- package/lib/commonjs/utils/createChannelFeature.js +22 -5
- package/lib/commonjs/utils/createChannelFeature.js.map +1 -1
- package/lib/commonjs/utils/createDebugTab.js +21 -0
- package/lib/commonjs/utils/createDebugTab.js.map +1 -0
- package/lib/commonjs/utils/createPersistedObservableStore.js +14 -8
- package/lib/commonjs/utils/createPersistedObservableStore.js.map +1 -1
- package/lib/commonjs/utils/debugPreferences.js +28 -6
- package/lib/commonjs/utils/debugPreferences.js.map +1 -1
- package/lib/commonjs/utils/deviceReport.js +5 -1
- package/lib/commonjs/utils/deviceReport.js.map +1 -1
- package/lib/commonjs/utils/logRuntime.js +32 -0
- package/lib/commonjs/utils/logRuntime.js.map +1 -0
- package/lib/module/constants/logLevels.js +15 -0
- package/lib/module/constants/logLevels.js.map +1 -0
- package/lib/module/core/initialize.js +36 -18
- package/lib/module/core/initialize.js.map +1 -1
- package/lib/module/features/console/ConsoleLogTab.js +1 -12
- package/lib/module/features/console/ConsoleLogTab.js.map +1 -1
- package/lib/module/features/console/index.js +15 -8
- package/lib/module/features/console/index.js.map +1 -1
- package/lib/module/features/devConnect/DevConnectTab.js +21 -473
- package/lib/module/features/devConnect/DevConnectTab.js.map +1 -1
- package/lib/module/features/devConnect/devConnectPreferences.js +1 -12
- package/lib/module/features/devConnect/devConnectPreferences.js.map +1 -1
- package/lib/module/features/devConnect/devConnectUtils.js +1 -53
- package/lib/module/features/devConnect/devConnectUtils.js.map +1 -1
- package/lib/module/features/devConnect/index.js +5 -9
- package/lib/module/features/devConnect/index.js.map +1 -1
- package/lib/module/features/devConnect/nativeDevConnect.js +1 -100
- package/lib/module/features/devConnect/nativeDevConnect.js.map +1 -1
- package/lib/module/features/network/NetworkLogTab.js +91 -93
- package/lib/module/features/network/NetworkLogTab.js.map +1 -1
- package/lib/module/features/network/index.js +7 -4
- package/lib/module/features/network/index.js.map +1 -1
- package/lib/module/features/sessionHistory/SessionHistoryTab.js +1039 -0
- package/lib/module/features/sessionHistory/SessionHistoryTab.js.map +1 -0
- package/lib/module/features/sessionHistory/index.js +99 -0
- package/lib/module/features/sessionHistory/index.js.map +1 -0
- package/lib/module/features/track/index.js +4 -3
- package/lib/module/features/track/index.js.map +1 -1
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/ui/DebugView.js +3 -0
- package/lib/module/ui/DebugView.js.map +1 -1
- package/lib/module/ui/panel/DebugPanel.js +67 -34
- package/lib/module/ui/panel/DebugPanel.js.map +1 -1
- package/lib/module/ui/panel/FeatureIntroCard.js +126 -0
- package/lib/module/ui/panel/FeatureIntroCard.js.map +1 -0
- package/lib/module/ui/panel/FeatureRail.js +158 -0
- package/lib/module/ui/panel/FeatureRail.js.map +1 -0
- package/lib/module/ui/panel/FloatPanelView.js +170 -33
- package/lib/module/ui/panel/FloatPanelView.js.map +1 -1
- package/lib/module/ui/panel/buildFeatureSummary.js +203 -0
- package/lib/module/ui/panel/buildFeatureSummary.js.map +1 -0
- package/lib/module/ui/panel/filterFeatureSnapshot.js +39 -0
- package/lib/module/ui/panel/filterFeatureSnapshot.js.map +1 -0
- package/lib/module/ui/panel/tabPersistence.js +13 -0
- package/lib/module/ui/panel/tabPersistence.js.map +1 -0
- package/lib/module/ui/theme/colors.js +6 -0
- package/lib/module/ui/theme/colors.js.map +1 -1
- package/lib/module/utils/DaemonClient.js +30 -8
- package/lib/module/utils/DaemonClient.js.map +1 -1
- package/lib/module/utils/SessionManager.js +127 -0
- package/lib/module/utils/SessionManager.js.map +1 -0
- package/lib/module/utils/StorageAdapter.js +96 -0
- package/lib/module/utils/StorageAdapter.js.map +1 -0
- package/lib/module/utils/createChannelFeature.js +22 -5
- package/lib/module/utils/createChannelFeature.js.map +1 -1
- package/lib/module/utils/createDebugTab.js +17 -0
- package/lib/module/utils/createDebugTab.js.map +1 -0
- package/lib/module/utils/createPersistedObservableStore.js +14 -8
- package/lib/module/utils/createPersistedObservableStore.js.map +1 -1
- package/lib/module/utils/debugPreferences.js +27 -6
- package/lib/module/utils/debugPreferences.js.map +1 -1
- package/lib/module/utils/deviceReport.js +4 -1
- package/lib/module/utils/deviceReport.js.map +1 -1
- package/lib/module/utils/logRuntime.js +26 -0
- package/lib/module/utils/logRuntime.js.map +1 -0
- package/lib/typescript/src/constants/logLevels.d.ts +3 -0
- package/lib/typescript/src/constants/logLevels.d.ts.map +1 -0
- package/lib/typescript/src/core/initialize.d.ts +6 -0
- package/lib/typescript/src/core/initialize.d.ts.map +1 -1
- package/lib/typescript/src/features/console/ConsoleLogTab.d.ts.map +1 -1
- package/lib/typescript/src/features/console/index.d.ts +2 -1
- package/lib/typescript/src/features/console/index.d.ts.map +1 -1
- package/lib/typescript/src/features/devConnect/DevConnectTab.d.ts.map +1 -1
- package/lib/typescript/src/features/devConnect/devConnectPreferences.d.ts +0 -2
- package/lib/typescript/src/features/devConnect/devConnectPreferences.d.ts.map +1 -1
- package/lib/typescript/src/features/devConnect/devConnectUtils.d.ts +0 -20
- package/lib/typescript/src/features/devConnect/devConnectUtils.d.ts.map +1 -1
- package/lib/typescript/src/features/devConnect/index.d.ts +2 -2
- package/lib/typescript/src/features/devConnect/index.d.ts.map +1 -1
- package/lib/typescript/src/features/devConnect/nativeDevConnect.d.ts +0 -25
- package/lib/typescript/src/features/devConnect/nativeDevConnect.d.ts.map +1 -1
- package/lib/typescript/src/features/devConnect/types.d.ts +1 -3
- package/lib/typescript/src/features/devConnect/types.d.ts.map +1 -1
- package/lib/typescript/src/features/network/NetworkLogTab.d.ts.map +1 -1
- package/lib/typescript/src/features/network/index.d.ts +2 -1
- package/lib/typescript/src/features/network/index.d.ts.map +1 -1
- package/lib/typescript/src/features/sessionHistory/SessionHistoryTab.d.ts +20 -0
- package/lib/typescript/src/features/sessionHistory/SessionHistoryTab.d.ts.map +1 -0
- package/lib/typescript/src/features/sessionHistory/index.d.ts +4 -0
- package/lib/typescript/src/features/sessionHistory/index.d.ts.map +1 -0
- package/lib/typescript/src/features/track/index.d.ts +2 -1
- package/lib/typescript/src/features/track/index.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +6 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types/feature.d.ts +1 -1
- package/lib/typescript/src/types/feature.d.ts.map +1 -1
- package/lib/typescript/src/types/index.d.ts +2 -0
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/lib/typescript/src/ui/DebugView.d.ts +4 -2
- package/lib/typescript/src/ui/DebugView.d.ts.map +1 -1
- package/lib/typescript/src/ui/panel/DebugPanel.d.ts +3 -1
- package/lib/typescript/src/ui/panel/DebugPanel.d.ts.map +1 -1
- package/lib/typescript/src/ui/panel/FeatureIntroCard.d.ts +11 -0
- package/lib/typescript/src/ui/panel/FeatureIntroCard.d.ts.map +1 -0
- package/lib/typescript/src/ui/panel/FeatureRail.d.ts +16 -0
- package/lib/typescript/src/ui/panel/FeatureRail.d.ts.map +1 -0
- package/lib/typescript/src/ui/panel/FloatPanelView.d.ts.map +1 -1
- package/lib/typescript/src/ui/panel/buildFeatureSummary.d.ts +13 -0
- package/lib/typescript/src/ui/panel/buildFeatureSummary.d.ts.map +1 -0
- package/lib/typescript/src/ui/panel/filterFeatureSnapshot.d.ts +3 -0
- package/lib/typescript/src/ui/panel/filterFeatureSnapshot.d.ts.map +1 -0
- package/lib/typescript/src/ui/panel/tabPersistence.d.ts +3 -0
- package/lib/typescript/src/ui/panel/tabPersistence.d.ts.map +1 -0
- package/lib/typescript/src/ui/theme/colors.d.ts +5 -0
- package/lib/typescript/src/ui/theme/colors.d.ts.map +1 -1
- package/lib/typescript/src/utils/DaemonClient.d.ts +7 -1
- package/lib/typescript/src/utils/DaemonClient.d.ts.map +1 -1
- package/lib/typescript/src/utils/SessionManager.d.ts +30 -0
- package/lib/typescript/src/utils/SessionManager.d.ts.map +1 -0
- package/lib/typescript/src/utils/StorageAdapter.d.ts +38 -0
- package/lib/typescript/src/utils/StorageAdapter.d.ts.map +1 -0
- package/lib/typescript/src/utils/createChannelFeature.d.ts +2 -0
- package/lib/typescript/src/utils/createChannelFeature.d.ts.map +1 -1
- package/lib/typescript/src/utils/createDebugTab.d.ts +18 -0
- package/lib/typescript/src/utils/createDebugTab.d.ts.map +1 -0
- package/lib/typescript/src/utils/createPersistedObservableStore.d.ts +4 -1
- package/lib/typescript/src/utils/createPersistedObservableStore.d.ts.map +1 -1
- package/lib/typescript/src/utils/debugPreferences.d.ts +1 -4
- package/lib/typescript/src/utils/debugPreferences.d.ts.map +1 -1
- package/lib/typescript/src/utils/deviceReport.d.ts +1 -0
- package/lib/typescript/src/utils/deviceReport.d.ts.map +1 -1
- package/lib/typescript/src/utils/logRuntime.d.ts +13 -0
- package/lib/typescript/src/utils/logRuntime.d.ts.map +1 -0
- package/package.json +10 -6
- package/src/constants/logLevels.ts +13 -0
- package/src/core/initialize.ts +61 -21
- package/src/features/console/ConsoleLogTab.tsx +1 -14
- package/src/features/console/index.ts +18 -8
- package/src/features/devConnect/DevConnectTab.tsx +17 -381
- package/src/features/devConnect/devConnectPreferences.ts +0 -15
- package/src/features/devConnect/devConnectUtils.ts +1 -81
- package/src/features/devConnect/index.ts +2 -9
- package/src/features/devConnect/nativeDevConnect.ts +1 -136
- package/src/features/devConnect/types.ts +1 -3
- package/src/features/network/NetworkLogTab.tsx +61 -71
- package/src/features/network/index.ts +12 -3
- package/src/features/sessionHistory/SessionHistoryTab.tsx +691 -0
- package/src/features/sessionHistory/index.ts +102 -0
- package/src/features/track/index.ts +10 -3
- package/src/index.ts +13 -0
- package/src/types/feature.ts +2 -1
- package/src/types/index.ts +10 -0
- package/src/ui/DebugView.tsx +6 -1
- package/src/ui/panel/DebugPanel.tsx +60 -30
- package/src/ui/panel/FeatureIntroCard.tsx +127 -0
- package/src/ui/panel/FeatureRail.tsx +165 -0
- package/src/ui/panel/FloatPanelView.tsx +176 -25
- package/src/ui/panel/buildFeatureSummary.ts +288 -0
- package/src/ui/panel/filterFeatureSnapshot.ts +51 -0
- package/src/ui/panel/tabPersistence.ts +22 -0
- package/src/ui/theme/colors.ts +7 -0
- package/src/utils/DaemonClient.ts +33 -5
- package/src/utils/SessionManager.ts +174 -0
- package/src/utils/StorageAdapter.ts +135 -0
- package/src/utils/createChannelFeature.ts +28 -6
- package/src/utils/createDebugTab.ts +32 -0
- package/src/utils/createPersistedObservableStore.ts +18 -10
- package/src/utils/debugPreferences.ts +38 -8
- package/src/utils/deviceReport.ts +5 -1
- package/src/utils/logRuntime.ts +39 -0
- package/app.plugin.js +0 -51
- package/dev-client.js +0 -3
- package/lib/commonjs/ui/panel/FeatureTabBar.js +0 -182
- package/lib/commonjs/ui/panel/FeatureTabBar.js.map +0 -1
- package/lib/module/ui/panel/FeatureTabBar.js +0 -177
- package/lib/module/ui/panel/FeatureTabBar.js.map +0 -1
- package/lib/typescript/src/ui/panel/FeatureTabBar.d.ts +0 -13
- package/lib/typescript/src/ui/panel/FeatureTabBar.d.ts.map +0 -1
- package/scripts/bundle/android.js +0 -101
- package/scripts/bundle/cli.js +0 -57
- package/scripts/bundle/doctor.js +0 -38
- package/scripts/bundle/ios.js +0 -179
- package/scripts/bundle/setup.js +0 -39
- package/scripts/debug-bundle.gradle +0 -147
- package/src/ui/panel/FeatureTabBar.tsx +0 -204
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DevConnectTab } from './DevConnectTab';
|
|
2
2
|
import { loadDevConnectPreferences } from './devConnectPreferences';
|
|
3
|
-
import { DEFAULT_DAEMON_PORT,
|
|
4
|
-
import { getDeviceLocalIp
|
|
3
|
+
import { DEFAULT_DAEMON_PORT, extractSubnetPrefix } from './devConnectUtils';
|
|
4
|
+
import { getDeviceLocalIp } from './nativeDevConnect';
|
|
5
5
|
import { isSimulator } from './platformDetect';
|
|
6
6
|
import { daemonClient } from '../../utils/DaemonClient';
|
|
7
7
|
import type { DebugFeature, DebugFeatureListener } from '../../types';
|
|
@@ -9,11 +9,9 @@ import type { DevConnectFeatureControls, DevConnectSettingsPatch, DevConnectStat
|
|
|
9
9
|
|
|
10
10
|
export type { DevConnectState } from './types';
|
|
11
11
|
export {
|
|
12
|
-
buildMetroUrls,
|
|
13
12
|
normalizeComputerHost,
|
|
14
13
|
normalizePort,
|
|
15
14
|
parseComputerTarget,
|
|
16
|
-
parseMetroQrPayload,
|
|
17
15
|
} from './devConnectUtils';
|
|
18
16
|
export {
|
|
19
17
|
loadDevConnectPreferences,
|
|
@@ -21,7 +19,6 @@ export {
|
|
|
21
19
|
saveComputerHost,
|
|
22
20
|
saveComputerTarget,
|
|
23
21
|
saveDaemonPort,
|
|
24
|
-
saveMetroPort,
|
|
25
22
|
} from './devConnectPreferences';
|
|
26
23
|
export { nativeIsDebugBuild } from './nativeDevConnect';
|
|
27
24
|
|
|
@@ -30,9 +27,7 @@ export const createDevConnectFeature = (): DebugFeature<DevConnectState> => {
|
|
|
30
27
|
let state: DevConnectState = {
|
|
31
28
|
isSimulator: isSimulator(),
|
|
32
29
|
computerHost: '',
|
|
33
|
-
metroPort: DEFAULT_METRO_PORT,
|
|
34
30
|
daemonPort: DEFAULT_DAEMON_PORT,
|
|
35
|
-
nativeMetroAvailable: isNativeDevConnectAvailable(),
|
|
36
31
|
streaming: daemonClient.isConnected(),
|
|
37
32
|
};
|
|
38
33
|
|
|
@@ -62,9 +57,7 @@ export const createDevConnectFeature = (): DebugFeature<DevConnectState> => {
|
|
|
62
57
|
state = {
|
|
63
58
|
...state,
|
|
64
59
|
computerHost: preferences.computerHost,
|
|
65
|
-
metroPort: preferences.metroPort,
|
|
66
60
|
daemonPort: preferences.daemonPort,
|
|
67
|
-
nativeMetroAvailable: isNativeDevConnectAvailable(),
|
|
68
61
|
};
|
|
69
62
|
|
|
70
63
|
if (!state.isSimulator) {
|
|
@@ -1,55 +1,14 @@
|
|
|
1
1
|
import { NativeModules } from 'react-native';
|
|
2
2
|
|
|
3
|
-
import { buildMetroTarget } from './devConnectUtils';
|
|
4
|
-
|
|
5
|
-
export interface NativeDiagnostics {
|
|
6
|
-
persistedMetroHost: string | null;
|
|
7
|
-
appDelegateClass: string;
|
|
8
|
-
// Metro host switching only works in Debug builds (RN strips the packager machinery in
|
|
9
|
-
// Release). False means the Remote JS Bundle controls should be disabled.
|
|
10
|
-
isDebugBuild: boolean;
|
|
11
|
-
hasEmbeddedBundle?: boolean;
|
|
12
|
-
embeddedFirstHookInstalled?: boolean;
|
|
13
|
-
packagerHookInstalled?: boolean;
|
|
14
|
-
bundleRootHookInstalled?: boolean;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
3
|
interface DebugToolkitDevConnectNativeModule {
|
|
18
|
-
applyMetroHost: (hostPort: string) => Promise<{ hostPort?: string } | void>;
|
|
19
|
-
resetMetroHost: () => Promise<void>;
|
|
20
|
-
getMetroHost?: () => Promise<string | null>;
|
|
21
4
|
getLocalIp?: () => Promise<string | null>;
|
|
22
5
|
isDebugBuild?: () => Promise<boolean>;
|
|
23
6
|
getPreference?: (key: string) => Promise<string | null>;
|
|
24
|
-
getDiagnostics?: () => Promise<NativeDiagnostics>;
|
|
25
7
|
}
|
|
26
8
|
|
|
27
|
-
type MetroBundleFailureReason =
|
|
28
|
-
| 'invalid_target'
|
|
29
|
-
| 'native_unavailable'
|
|
30
|
-
| 'fetch_unavailable'
|
|
31
|
-
| 'metro_unreachable'
|
|
32
|
-
| 'native_error';
|
|
33
|
-
|
|
34
|
-
export type MetroBundleResult =
|
|
35
|
-
| { ok: true; hostPort: string }
|
|
36
|
-
| { ok: false; reason: MetroBundleFailureReason; error?: string; statusUrl?: string };
|
|
37
|
-
|
|
38
|
-
type FetchLike = (
|
|
39
|
-
url: string,
|
|
40
|
-
init: { method: string },
|
|
41
|
-
) => Promise<{
|
|
42
|
-
ok?: boolean;
|
|
43
|
-
text?: () => Promise<string>;
|
|
44
|
-
}>;
|
|
45
|
-
|
|
46
9
|
function getNativeModule(): DebugToolkitDevConnectNativeModule | null {
|
|
47
10
|
const nativeModule = NativeModules.DebugToolkitDevConnect as Partial<DebugToolkitDevConnectNativeModule> | undefined;
|
|
48
|
-
if (
|
|
49
|
-
nativeModule &&
|
|
50
|
-
typeof nativeModule.applyMetroHost === 'function' &&
|
|
51
|
-
typeof nativeModule.resetMetroHost === 'function'
|
|
52
|
-
) {
|
|
11
|
+
if (nativeModule && typeof nativeModule.isDebugBuild === 'function') {
|
|
53
12
|
return nativeModule as DebugToolkitDevConnectNativeModule;
|
|
54
13
|
}
|
|
55
14
|
return null;
|
|
@@ -59,88 +18,6 @@ export function isNativeDevConnectAvailable(): boolean {
|
|
|
59
18
|
return getNativeModule() !== null;
|
|
60
19
|
}
|
|
61
20
|
|
|
62
|
-
async function checkMetroStatus(statusUrl: string): Promise<MetroBundleResult | null> {
|
|
63
|
-
const fetchImpl = globalThis.fetch as FetchLike | undefined;
|
|
64
|
-
if (!fetchImpl) {
|
|
65
|
-
return {
|
|
66
|
-
ok: false,
|
|
67
|
-
reason: 'fetch_unavailable',
|
|
68
|
-
statusUrl,
|
|
69
|
-
error: 'global fetch is not available',
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
try {
|
|
74
|
-
const response = await fetchImpl(statusUrl, { method: 'GET' });
|
|
75
|
-
const body = typeof response.text === 'function' ? await response.text() : '';
|
|
76
|
-
if (response.ok === false || !body.includes('packager-status:running')) {
|
|
77
|
-
return {
|
|
78
|
-
ok: false,
|
|
79
|
-
reason: 'metro_unreachable',
|
|
80
|
-
statusUrl,
|
|
81
|
-
error: body || 'Metro status endpoint did not report running',
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
return null;
|
|
85
|
-
} catch (error) {
|
|
86
|
-
return {
|
|
87
|
-
ok: false,
|
|
88
|
-
reason: 'metro_unreachable',
|
|
89
|
-
statusUrl,
|
|
90
|
-
error: error instanceof Error ? error.message : String(error),
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export async function applyMetroBundle(host: string, port: string): Promise<MetroBundleResult> {
|
|
96
|
-
const target = buildMetroTarget(host, port);
|
|
97
|
-
if (!target) {
|
|
98
|
-
return { ok: false, reason: 'invalid_target' };
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const nativeModule = getNativeModule();
|
|
102
|
-
if (!nativeModule) {
|
|
103
|
-
return { ok: false, reason: 'native_unavailable' };
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const statusError = await checkMetroStatus(target.statusUrl);
|
|
107
|
-
if (statusError) {
|
|
108
|
-
return statusError;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
try {
|
|
112
|
-
const result = await nativeModule.applyMetroHost(target.hostPort);
|
|
113
|
-
return {
|
|
114
|
-
ok: true,
|
|
115
|
-
hostPort: result && typeof result.hostPort === 'string' ? result.hostPort : target.hostPort,
|
|
116
|
-
};
|
|
117
|
-
} catch (error) {
|
|
118
|
-
return {
|
|
119
|
-
ok: false,
|
|
120
|
-
reason: 'native_error',
|
|
121
|
-
error: error instanceof Error ? error.message : String(error),
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export async function resetMetroBundle(): Promise<MetroBundleResult | { ok: true }> {
|
|
127
|
-
const nativeModule = getNativeModule();
|
|
128
|
-
if (!nativeModule) {
|
|
129
|
-
return { ok: false, reason: 'native_unavailable' };
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
try {
|
|
133
|
-
await nativeModule.resetMetroHost();
|
|
134
|
-
return { ok: true };
|
|
135
|
-
} catch (error) {
|
|
136
|
-
return {
|
|
137
|
-
ok: false,
|
|
138
|
-
reason: 'native_error',
|
|
139
|
-
error: error instanceof Error ? error.message : String(error),
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
21
|
export async function getDeviceLocalIp(): Promise<string | null> {
|
|
145
22
|
const nativeModule = getNativeModule();
|
|
146
23
|
if (!nativeModule?.getLocalIp) {
|
|
@@ -166,15 +43,3 @@ export async function nativeIsDebugBuild(): Promise<boolean | null> {
|
|
|
166
43
|
return null;
|
|
167
44
|
}
|
|
168
45
|
}
|
|
169
|
-
|
|
170
|
-
export async function getNativeDiagnostics(): Promise<NativeDiagnostics | null> {
|
|
171
|
-
const nativeModule = getNativeModule();
|
|
172
|
-
if (!nativeModule?.getDiagnostics) {
|
|
173
|
-
return null;
|
|
174
|
-
}
|
|
175
|
-
try {
|
|
176
|
-
return await nativeModule.getDiagnostics();
|
|
177
|
-
} catch {
|
|
178
|
-
return null;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
export interface DevConnectState {
|
|
2
2
|
isSimulator: boolean;
|
|
3
3
|
computerHost: string;
|
|
4
|
-
metroPort: string;
|
|
5
4
|
daemonPort: string;
|
|
6
5
|
subnetPrefix?: string;
|
|
7
|
-
nativeMetroAvailable: boolean;
|
|
8
6
|
streaming: boolean;
|
|
9
7
|
}
|
|
10
8
|
|
|
11
9
|
export type DevConnectSettingsPatch = Partial<
|
|
12
|
-
Pick<DevConnectState, 'computerHost' | '
|
|
10
|
+
Pick<DevConnectState, 'computerHost' | 'daemonPort'>
|
|
13
11
|
>;
|
|
14
12
|
|
|
15
13
|
export interface DevConnectFeatureControls {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import {
|
|
3
3
|
View,
|
|
4
4
|
Text,
|
|
5
5
|
StyleSheet,
|
|
6
|
-
TextInput,
|
|
7
6
|
ScrollView,
|
|
8
7
|
} from 'react-native';
|
|
9
8
|
import { Colors, getMethodColor } from '../../ui/theme/colors';
|
|
@@ -43,58 +42,38 @@ const buildCurl = (log: NetworkLogEntry): string => {
|
|
|
43
42
|
export const NetworkLogTab: React.FC<DebugFeatureRenderProps<NetworkLogEntry[]>> = React.memo(({
|
|
44
43
|
snapshot,
|
|
45
44
|
}) => {
|
|
46
|
-
const [
|
|
47
|
-
const data = snapshot;
|
|
48
|
-
|
|
49
|
-
const filtered = search
|
|
50
|
-
? data.filter(
|
|
51
|
-
(l) =>
|
|
52
|
-
l.request.url.toLowerCase().includes(search.toLowerCase()) ||
|
|
53
|
-
l.request.method.toLowerCase().includes(search.toLowerCase()),
|
|
54
|
-
)
|
|
55
|
-
: data;
|
|
56
|
-
|
|
57
|
-
const sorted = [...filtered].sort((a, b) => b.timestamp - a.timestamp);
|
|
45
|
+
const sorted = [...snapshot].sort((a, b) => b.timestamp - a.timestamp);
|
|
58
46
|
|
|
59
47
|
return (
|
|
60
48
|
<LogListScreen
|
|
61
49
|
data={sorted}
|
|
62
50
|
reversed={false}
|
|
63
51
|
emptyText="No HTTP requests logged"
|
|
64
|
-
renderListHeader={() => (
|
|
65
|
-
<View style={s.searchContainer}>
|
|
66
|
-
<View style={s.searchBar}>
|
|
67
|
-
<Text style={s.searchIcon}>⌕</Text>
|
|
68
|
-
<TextInput
|
|
69
|
-
style={s.search}
|
|
70
|
-
placeholder="Search URLs..."
|
|
71
|
-
placeholderTextColor={Colors.textLight}
|
|
72
|
-
value={search}
|
|
73
|
-
onChangeText={setSearch}
|
|
74
|
-
/>
|
|
75
|
-
</View>
|
|
76
|
-
</View>
|
|
77
|
-
)}
|
|
78
52
|
renderRow={(item) => {
|
|
79
53
|
const ok = !item.error && (!item.response || item.response.status < 400);
|
|
80
|
-
const
|
|
54
|
+
const statusColor = ok ? Colors.success : Colors.error;
|
|
55
|
+
const urlParts = formatUrlParts(item.request.url);
|
|
56
|
+
|
|
81
57
|
return (
|
|
82
58
|
<View style={s.cardRow}>
|
|
83
|
-
<View style={[s.statusIndicator, { backgroundColor:
|
|
59
|
+
<View style={[s.statusIndicator, { backgroundColor: statusColor }]} />
|
|
84
60
|
<View style={s.cardBody}>
|
|
85
|
-
<View style={s.
|
|
86
|
-
<
|
|
87
|
-
{item.request.method}
|
|
61
|
+
<View style={s.primaryRow}>
|
|
62
|
+
<View style={[s.methodChip, { backgroundColor: getMethodColor(item.request.method) }]}>
|
|
63
|
+
<Text style={s.methodChipText}>{item.request.method}</Text>
|
|
64
|
+
</View>
|
|
65
|
+
<Text style={[s.pathText, !ok && { color: Colors.error }]} numberOfLines={1}>
|
|
66
|
+
{urlParts.path}
|
|
88
67
|
</Text>
|
|
89
|
-
<View style={[s.
|
|
90
|
-
<Text style={s.
|
|
68
|
+
<View style={[s.statusChip, { backgroundColor: statusColor }]}>
|
|
69
|
+
<Text style={s.statusChipText}>{item.response?.status ?? 'ERR'}</Text>
|
|
91
70
|
</View>
|
|
92
|
-
{item.duration != null && <Text style={s.durationText}>{item.duration}ms</Text>}
|
|
93
71
|
</View>
|
|
94
|
-
<
|
|
95
|
-
{item.
|
|
96
|
-
|
|
97
|
-
|
|
72
|
+
<View style={s.metaRow}>
|
|
73
|
+
{item.duration != null && <Text style={s.metaText}>{item.duration}ms</Text>}
|
|
74
|
+
{!!urlParts.host && <Text style={[s.metaText, s.hostText]} numberOfLines={1}>{urlParts.host}</Text>}
|
|
75
|
+
<Text style={s.time}>{new Date(item.timestamp).toLocaleTimeString()}</Text>
|
|
76
|
+
</View>
|
|
98
77
|
</View>
|
|
99
78
|
</View>
|
|
100
79
|
);
|
|
@@ -185,43 +164,55 @@ export const NetworkLogTab: React.FC<DebugFeatureRenderProps<NetworkLogEntry[]>>
|
|
|
185
164
|
);
|
|
186
165
|
});
|
|
187
166
|
|
|
167
|
+
function formatUrlParts(url: string): { host: string; path: string } {
|
|
168
|
+
try {
|
|
169
|
+
const parsed = new URL(url);
|
|
170
|
+
return {
|
|
171
|
+
host: parsed.host,
|
|
172
|
+
path: parsed.pathname + parsed.search,
|
|
173
|
+
};
|
|
174
|
+
} catch {
|
|
175
|
+
return { host: '', path: url };
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
188
179
|
const s = StyleSheet.create({
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
paddingBottom: 6,
|
|
194
|
-
backgroundColor: Colors.background,
|
|
195
|
-
},
|
|
196
|
-
searchBar: {
|
|
180
|
+
cardRow: { flexDirection: 'row', padding: 12 },
|
|
181
|
+
statusIndicator: { width: 3, borderRadius: 2, marginRight: 10 },
|
|
182
|
+
cardBody: { flex: 1, gap: 7 },
|
|
183
|
+
primaryRow: {
|
|
197
184
|
flexDirection: 'row',
|
|
198
185
|
alignItems: 'center',
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
186
|
+
gap: 7,
|
|
187
|
+
minWidth: 0,
|
|
188
|
+
},
|
|
189
|
+
methodChip: {
|
|
190
|
+
paddingHorizontal: 8,
|
|
191
|
+
paddingVertical: 3,
|
|
192
|
+
borderRadius: 6,
|
|
203
193
|
},
|
|
204
|
-
|
|
205
|
-
|
|
194
|
+
methodChipText: {
|
|
195
|
+
color: '#FFF',
|
|
196
|
+
fontSize: 10,
|
|
197
|
+
fontWeight: '800',
|
|
198
|
+
},
|
|
199
|
+
pathText: {
|
|
206
200
|
flex: 1,
|
|
207
|
-
fontSize:
|
|
201
|
+
fontSize: 13,
|
|
202
|
+
fontWeight: '700',
|
|
208
203
|
color: Colors.text,
|
|
209
|
-
padding: 0,
|
|
210
204
|
},
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
url: { fontSize: 13, color: Colors.textSecondary, marginBottom: 4, lineHeight: 18 },
|
|
205
|
+
statusChip: { paddingHorizontal: 7, paddingVertical: 3, borderRadius: 6 },
|
|
206
|
+
statusChipText: { color: '#FFF', fontSize: 10, fontWeight: '800' },
|
|
207
|
+
metaRow: {
|
|
208
|
+
flexDirection: 'row',
|
|
209
|
+
alignItems: 'center',
|
|
210
|
+
gap: 7,
|
|
211
|
+
minWidth: 0,
|
|
212
|
+
},
|
|
213
|
+
metaText: { fontSize: 11, color: Colors.textSecondary, fontWeight: '600' },
|
|
214
|
+
hostText: { flex: 1 },
|
|
222
215
|
time: { fontSize: 11, color: Colors.textLight },
|
|
223
|
-
|
|
224
|
-
// Detail header
|
|
225
216
|
detailHeaderCenter: {
|
|
226
217
|
flexDirection: 'row',
|
|
227
218
|
alignItems: 'center',
|
|
@@ -236,8 +227,7 @@ const s = StyleSheet.create({
|
|
|
236
227
|
methodBadgeText: { color: '#FFF', fontSize: 12, fontWeight: '700' },
|
|
237
228
|
statusPill: { paddingHorizontal: 9, paddingVertical: 3, borderRadius: 6 },
|
|
238
229
|
statusPillText: { color: '#FFF', fontSize: 11, fontWeight: '700' },
|
|
239
|
-
|
|
240
|
-
// Detail body
|
|
230
|
+
durationText: { fontSize: 12, color: Colors.textSecondary, fontWeight: '500' },
|
|
241
231
|
detailBody: { flex: 1 },
|
|
242
232
|
detailBodyContent: { padding: 12, paddingBottom: 40 },
|
|
243
233
|
urlCard: {
|
|
@@ -3,7 +3,8 @@ import { NetworkLogTab } from './NetworkLogTab';
|
|
|
3
3
|
import type { NetworkLogEntry } from '../../types';
|
|
4
4
|
import { createChannelFeature } from '../../utils/createChannelFeature';
|
|
5
5
|
import { createEventChannel } from '../../utils/createEventChannel';
|
|
6
|
-
import {
|
|
6
|
+
import { sanitizeDebugLogEntry } from '../../utils/deviceReport';
|
|
7
|
+
import { getDefaultLogRuntime, type LogRuntimeContext } from '../../utils/logRuntime';
|
|
7
8
|
import {
|
|
8
9
|
startXMLHttpRequest,
|
|
9
10
|
resetInterceptors,
|
|
@@ -44,7 +45,10 @@ export interface NetworkFeatureConfig {
|
|
|
44
45
|
blacklist?: Array<string | RegExp>;
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
export const createNetworkFeature = (
|
|
48
|
+
export const createNetworkFeature = (
|
|
49
|
+
config?: NetworkFeatureConfig,
|
|
50
|
+
runtime: LogRuntimeContext = getDefaultLogRuntime(),
|
|
51
|
+
) => {
|
|
48
52
|
const userBlacklist = config?.blacklist ? [...config.blacklist] : [];
|
|
49
53
|
|
|
50
54
|
return createChannelFeature<NetworkLogPayload, NetworkLogEntry>(
|
|
@@ -55,7 +59,12 @@ export const createNetworkFeature = (config?: NetworkFeatureConfig) => {
|
|
|
55
59
|
label: 'Network',
|
|
56
60
|
renderContent: NetworkLogTab,
|
|
57
61
|
maxLogs: config?.maxLogs,
|
|
58
|
-
persist: {
|
|
62
|
+
persist: {
|
|
63
|
+
storage: runtime.logStorage,
|
|
64
|
+
storageKey: runtime.sessionManager.getLogStorageKey('network_logs'),
|
|
65
|
+
maxPersist: 30,
|
|
66
|
+
serialize: (entry) => sanitizeDebugLogEntry(entry),
|
|
67
|
+
},
|
|
59
68
|
beforePush: (payload) => {
|
|
60
69
|
if (isUrlBlacklisted(payload.request.url, [...userBlacklist, ...daemonEndpointBlacklist])) {
|
|
61
70
|
return null;
|