react-native-debug-toolkit 3.3.0 → 3.3.2
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/ios/DebugToolkitDevConnect.mm +88 -21
- package/lib/commonjs/features/devConnect/DevConnectTab.js +182 -4
- package/lib/commonjs/features/devConnect/DevConnectTab.js.map +1 -1
- package/lib/commonjs/features/devConnect/nativeDevConnect.js +17 -8
- package/lib/commonjs/features/devConnect/nativeDevConnect.js.map +1 -1
- package/lib/module/features/devConnect/DevConnectTab.js +184 -6
- package/lib/module/features/devConnect/DevConnectTab.js.map +1 -1
- package/lib/module/features/devConnect/nativeDevConnect.js +15 -7
- package/lib/module/features/devConnect/nativeDevConnect.js.map +1 -1
- package/lib/typescript/src/features/devConnect/DevConnectTab.d.ts.map +1 -1
- package/lib/typescript/src/features/devConnect/nativeDevConnect.d.ts +8 -1
- package/lib/typescript/src/features/devConnect/nativeDevConnect.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/features/devConnect/DevConnectTab.tsx +128 -5
- package/src/features/devConnect/nativeDevConnect.ts +25 -7
|
@@ -2,6 +2,13 @@ import { NativeModules } from 'react-native';
|
|
|
2
2
|
|
|
3
3
|
import { buildMetroTarget } from './devConnectUtils';
|
|
4
4
|
|
|
5
|
+
export interface NativeDiagnostics {
|
|
6
|
+
log: string[];
|
|
7
|
+
swizzleInstalled: boolean;
|
|
8
|
+
swizzleInvoked: boolean;
|
|
9
|
+
persistedMetroHost: string | null;
|
|
10
|
+
}
|
|
11
|
+
|
|
5
12
|
interface DebugToolkitDevConnectNativeModule {
|
|
6
13
|
applyMetroHost: (hostPort: string) => Promise<{ hostPort?: string } | void>;
|
|
7
14
|
resetMetroHost: () => Promise<void>;
|
|
@@ -9,6 +16,8 @@ interface DebugToolkitDevConnectNativeModule {
|
|
|
9
16
|
getLocalIp?: () => Promise<string | null>;
|
|
10
17
|
isDebugBuild?: () => Promise<boolean>;
|
|
11
18
|
getPreference?: (key: string) => Promise<string | null>;
|
|
19
|
+
getDiagnostics?: () => Promise<NativeDiagnostics>;
|
|
20
|
+
clearDiagnostics?: () => Promise<void>;
|
|
12
21
|
}
|
|
13
22
|
|
|
14
23
|
type MetroBundleFailureReason =
|
|
@@ -154,17 +163,26 @@ export async function nativeIsDebugBuild(): Promise<boolean | null> {
|
|
|
154
163
|
}
|
|
155
164
|
}
|
|
156
165
|
|
|
157
|
-
export async function
|
|
166
|
+
export async function getNativeDiagnostics(): Promise<NativeDiagnostics | null> {
|
|
167
|
+
const nativeModule = getNativeModule();
|
|
168
|
+
if (!nativeModule?.getDiagnostics) {
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
try {
|
|
172
|
+
return await nativeModule.getDiagnostics();
|
|
173
|
+
} catch {
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export async function clearNativeDiagnostics(): Promise<void> {
|
|
158
179
|
const nativeModule = getNativeModule();
|
|
159
|
-
if (!nativeModule?.
|
|
180
|
+
if (!nativeModule?.clearDiagnostics) {
|
|
160
181
|
return;
|
|
161
182
|
}
|
|
162
183
|
try {
|
|
163
|
-
|
|
164
|
-
if (raw && typeof raw === 'string') {
|
|
165
|
-
console.info(`[${label}] Last native diagnostic:`, raw);
|
|
166
|
-
}
|
|
184
|
+
await nativeModule.clearDiagnostics();
|
|
167
185
|
} catch {
|
|
168
|
-
//
|
|
186
|
+
// best-effort
|
|
169
187
|
}
|
|
170
188
|
}
|