react-native-inapp-inspector 2.3.5 → 2.3.6
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/dist/commonjs/analytics.d.ts +0 -4
- package/dist/commonjs/analytics.js +0 -4
- package/dist/commonjs/bundle.d.ts +0 -4
- package/dist/commonjs/bundle.js +0 -4
- package/dist/commonjs/components/AnalyticsDetail.js +18 -27
- package/dist/commonjs/components/AnalyticsEventCard.js +9 -12
- package/dist/commonjs/components/AnalyticsGraph.js +10 -15
- package/dist/commonjs/components/AppHeaderLogo.js +0 -3
- package/dist/commonjs/components/BrandCircleIcon.js +15 -15
- package/dist/commonjs/components/BrandSquareIcon.js +20 -20
- package/dist/commonjs/components/CodeSnippet.js +6 -19
- package/dist/commonjs/components/ConsoleLogCard.js +0 -1
- package/dist/commonjs/components/CopyButton.js +0 -4
- package/dist/commonjs/components/DiffViewer.js +0 -2
- package/dist/commonjs/components/DomainHeader.js +0 -4
- package/dist/commonjs/components/EmptyState.js +0 -3
- package/dist/commonjs/components/ErrorBoundary.js +5 -10
- package/dist/commonjs/components/HeadersSection.js +0 -5
- package/dist/commonjs/components/HighlightText.js +1 -4
- package/dist/commonjs/components/Inspector/AnalyticsFilterModal.js +11 -26
- package/dist/commonjs/components/Inspector/AnalyticsTab.js +34 -40
- package/dist/commonjs/components/Inspector/BundleTab.js +56 -84
- package/dist/commonjs/components/Inspector/ConsoleTab.js +7 -7
- package/dist/commonjs/components/Inspector/CrashDetail.js +18 -20
- package/dist/commonjs/components/Inspector/CrashFilterModal.js +0 -1
- package/dist/commonjs/components/Inspector/CrashTab.js +11 -20
- package/dist/commonjs/components/Inspector/DeviceInfoTab.js +12 -24
- package/dist/commonjs/components/Inspector/FabLauncher.js +1 -1
- package/dist/commonjs/components/Inspector/InspectorContext.js +0 -2
- package/dist/commonjs/components/Inspector/InspectorHeader.js +7 -8
- package/dist/commonjs/components/Inspector/LogDetail.js +27 -29
- package/dist/commonjs/components/Inspector/MainScreen.js +9 -10
- package/dist/commonjs/components/Inspector/NetworkDetail.js +10 -11
- package/dist/commonjs/components/Inspector/NetworkTab.js +14 -14
- package/dist/commonjs/components/Inspector/NpmUpdateToast.js +6 -9
- package/dist/commonjs/components/Inspector/PerformanceTab.js +30 -43
- package/dist/commonjs/components/Inspector/ReduxDetail.js +18 -34
- package/dist/commonjs/components/Inspector/ReduxTab.js +11 -20
- package/dist/commonjs/components/Inspector/SettingsPanel.js +32 -36
- package/dist/commonjs/components/Inspector/SkeletonPlaceholder.js +6 -6
- package/dist/commonjs/components/Inspector/StorageTab.js +14 -26
- package/dist/commonjs/components/Inspector/UpdateAvailableModal.js +5 -6
- package/dist/commonjs/components/JsonViewer.js +3 -10
- package/dist/commonjs/components/LogCard.js +7 -7
- package/dist/commonjs/components/MetaAccordion.js +1 -7
- package/dist/commonjs/components/NetworkIcons.js +12 -16
- package/dist/commonjs/components/SectionHeader.js +0 -4
- package/dist/commonjs/components/SkeletonPlaceholder.js +6 -6
- package/dist/commonjs/components/Slider.js +6 -6
- package/dist/commonjs/components/SourcePageCard.js +0 -4
- package/dist/commonjs/components/TreeNode.js +0 -4
- package/dist/commonjs/console.d.ts +0 -4
- package/dist/commonjs/console.js +0 -4
- package/dist/commonjs/constants/index.js +6 -9
- package/dist/commonjs/constants/telemetryConfig.d.ts +7 -0
- package/dist/commonjs/constants/telemetryConfig.js +10 -0
- package/dist/commonjs/constants/version.d.ts +1 -1
- package/dist/commonjs/constants/version.js +1 -3
- package/dist/commonjs/crash.d.ts +0 -4
- package/dist/commonjs/crash.js +0 -4
- package/dist/commonjs/customHooks/analyticsLogger.d.ts +0 -7
- package/dist/commonjs/customHooks/analyticsLogger.js +3 -59
- package/dist/commonjs/customHooks/bundleAnalyzer.d.ts +0 -9
- package/dist/commonjs/customHooks/bundleAnalyzer.js +3 -86
- package/dist/commonjs/customHooks/consoleLogger.js +0 -16
- package/dist/commonjs/customHooks/crashHandler.d.ts +0 -28
- package/dist/commonjs/customHooks/crashHandler.js +0 -55
- package/dist/commonjs/customHooks/logFilters.d.ts +0 -4
- package/dist/commonjs/customHooks/logFilters.js +0 -11
- package/dist/commonjs/customHooks/networkLogger.js +2 -13
- package/dist/commonjs/customHooks/performanceTracker.d.ts +0 -27
- package/dist/commonjs/customHooks/performanceTracker.js +0 -31
- package/dist/commonjs/customHooks/reduxLogger.d.ts +0 -12
- package/dist/commonjs/customHooks/reduxLogger.js +0 -51
- package/dist/commonjs/customHooks/storageInspector.d.ts +0 -40
- package/dist/commonjs/customHooks/storageInspector.js +1 -56
- package/dist/commonjs/decorators/index.d.ts +0 -37
- package/dist/commonjs/decorators/index.js +0 -42
- package/dist/commonjs/helpers/gaAnalyticsRegistry.d.ts +0 -10
- package/dist/commonjs/helpers/gaAnalyticsRegistry.js +0 -26
- package/dist/commonjs/helpers/index.d.ts +0 -7
- package/dist/commonjs/helpers/index.js +1 -42
- package/dist/commonjs/helpers/memoryManager.d.ts +0 -11
- package/dist/commonjs/helpers/memoryManager.js +0 -13
- package/dist/commonjs/helpers/searchQueryParser.d.ts +0 -4
- package/dist/commonjs/helpers/searchQueryParser.js +0 -18
- package/dist/commonjs/helpers/settingsStore.js +0 -8
- package/dist/commonjs/helpers/telemetry.d.ts +2 -0
- package/dist/commonjs/helpers/telemetry.js +302 -0
- package/dist/commonjs/i18n/index.d.ts +0 -9
- package/dist/commonjs/i18n/index.js +0 -15
- package/dist/commonjs/index.js +15 -97
- package/dist/commonjs/native/NativeInspector.d.ts +0 -54
- package/dist/commonjs/native/NativeInspector.js +0 -56
- package/dist/commonjs/network.d.ts +0 -4
- package/dist/commonjs/network.js +0 -4
- package/dist/commonjs/performance.d.ts +0 -4
- package/dist/commonjs/performance.js +0 -4
- package/dist/commonjs/redux.d.ts +0 -4
- package/dist/commonjs/redux.js +0 -4
- package/dist/commonjs/storage.d.ts +0 -4
- package/dist/commonjs/storage.js +0 -4
- package/dist/commonjs/styles/AppColors.d.ts +0 -3
- package/dist/commonjs/styles/AppColors.js +15 -30
- package/dist/commonjs/styles/AppFonts.d.ts +0 -4
- package/dist/commonjs/styles/AppFonts.js +0 -4
- package/dist/commonjs/styles/common.js +0 -11
- package/dist/commonjs/styles/index.js +0 -8
- package/dist/commonjs/types/enums.js +0 -3
- package/dist/commonjs/types/interfaces.d.ts +3 -3
- package/dist/esm/analytics.d.ts +0 -4
- package/dist/esm/analytics.js +0 -4
- package/dist/esm/bundle.d.ts +0 -4
- package/dist/esm/bundle.js +0 -4
- package/dist/esm/components/AnalyticsDetail.js +18 -27
- package/dist/esm/components/AnalyticsEventCard.js +9 -12
- package/dist/esm/components/AnalyticsGraph.js +10 -15
- package/dist/esm/components/AppHeaderLogo.js +0 -3
- package/dist/esm/components/BrandCircleIcon.js +15 -15
- package/dist/esm/components/BrandSquareIcon.js +20 -20
- package/dist/esm/components/CodeSnippet.js +6 -19
- package/dist/esm/components/ConsoleLogCard.js +0 -1
- package/dist/esm/components/CopyButton.js +0 -4
- package/dist/esm/components/DiffViewer.js +0 -2
- package/dist/esm/components/DomainHeader.js +0 -4
- package/dist/esm/components/EmptyState.js +0 -3
- package/dist/esm/components/ErrorBoundary.js +5 -10
- package/dist/esm/components/HeadersSection.js +0 -5
- package/dist/esm/components/HighlightText.js +1 -4
- package/dist/esm/components/Inspector/AnalyticsFilterModal.js +11 -26
- package/dist/esm/components/Inspector/AnalyticsTab.js +34 -40
- package/dist/esm/components/Inspector/BundleTab.js +56 -84
- package/dist/esm/components/Inspector/ConsoleTab.js +7 -7
- package/dist/esm/components/Inspector/CrashDetail.js +18 -20
- package/dist/esm/components/Inspector/CrashFilterModal.js +0 -1
- package/dist/esm/components/Inspector/CrashTab.js +11 -20
- package/dist/esm/components/Inspector/DeviceInfoTab.js +12 -24
- package/dist/esm/components/Inspector/FabLauncher.js +1 -1
- package/dist/esm/components/Inspector/InspectorContext.js +0 -2
- package/dist/esm/components/Inspector/InspectorHeader.js +7 -8
- package/dist/esm/components/Inspector/LogDetail.js +27 -29
- package/dist/esm/components/Inspector/MainScreen.js +9 -10
- package/dist/esm/components/Inspector/NetworkDetail.js +10 -11
- package/dist/esm/components/Inspector/NetworkTab.js +14 -14
- package/dist/esm/components/Inspector/NpmUpdateToast.js +6 -9
- package/dist/esm/components/Inspector/PerformanceTab.js +30 -43
- package/dist/esm/components/Inspector/ReduxDetail.js +18 -34
- package/dist/esm/components/Inspector/ReduxTab.js +11 -20
- package/dist/esm/components/Inspector/SettingsPanel.js +32 -36
- package/dist/esm/components/Inspector/SkeletonPlaceholder.js +6 -6
- package/dist/esm/components/Inspector/StorageTab.js +14 -26
- package/dist/esm/components/Inspector/UpdateAvailableModal.js +5 -6
- package/dist/esm/components/JsonViewer.js +3 -10
- package/dist/esm/components/LogCard.js +7 -7
- package/dist/esm/components/MetaAccordion.js +1 -7
- package/dist/esm/components/NetworkIcons.js +12 -16
- package/dist/esm/components/SectionHeader.js +0 -4
- package/dist/esm/components/SkeletonPlaceholder.js +6 -6
- package/dist/esm/components/Slider.js +6 -6
- package/dist/esm/components/SourcePageCard.js +0 -4
- package/dist/esm/components/TreeNode.js +0 -4
- package/dist/esm/console.d.ts +0 -4
- package/dist/esm/console.js +0 -4
- package/dist/esm/constants/index.js +6 -9
- package/dist/esm/constants/telemetryConfig.d.ts +7 -0
- package/dist/esm/constants/telemetryConfig.js +7 -0
- package/dist/esm/constants/version.d.ts +1 -1
- package/dist/esm/constants/version.js +1 -3
- package/dist/esm/crash.d.ts +0 -4
- package/dist/esm/crash.js +0 -4
- package/dist/esm/customHooks/analyticsLogger.d.ts +0 -7
- package/dist/esm/customHooks/analyticsLogger.js +3 -59
- package/dist/esm/customHooks/bundleAnalyzer.d.ts +0 -9
- package/dist/esm/customHooks/bundleAnalyzer.js +3 -86
- package/dist/esm/customHooks/consoleLogger.js +0 -16
- package/dist/esm/customHooks/crashHandler.d.ts +0 -28
- package/dist/esm/customHooks/crashHandler.js +0 -55
- package/dist/esm/customHooks/logFilters.d.ts +0 -4
- package/dist/esm/customHooks/logFilters.js +0 -11
- package/dist/esm/customHooks/networkLogger.js +2 -13
- package/dist/esm/customHooks/performanceTracker.d.ts +0 -27
- package/dist/esm/customHooks/performanceTracker.js +0 -31
- package/dist/esm/customHooks/reduxLogger.d.ts +0 -12
- package/dist/esm/customHooks/reduxLogger.js +0 -51
- package/dist/esm/customHooks/storageInspector.d.ts +0 -40
- package/dist/esm/customHooks/storageInspector.js +1 -56
- package/dist/esm/decorators/index.d.ts +0 -37
- package/dist/esm/decorators/index.js +0 -42
- package/dist/esm/helpers/gaAnalyticsRegistry.d.ts +0 -10
- package/dist/esm/helpers/gaAnalyticsRegistry.js +0 -26
- package/dist/esm/helpers/index.d.ts +0 -7
- package/dist/esm/helpers/index.js +1 -42
- package/dist/esm/helpers/memoryManager.d.ts +0 -11
- package/dist/esm/helpers/memoryManager.js +0 -13
- package/dist/esm/helpers/searchQueryParser.d.ts +0 -4
- package/dist/esm/helpers/searchQueryParser.js +0 -18
- package/dist/esm/helpers/settingsStore.js +0 -8
- package/dist/esm/helpers/telemetry.d.ts +2 -0
- package/dist/esm/helpers/telemetry.js +298 -0
- package/dist/esm/i18n/index.d.ts +0 -9
- package/dist/esm/i18n/index.js +0 -15
- package/dist/esm/index.js +15 -97
- package/dist/esm/native/NativeInspector.d.ts +0 -54
- package/dist/esm/native/NativeInspector.js +0 -56
- package/dist/esm/network.d.ts +0 -4
- package/dist/esm/network.js +0 -4
- package/dist/esm/performance.d.ts +0 -4
- package/dist/esm/performance.js +0 -4
- package/dist/esm/redux.d.ts +0 -4
- package/dist/esm/redux.js +0 -4
- package/dist/esm/storage.d.ts +0 -4
- package/dist/esm/storage.js +0 -4
- package/dist/esm/styles/AppColors.d.ts +0 -3
- package/dist/esm/styles/AppColors.js +15 -30
- package/dist/esm/styles/AppFonts.d.ts +0 -4
- package/dist/esm/styles/AppFonts.js +0 -4
- package/dist/esm/styles/common.js +0 -11
- package/dist/esm/styles/index.js +0 -8
- package/dist/esm/types/enums.js +0 -3
- package/dist/esm/types/interfaces.d.ts +3 -3
- package/package.json +2 -2
- package/src/constants/telemetryConfig.ts +16 -0
- package/src/constants/version.ts +1 -1
- package/src/helpers/telemetry.ts +341 -0
- package/src/index.tsx +15 -1
- package/src/types/interfaces.ts +3 -0
|
@@ -21,9 +21,7 @@ exports.getRuntimeDiagnostics = exports.getCategoryColors = exports.registerGAPl
|
|
|
21
21
|
const react_native_1 = require("react-native");
|
|
22
22
|
const clipboard_1 = __importDefault(require("@react-native-clipboard/clipboard"));
|
|
23
23
|
const toast_1 = require("./toast");
|
|
24
|
-
// Stylesheet
|
|
25
24
|
const AppColors_1 = require("../styles/AppColors");
|
|
26
|
-
// Constants
|
|
27
25
|
const constants_1 = require("../constants");
|
|
28
26
|
__exportStar(require("./searchQueryParser"), exports);
|
|
29
27
|
__exportStar(require("./memoryManager"), exports);
|
|
@@ -109,7 +107,6 @@ const copyToClipboard = (value, label) => {
|
|
|
109
107
|
textToCopy = String(resolved);
|
|
110
108
|
}
|
|
111
109
|
}
|
|
112
|
-
// Use @react-native-clipboard/clipboard npm package
|
|
113
110
|
try {
|
|
114
111
|
if (typeof clipboard_1.default?.setString === 'function') {
|
|
115
112
|
clipboard_1.default.setString(textToCopy);
|
|
@@ -123,12 +120,10 @@ const copyToClipboard = (value, label) => {
|
|
|
123
120
|
console.warn('[NetworkInspector] Clipboard.setString failed:', err);
|
|
124
121
|
}
|
|
125
122
|
}
|
|
126
|
-
// Trigger floating in-app bottom toast notification
|
|
127
123
|
try {
|
|
128
124
|
(0, toast_1.showToast)(label ? `${label} copied to clipboard` : 'Copied to clipboard');
|
|
129
125
|
}
|
|
130
126
|
catch { }
|
|
131
|
-
// Native Android Toast fallback
|
|
132
127
|
try {
|
|
133
128
|
if (react_native_1.Platform.OS === 'android' && react_native_1.ToastAndroid?.show) {
|
|
134
129
|
react_native_1.ToastAndroid.show(label ? `${label} copied to clipboard` : 'Copied to clipboard', react_native_1.ToastAndroid.SHORT);
|
|
@@ -249,7 +244,6 @@ const getNavigationInfo = (state, path = []) => {
|
|
|
249
244
|
};
|
|
250
245
|
exports.getNavigationInfo = getNavigationInfo;
|
|
251
246
|
const getLogPageName = (log, routeInfo) => {
|
|
252
|
-
// 1. If routeInfo has a valid path, resolve the leaf screen name
|
|
253
247
|
const effectiveRoute = routeInfo || log?.routeInfo;
|
|
254
248
|
if (effectiveRoute &&
|
|
255
249
|
effectiveRoute.path &&
|
|
@@ -259,11 +253,10 @@ const getLogPageName = (log, routeInfo) => {
|
|
|
259
253
|
.map((s) => s.trim())
|
|
260
254
|
.filter(Boolean);
|
|
261
255
|
if (parts.length > 0) {
|
|
262
|
-
return parts[parts.length - 1];
|
|
256
|
+
return parts[parts.length - 1];
|
|
263
257
|
}
|
|
264
258
|
return effectiveRoute.path;
|
|
265
259
|
}
|
|
266
|
-
// 2. Extract screen / component name from log.caller stack trace
|
|
267
260
|
if (log.caller && log.caller !== 'Unknown') {
|
|
268
261
|
try {
|
|
269
262
|
const match = log.caller.match(/([^/\\]+)\.(tsx|jsx|ts|js)/i);
|
|
@@ -288,7 +281,6 @@ const getLogPageName = (log, routeInfo) => {
|
|
|
288
281
|
}
|
|
289
282
|
catch (e) { }
|
|
290
283
|
}
|
|
291
|
-
// 3. Fallback to API resource / endpoint category from URL
|
|
292
284
|
if (log.url) {
|
|
293
285
|
try {
|
|
294
286
|
const cleanUrl = log.url.split('?')[0].split('#')[0];
|
|
@@ -453,17 +445,13 @@ const getBundleIdentifier = () => {
|
|
|
453
445
|
};
|
|
454
446
|
exports.getBundleIdentifier = getBundleIdentifier;
|
|
455
447
|
const getAppName = () => {
|
|
456
|
-
// Try iOS via PlatformConstants
|
|
457
448
|
const constants = react_native_1.NativeModules.PlatformConstants;
|
|
458
449
|
if (constants && typeof constants.interfaceIdiom === 'string') {
|
|
459
|
-
// Fallback: try to parse from SourceCode
|
|
460
450
|
}
|
|
461
|
-
// Try react-native-device-info
|
|
462
451
|
const RNDeviceInfo = react_native_1.NativeModules.RNDeviceInfo;
|
|
463
452
|
if (RNDeviceInfo && typeof RNDeviceInfo.appName === 'string') {
|
|
464
453
|
return RNDeviceInfo.appName;
|
|
465
454
|
}
|
|
466
|
-
// Try Expo
|
|
467
455
|
const ExpoApplication = react_native_1.NativeModules.ExpoApplication;
|
|
468
456
|
if (ExpoApplication && typeof ExpoApplication.applicationName === 'string') {
|
|
469
457
|
return ExpoApplication.applicationName;
|
|
@@ -474,17 +462,14 @@ const getAppName = () => {
|
|
|
474
462
|
if (manifest.name)
|
|
475
463
|
return manifest.name;
|
|
476
464
|
}
|
|
477
|
-
// Android: try to get from AndroidInfoModule
|
|
478
465
|
const AppInfo = react_native_1.NativeModules.AppInfo;
|
|
479
466
|
if (AppInfo && typeof AppInfo.appName === 'string') {
|
|
480
467
|
return AppInfo.appName;
|
|
481
468
|
}
|
|
482
|
-
// Fallback: derive from bundle ID (last segment, cleaned up)
|
|
483
469
|
const bundleId = (0, exports.getBundleIdentifier)();
|
|
484
470
|
if (bundleId && bundleId !== 'org.reactjs.native.example') {
|
|
485
471
|
const parts = bundleId.split('.');
|
|
486
472
|
const last = parts[parts.length - 1];
|
|
487
|
-
// Capitalize first letter
|
|
488
473
|
return last ? last.charAt(0).toUpperCase() + last.slice(1) : 'App';
|
|
489
474
|
}
|
|
490
475
|
return 'App';
|
|
@@ -493,7 +478,6 @@ exports.getAppName = getAppName;
|
|
|
493
478
|
const getAppVersionAndBuild = () => {
|
|
494
479
|
let version = '';
|
|
495
480
|
let build = '';
|
|
496
|
-
// 1. Try ExpoApplication / ExponentConstants
|
|
497
481
|
const ExpoApplication = react_native_1.NativeModules.ExpoApplication;
|
|
498
482
|
if (ExpoApplication) {
|
|
499
483
|
if (typeof ExpoApplication.nativeAppVersion === 'string') {
|
|
@@ -520,7 +504,6 @@ const getAppVersionAndBuild = () => {
|
|
|
520
504
|
}
|
|
521
505
|
}
|
|
522
506
|
}
|
|
523
|
-
// 2. Try react-native-device-info
|
|
524
507
|
const RNDeviceInfo = react_native_1.NativeModules.RNDeviceInfo;
|
|
525
508
|
if (RNDeviceInfo) {
|
|
526
509
|
if (!version) {
|
|
@@ -546,7 +529,6 @@ const getAppVersionAndBuild = () => {
|
|
|
546
529
|
}
|
|
547
530
|
}
|
|
548
531
|
}
|
|
549
|
-
// 3. Try PlatformConstants / Platform.constants
|
|
550
532
|
const constants = react_native_1.Platform.constants || react_native_1.NativeModules.PlatformConstants;
|
|
551
533
|
if (constants) {
|
|
552
534
|
if (!version &&
|
|
@@ -562,7 +544,6 @@ const getAppVersionAndBuild = () => {
|
|
|
562
544
|
}
|
|
563
545
|
}
|
|
564
546
|
}
|
|
565
|
-
// 4. Try Android AppInfo
|
|
566
547
|
const AppInfo = react_native_1.NativeModules.AppInfo;
|
|
567
548
|
if (AppInfo) {
|
|
568
549
|
if (!version && typeof AppInfo.versionName === 'string') {
|
|
@@ -572,7 +553,6 @@ const getAppVersionAndBuild = () => {
|
|
|
572
553
|
build = AppInfo.versionCode;
|
|
573
554
|
}
|
|
574
555
|
}
|
|
575
|
-
// Fallbacks
|
|
576
556
|
if (!version)
|
|
577
557
|
version = '1.0.0';
|
|
578
558
|
if (!build)
|
|
@@ -599,7 +579,6 @@ const handleOpenExternalLink = (url) => {
|
|
|
599
579
|
]);
|
|
600
580
|
};
|
|
601
581
|
exports.handleOpenExternalLink = handleOpenExternalLink;
|
|
602
|
-
/** Formats a timestamp as HH:MM:SS (no milliseconds). */
|
|
603
582
|
const formatTimeShort = (ts) => {
|
|
604
583
|
const d = new Date(ts);
|
|
605
584
|
const hh = String(d.getHours()).padStart(2, '0');
|
|
@@ -608,7 +587,6 @@ const formatTimeShort = (ts) => {
|
|
|
608
587
|
return `${hh}:${mm}:${ss}`;
|
|
609
588
|
};
|
|
610
589
|
exports.formatTimeShort = formatTimeShort;
|
|
611
|
-
/** Formats a timestamp as HH:MM:SS.mmm (with milliseconds). */
|
|
612
590
|
const formatTime = (ts) => {
|
|
613
591
|
const d = new Date(ts);
|
|
614
592
|
const hh = String(d.getHours()).padStart(2, '0');
|
|
@@ -618,7 +596,6 @@ const formatTime = (ts) => {
|
|
|
618
596
|
return `${hh}:${mm}:${ss}.${ms}`;
|
|
619
597
|
};
|
|
620
598
|
exports.formatTime = formatTime;
|
|
621
|
-
/** Formats a relative gap like "+2s" / "+1m 5s" / "+350ms". */
|
|
622
599
|
const formatGap = (ms) => {
|
|
623
600
|
if (ms < 1000)
|
|
624
601
|
return `+${ms}ms`;
|
|
@@ -630,7 +607,6 @@ const formatGap = (ms) => {
|
|
|
630
607
|
return rem > 0 ? `+${m}m ${rem}s` : `+${m}m`;
|
|
631
608
|
};
|
|
632
609
|
exports.formatGap = formatGap;
|
|
633
|
-
/** Finds the first JSON object/array embedded anywhere in a log message. */
|
|
634
610
|
const getJsonContent = (message) => {
|
|
635
611
|
if (!message)
|
|
636
612
|
return null;
|
|
@@ -650,13 +626,11 @@ const getJsonContent = (message) => {
|
|
|
650
626
|
}
|
|
651
627
|
}
|
|
652
628
|
catch (e) {
|
|
653
|
-
// Ignore
|
|
654
629
|
}
|
|
655
630
|
}
|
|
656
631
|
return null;
|
|
657
632
|
};
|
|
658
633
|
exports.getJsonContent = getJsonContent;
|
|
659
|
-
/** Pretty-prints JSON data showing 3-4 lines with trailing "..." */
|
|
660
634
|
const getJsonPreviewText = (data, maxLines = 4) => {
|
|
661
635
|
try {
|
|
662
636
|
const formatted = JSON.stringify(data, null, 2);
|
|
@@ -680,17 +654,14 @@ const getJsonPreviewText = (data, maxLines = 4) => {
|
|
|
680
654
|
}
|
|
681
655
|
};
|
|
682
656
|
exports.getJsonPreviewText = getJsonPreviewText;
|
|
683
|
-
/** Parses a stack trace line to extract function name, file name, extension (.tsx/.jsx/.ts), line, and column numbers */
|
|
684
657
|
const parseStackLine = (rawLine, isOrigin = false) => {
|
|
685
658
|
let line = rawLine.trim().replace(/^at /, '');
|
|
686
|
-
// Format: func@file:line:col (JSC / Hermes format)
|
|
687
659
|
if (line.includes('@')) {
|
|
688
660
|
const atIndex = line.indexOf('@');
|
|
689
661
|
const funcPart = line.substring(0, atIndex).trim();
|
|
690
662
|
const pathPart = line.substring(atIndex + 1).trim();
|
|
691
663
|
line = funcPart ? `${funcPart} (${pathPart})` : pathPart;
|
|
692
664
|
}
|
|
693
|
-
// Check for "func (path:line:col)" or "path:line:col"
|
|
694
665
|
const parenMatch = line.match(/^(.*?)\s*\((.*?)\)$/);
|
|
695
666
|
let functionName = '<anonymous>';
|
|
696
667
|
let locationPart = line;
|
|
@@ -698,13 +669,10 @@ const parseStackLine = (rawLine, isOrigin = false) => {
|
|
|
698
669
|
functionName = parenMatch[1].trim() || '<anonymous>';
|
|
699
670
|
locationPart = parenMatch[2].trim();
|
|
700
671
|
}
|
|
701
|
-
// Clean Babel/Hermes artifacts in function names like ?anon_0_, _callee$, etc.
|
|
702
672
|
if (functionName.startsWith('?anon_') || functionName === '?') {
|
|
703
673
|
functionName = 'anonymous';
|
|
704
674
|
}
|
|
705
|
-
// Remove "address at " prefix if present in Hermes
|
|
706
675
|
locationPart = locationPart.replace(/^address at /, '');
|
|
707
|
-
// Extract file, line, and col from locationPart (e.g. "path/to/file.tsx:42:15" or "http://...:42:15")
|
|
708
676
|
const locMatch = locationPart.match(/^(.*?):(\d+):(\d+)$/);
|
|
709
677
|
let fullPath = locationPart;
|
|
710
678
|
let lineNumber;
|
|
@@ -714,16 +682,13 @@ const parseStackLine = (rawLine, isOrigin = false) => {
|
|
|
714
682
|
lineNumber = locMatch[2];
|
|
715
683
|
columnNumber = locMatch[3];
|
|
716
684
|
}
|
|
717
|
-
// Clean file name (remove query strings, packager urls, and parent paths)
|
|
718
685
|
let cleanPath = fullPath
|
|
719
686
|
.split('?')[0]
|
|
720
687
|
.split('&')[0]
|
|
721
688
|
.replace(/[)]+$/, '')
|
|
722
689
|
.replace(/\/\/+$/, '');
|
|
723
|
-
// Remove protocol prefixes
|
|
724
690
|
cleanPath = cleanPath.replace(/^(?:https?:\/\/[^\/]+\/|file:\/\/\/|webpack:\/\/\/?)/, '');
|
|
725
691
|
const fileName = cleanPath.split('/').filter(Boolean).pop() || cleanPath;
|
|
726
|
-
// Determine file extension (.tsx, .jsx, .ts, .js)
|
|
727
692
|
const extMatch = fileName.match(/\.([a-z0-9]+)$/i);
|
|
728
693
|
const ext = extMatch ? extMatch[1].toLowerCase() : '';
|
|
729
694
|
const fileExt = ext === 'tsx' || ext === 'jsx' || ext === 'ts' || ext === 'js'
|
|
@@ -760,7 +725,6 @@ const parseStackLine = (rawLine, isOrigin = false) => {
|
|
|
760
725
|
isNative ||
|
|
761
726
|
functionName === 'asyncGeneratorStep' ||
|
|
762
727
|
functionName === '_next';
|
|
763
|
-
// Format clean relative project path
|
|
764
728
|
let relativePath = cleanPath;
|
|
765
729
|
if (relativePath.includes('/example/')) {
|
|
766
730
|
relativePath = relativePath.substring(relativePath.indexOf('/example/') + 9);
|
|
@@ -791,14 +755,12 @@ const parseStackLine = (rawLine, isOrigin = false) => {
|
|
|
791
755
|
};
|
|
792
756
|
};
|
|
793
757
|
exports.parseStackLine = parseStackLine;
|
|
794
|
-
/** Opens a file and line number directly in VS Code / system editor */
|
|
795
758
|
const openInVSCode = (filePath, lineNumber, columnNumber) => {
|
|
796
759
|
const numLine = lineNumber ? Number(lineNumber) : 1;
|
|
797
760
|
const numCol = columnNumber ? Number(columnNumber) : 1;
|
|
798
761
|
const line = lineNumber ? `:${lineNumber}` : '';
|
|
799
762
|
const col = columnNumber ? `:${columnNumber}` : '';
|
|
800
763
|
const cleanPath = filePath.replace(/^file:\/\//, '');
|
|
801
|
-
// 1. Notify Metro dev server on host to launch editor directly on local system
|
|
802
764
|
let extractedOrigin = null;
|
|
803
765
|
try {
|
|
804
766
|
const scriptURL = react_native_1.NativeModules?.SourceCode?.scriptURL ||
|
|
@@ -835,21 +797,18 @@ const openInVSCode = (filePath, lineNumber, columnNumber) => {
|
|
|
835
797
|
}
|
|
836
798
|
catch { }
|
|
837
799
|
});
|
|
838
|
-
// 2. Also invoke native URL scheme handlers
|
|
839
800
|
const vscodeUrl = `vscode://file/${cleanPath.replace(/^\/+/, '')}${line}${col}`;
|
|
840
801
|
const cursorUrl = `cursor://file/${cleanPath.replace(/^\/+/, '')}${line}${col}`;
|
|
841
802
|
const vscodeInsidersUrl = `vscode-insiders://file/${cleanPath.replace(/^\/+/, '')}${line}${col}`;
|
|
842
803
|
react_native_1.Linking.openURL(vscodeUrl).catch(() => {
|
|
843
804
|
react_native_1.Linking.openURL(cursorUrl).catch(() => {
|
|
844
805
|
react_native_1.Linking.openURL(vscodeInsidersUrl).catch(() => {
|
|
845
|
-
// Fallback: Copy to clipboard so user can jump immediately
|
|
846
806
|
(0, exports.copyToClipboard)(`${cleanPath}${line}${col}`, 'Location');
|
|
847
807
|
});
|
|
848
808
|
});
|
|
849
809
|
});
|
|
850
810
|
};
|
|
851
811
|
exports.openInVSCode = openInVSCode;
|
|
852
|
-
// ─── Analytics Helpers ────────────────────────────────────────────────────────
|
|
853
812
|
exports.ANALYTICS_EVENT_PALETTE = [
|
|
854
813
|
AppColors_1.AppColors.googleBlue,
|
|
855
814
|
AppColors_1.AppColors.googleGreen,
|
|
@@ -10,19 +10,8 @@ export interface MemoryPruneSummary {
|
|
|
10
10
|
triggeredBy: 'memory-warning' | 'manual' | 'ram-threshold';
|
|
11
11
|
}
|
|
12
12
|
type MemoryWarningListener = (summary: MemoryPruneSummary) => void;
|
|
13
|
-
/**
|
|
14
|
-
* Prunes all in-memory log stores to prevent OOM / memory pressure.
|
|
15
|
-
* Keeps targetRetentionPct (default: 50%) of existing logs.
|
|
16
|
-
*/
|
|
17
13
|
export declare const pruneAllLogs: (triggeredBy?: MemoryPruneSummary["triggeredBy"], targetRetentionPct?: number) => MemoryPruneSummary;
|
|
18
|
-
/**
|
|
19
|
-
* Starts listening to OS memory pressure warnings via AppState 'memoryWarning'.
|
|
20
|
-
* Automatically prunes logs and notifies subscribers when memory is constrained.
|
|
21
|
-
*/
|
|
22
14
|
export declare const setupMemoryWarningHandler: () => (() => void);
|
|
23
|
-
/**
|
|
24
|
-
* Subscribes to memory prune events.
|
|
25
|
-
*/
|
|
26
15
|
export declare const subscribeMemoryWarning: (listener: MemoryWarningListener) => (() => void);
|
|
27
16
|
export declare const getLastPruneTimestamp: () => number;
|
|
28
17
|
export declare const isMemoryHandlerActive: () => boolean;
|
|
@@ -13,10 +13,6 @@ const memoryListeners = new Set();
|
|
|
13
13
|
let appStateSubscription = null;
|
|
14
14
|
let isMemoryWarningHandlerActive = false;
|
|
15
15
|
let lastPruneTimestamp = 0;
|
|
16
|
-
/**
|
|
17
|
-
* Prunes all in-memory log stores to prevent OOM / memory pressure.
|
|
18
|
-
* Keeps targetRetentionPct (default: 50%) of existing logs.
|
|
19
|
-
*/
|
|
20
16
|
const pruneAllLogs = (triggeredBy = 'manual', targetRetentionPct = 0.5) => {
|
|
21
17
|
const targetPct = Math.max(0.1, Math.min(1.0, targetRetentionPct));
|
|
22
18
|
const prunedNetwork = (0, networkLogger_1.pruneNetworkLogs)(undefined);
|
|
@@ -32,7 +28,6 @@ const pruneAllLogs = (triggeredBy = 'manual', targetRetentionPct = 0.5) => {
|
|
|
32
28
|
prunedCrashes +
|
|
33
29
|
prunedPerformance;
|
|
34
30
|
lastPruneTimestamp = Date.now();
|
|
35
|
-
// Trigger Hermes/V8 Garbage Collection if exposed
|
|
36
31
|
if (typeof globalThis.gc === 'function') {
|
|
37
32
|
try {
|
|
38
33
|
globalThis.gc();
|
|
@@ -63,10 +58,6 @@ const pruneAllLogs = (triggeredBy = 'manual', targetRetentionPct = 0.5) => {
|
|
|
63
58
|
return summary;
|
|
64
59
|
};
|
|
65
60
|
exports.pruneAllLogs = pruneAllLogs;
|
|
66
|
-
/**
|
|
67
|
-
* Starts listening to OS memory pressure warnings via AppState 'memoryWarning'.
|
|
68
|
-
* Automatically prunes logs and notifies subscribers when memory is constrained.
|
|
69
|
-
*/
|
|
70
61
|
const setupMemoryWarningHandler = () => {
|
|
71
62
|
if (isMemoryWarningHandlerActive) {
|
|
72
63
|
return () => { };
|
|
@@ -82,7 +73,6 @@ const setupMemoryWarningHandler = () => {
|
|
|
82
73
|
});
|
|
83
74
|
}
|
|
84
75
|
catch (e) {
|
|
85
|
-
// AppState memoryWarning might not be supported on all mock/test platforms
|
|
86
76
|
}
|
|
87
77
|
return () => {
|
|
88
78
|
if (appStateSubscription) {
|
|
@@ -96,9 +86,6 @@ const setupMemoryWarningHandler = () => {
|
|
|
96
86
|
};
|
|
97
87
|
};
|
|
98
88
|
exports.setupMemoryWarningHandler = setupMemoryWarningHandler;
|
|
99
|
-
/**
|
|
100
|
-
* Subscribes to memory prune events.
|
|
101
|
-
*/
|
|
102
89
|
const subscribeMemoryWarning = (listener) => {
|
|
103
90
|
memoryListeners.add(listener);
|
|
104
91
|
return () => {
|
|
@@ -4,8 +4,4 @@ export interface SearchQueryOptions {
|
|
|
4
4
|
isRegex?: boolean;
|
|
5
5
|
isCaseSensitive?: boolean;
|
|
6
6
|
}
|
|
7
|
-
/**
|
|
8
|
-
* Parses query strings like `method:POST is:error slow:>1s status:200 auth`
|
|
9
|
-
* and checks whether a given NetworkLog matches all tokens against the specified scope.
|
|
10
|
-
*/
|
|
11
7
|
export declare function matchNetworkLogQuery(log: NetworkLog, searchQuery: string, routePath?: string, options?: SearchQueryOptions): boolean;
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.matchNetworkLogQuery = matchNetworkLogQuery;
|
|
4
|
-
/**
|
|
5
|
-
* Parses query strings like `method:POST is:error slow:>1s status:200 auth`
|
|
6
|
-
* and checks whether a given NetworkLog matches all tokens against the specified scope.
|
|
7
|
-
*/
|
|
8
4
|
function matchNetworkLogQuery(log, searchQuery, routePath, options) {
|
|
9
5
|
if (!searchQuery || searchQuery.trim().length === 0)
|
|
10
6
|
return true;
|
|
11
|
-
// Split tokens by spaces or commas while respecting quotes
|
|
12
7
|
const rawTokens = searchQuery.trim().match(/(?:[^\s,"']+|"[^"]*"|'[^']*')+/g) || [];
|
|
13
8
|
if (rawTokens.length === 0)
|
|
14
9
|
return true;
|
|
@@ -43,7 +38,6 @@ function matchNetworkLogQuery(log, searchQuery, routePath, options) {
|
|
|
43
38
|
? JSON.stringify(log.responseHeaders)
|
|
44
39
|
: '';
|
|
45
40
|
const pathRaw = routePath || log?.routeInfo?.path || '';
|
|
46
|
-
// Construct search corpus based on active scope
|
|
47
41
|
const getScopedCorpus = (caseSens) => {
|
|
48
42
|
let parts = [];
|
|
49
43
|
if (scope === 'url') {
|
|
@@ -90,7 +84,6 @@ function matchNetworkLogQuery(log, searchQuery, routePath, options) {
|
|
|
90
84
|
if (!token)
|
|
91
85
|
continue;
|
|
92
86
|
const lowerToken = token.toLowerCase();
|
|
93
|
-
// 1. method:<VAL> or m:<VAL>
|
|
94
87
|
if (lowerToken.startsWith('method:') || lowerToken.startsWith('m:')) {
|
|
95
88
|
const targetMethod = lowerToken.replace(/^(method:|m:)/, '').trim();
|
|
96
89
|
if (targetMethod.startsWith('!')) {
|
|
@@ -103,7 +96,6 @@ function matchNetworkLogQuery(log, searchQuery, routePath, options) {
|
|
|
103
96
|
}
|
|
104
97
|
continue;
|
|
105
98
|
}
|
|
106
|
-
// 2. status:<VAL> or s:<VAL>
|
|
107
99
|
if (lowerToken.startsWith('status:') || lowerToken.startsWith('s:')) {
|
|
108
100
|
const val = lowerToken.replace(/^(status:|s:)/, '').trim();
|
|
109
101
|
if (val === 'pending' || val === 'loading') {
|
|
@@ -147,7 +139,6 @@ function matchNetworkLogQuery(log, searchQuery, routePath, options) {
|
|
|
147
139
|
}
|
|
148
140
|
continue;
|
|
149
141
|
}
|
|
150
|
-
// 3. is:<FLAG>
|
|
151
142
|
if (lowerToken.startsWith('is:')) {
|
|
152
143
|
const flag = lowerToken.slice(3).trim();
|
|
153
144
|
if (flag === 'error' ||
|
|
@@ -205,7 +196,6 @@ function matchNetworkLogQuery(log, searchQuery, routePath, options) {
|
|
|
205
196
|
}
|
|
206
197
|
continue;
|
|
207
198
|
}
|
|
208
|
-
// 4. slow:<DURATION> or dur:<DURATION> or duration:<DURATION>
|
|
209
199
|
if (lowerToken.startsWith('slow:') ||
|
|
210
200
|
lowerToken.startsWith('dur:') ||
|
|
211
201
|
lowerToken.startsWith('duration:')) {
|
|
@@ -250,21 +240,18 @@ function matchNetworkLogQuery(log, searchQuery, routePath, options) {
|
|
|
250
240
|
}
|
|
251
241
|
continue;
|
|
252
242
|
}
|
|
253
|
-
// 5. client:<CLIENT> or c:<CLIENT>
|
|
254
243
|
if (lowerToken.startsWith('client:') || lowerToken.startsWith('c:')) {
|
|
255
244
|
const targetClient = lowerToken.replace(/^(client:|c:)/, '').trim();
|
|
256
245
|
if (!clientStr.includes(targetClient))
|
|
257
246
|
return false;
|
|
258
247
|
continue;
|
|
259
248
|
}
|
|
260
|
-
// 6. domain:<DOMAIN> or d:<DOMAIN>
|
|
261
249
|
if (lowerToken.startsWith('domain:') || lowerToken.startsWith('d:')) {
|
|
262
250
|
const targetDomain = lowerToken.replace(/^(domain:|d:)/, '').trim();
|
|
263
251
|
if (!urlStr.includes(targetDomain))
|
|
264
252
|
return false;
|
|
265
253
|
continue;
|
|
266
254
|
}
|
|
267
|
-
// 7. path:<PATH> or p:<PATH> or page:<PAGE>
|
|
268
255
|
if (lowerToken.startsWith('path:') ||
|
|
269
256
|
lowerToken.startsWith('p:') ||
|
|
270
257
|
lowerToken.startsWith('page:')) {
|
|
@@ -278,21 +265,18 @@ function matchNetworkLogQuery(log, searchQuery, routePath, options) {
|
|
|
278
265
|
}
|
|
279
266
|
continue;
|
|
280
267
|
}
|
|
281
|
-
// 8. req:<TERM> or body:<TERM>
|
|
282
268
|
if (lowerToken.startsWith('req:') || lowerToken.startsWith('body:')) {
|
|
283
269
|
const target = lowerToken.replace(/^(req:|body:)/, '').trim();
|
|
284
270
|
if (!reqStr.includes(target))
|
|
285
271
|
return false;
|
|
286
272
|
continue;
|
|
287
273
|
}
|
|
288
|
-
// 9. res:<TERM>
|
|
289
274
|
if (lowerToken.startsWith('res:')) {
|
|
290
275
|
const target = lowerToken.slice(4).trim();
|
|
291
276
|
if (!resStr.includes(target))
|
|
292
277
|
return false;
|
|
293
278
|
continue;
|
|
294
279
|
}
|
|
295
|
-
// 10. header:<TERM> or h:<TERM>
|
|
296
280
|
if (lowerToken.startsWith('header:') || lowerToken.startsWith('h:')) {
|
|
297
281
|
const target = lowerToken.replace(/^(header:|h:)/, '').trim();
|
|
298
282
|
if (!reqHeadersStr.includes(target) && !resHeadersStr.includes(target)) {
|
|
@@ -300,7 +284,6 @@ function matchNetworkLogQuery(log, searchQuery, routePath, options) {
|
|
|
300
284
|
}
|
|
301
285
|
continue;
|
|
302
286
|
}
|
|
303
|
-
// 11. Generic Match (handles Regex, Case-sensitivity, and Scoped corpus)
|
|
304
287
|
if (isRegex) {
|
|
305
288
|
try {
|
|
306
289
|
const re = new RegExp(token, isCaseSensitive ? '' : 'i');
|
|
@@ -316,7 +299,6 @@ function matchNetworkLogQuery(log, searchQuery, routePath, options) {
|
|
|
316
299
|
else {
|
|
317
300
|
const queryTerm = isCaseSensitive ? token : lowerToken;
|
|
318
301
|
if (!targetCorpus.includes(queryTerm)) {
|
|
319
|
-
// Special case: if user typed "error" / "failed", check error status
|
|
320
302
|
if (queryTerm === 'error' ||
|
|
321
303
|
queryTerm === 'failed' ||
|
|
322
304
|
queryTerm === 'fail') {
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// #5 — Persistence layer for the inspector's settings selections.
|
|
3
|
-
//
|
|
4
|
-
// Backed by iOS Settings (NSUserDefaults) for iOS, or custom storage if passed (e.g. AsyncStorage/MMKV).
|
|
5
|
-
// Contains an in-memory fallback for Android or Jest test environments.
|
|
6
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
3
|
exports.isPersistentStorageAvailable = void 0;
|
|
8
4
|
exports.setCustomStorage = setCustomStorage;
|
|
@@ -13,7 +9,6 @@ exports.getCustomStorage = getCustomStorage;
|
|
|
13
9
|
exports.calculateRamBasedLimits = calculateRamBasedLimits;
|
|
14
10
|
const react_native_1 = require("react-native");
|
|
15
11
|
const NativeInspector_1 = require("../native/NativeInspector");
|
|
16
|
-
// In-memory fallback (settings survive for the app session only).
|
|
17
12
|
const memory = new Map();
|
|
18
13
|
let customStorage = null;
|
|
19
14
|
function setCustomStorage(storage) {
|
|
@@ -46,7 +41,6 @@ async function loadSettings() {
|
|
|
46
41
|
}
|
|
47
42
|
return raw && typeof raw === 'object' ? raw : {};
|
|
48
43
|
}
|
|
49
|
-
// In-memory fallback
|
|
50
44
|
const raw = memory.get(SETTINGS_KEY);
|
|
51
45
|
if (!raw)
|
|
52
46
|
return {};
|
|
@@ -74,7 +68,6 @@ function saveSettings(settings) {
|
|
|
74
68
|
memory.set(SETTINGS_KEY, raw);
|
|
75
69
|
}
|
|
76
70
|
catch {
|
|
77
|
-
// ignore
|
|
78
71
|
}
|
|
79
72
|
}
|
|
80
73
|
async function clearPersistedSettings() {
|
|
@@ -98,7 +91,6 @@ async function clearPersistedSettings() {
|
|
|
98
91
|
memory.delete(SETTINGS_KEY);
|
|
99
92
|
}
|
|
100
93
|
catch {
|
|
101
|
-
// ignore
|
|
102
94
|
}
|
|
103
95
|
}
|
|
104
96
|
const isPersistentStorageAvailable = () => {
|