react-native-inapp-inspector 2.2.2 → 2.2.4
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/components/AnalyticsDetail.js +5 -1
- package/dist/commonjs/components/AnalyticsEventCard.js +2 -1
- package/dist/commonjs/components/DiffViewer.js +1 -1
- package/dist/commonjs/components/Inspector/BundleTab.js +22 -0
- package/dist/commonjs/components/Inspector/DeviceInfoTab.d.ts +3 -0
- package/dist/commonjs/components/Inspector/DeviceInfoTab.js +835 -0
- package/dist/commonjs/components/Inspector/InspectorHeader.js +12 -14
- package/dist/commonjs/components/Inspector/LogDetail.js +6 -3
- package/dist/commonjs/components/Inspector/MainScreen.js +7 -3
- package/dist/commonjs/components/Inspector/NetworkTab.js +92 -15
- package/dist/commonjs/components/Inspector/PerformanceTab.js +38 -12
- package/dist/commonjs/components/Inspector/SettingsPanel.js +440 -229
- package/dist/commonjs/components/Inspector/StorageTab.d.ts +3 -0
- package/dist/commonjs/components/Inspector/StorageTab.js +892 -0
- package/dist/commonjs/components/Inspector/TabBar.js +14 -0
- package/dist/commonjs/components/Inspector/TelemetryConsentModal.js +11 -2
- package/dist/commonjs/components/Inspector/UpdateAvailableModal.js +4 -1
- package/dist/commonjs/components/NetworkIcons.d.ts +6 -0
- package/dist/commonjs/components/NetworkIcons.js +30 -1
- package/dist/commonjs/constants/version.d.ts +1 -1
- package/dist/commonjs/constants/version.js +1 -1
- package/dist/commonjs/customHooks/bundleAnalyzer.js +44 -22
- package/dist/commonjs/customHooks/storageInspector.d.ts +67 -0
- package/dist/commonjs/customHooks/storageInspector.js +486 -0
- package/dist/commonjs/i18n/locales/en.json +8 -2
- package/dist/commonjs/index.d.ts +1 -0
- package/dist/commonjs/index.js +16 -1
- package/dist/commonjs/storage.d.ts +5 -0
- package/dist/commonjs/storage.js +18 -0
- package/dist/commonjs/types/enums.d.ts +5 -0
- package/dist/commonjs/types/enums.js +5 -0
- package/dist/esm/components/AnalyticsDetail.js +6 -2
- package/dist/esm/components/AnalyticsEventCard.js +2 -1
- package/dist/esm/components/DiffViewer.js +1 -1
- package/dist/esm/components/Inspector/BundleTab.js +22 -0
- package/dist/esm/components/Inspector/DeviceInfoTab.d.ts +3 -0
- package/dist/esm/components/Inspector/DeviceInfoTab.js +796 -0
- package/dist/esm/components/Inspector/InspectorHeader.js +13 -15
- package/dist/esm/components/Inspector/LogDetail.js +7 -4
- package/dist/esm/components/Inspector/MainScreen.js +7 -3
- package/dist/esm/components/Inspector/NetworkTab.js +93 -16
- package/dist/esm/components/Inspector/PerformanceTab.js +39 -13
- package/dist/esm/components/Inspector/SettingsPanel.js +441 -230
- package/dist/esm/components/Inspector/StorageTab.d.ts +3 -0
- package/dist/esm/components/Inspector/StorageTab.js +853 -0
- package/dist/esm/components/Inspector/TabBar.js +15 -1
- package/dist/esm/components/Inspector/TelemetryConsentModal.js +11 -2
- package/dist/esm/components/Inspector/UpdateAvailableModal.js +4 -1
- package/dist/esm/components/NetworkIcons.d.ts +6 -0
- package/dist/esm/components/NetworkIcons.js +23 -0
- package/dist/esm/constants/version.d.ts +1 -1
- package/dist/esm/constants/version.js +1 -1
- package/dist/esm/customHooks/bundleAnalyzer.js +44 -22
- package/dist/esm/customHooks/storageInspector.d.ts +67 -0
- package/dist/esm/customHooks/storageInspector.js +469 -0
- package/dist/esm/i18n/locales/en.json +8 -2
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/storage.d.ts +5 -0
- package/dist/esm/storage.js +5 -0
- package/dist/esm/types/enums.d.ts +5 -0
- package/dist/esm/types/enums.js +5 -0
- package/package.json +9 -1
- package/src/analytics.ts +35 -0
- package/src/bundle.ts +25 -0
- package/src/components/AnalyticsDetail.tsx +870 -0
- package/src/components/AnalyticsEventCard.tsx +442 -0
- package/src/components/AnalyticsGraph.tsx +583 -0
- package/src/components/AnimatedEntrance.tsx +64 -0
- package/src/components/AppHeaderLogo.tsx +109 -0
- package/src/components/BrandCircleIcon.tsx +144 -0
- package/src/components/BrandSquareIcon.tsx +144 -0
- package/src/components/CodeSnippet.tsx +725 -0
- package/src/components/ConsoleLogCard.tsx +628 -0
- package/src/components/CopyButton.tsx +87 -0
- package/src/components/DiffViewer.tsx +82 -0
- package/src/components/DomainHeader.tsx +237 -0
- package/src/components/EmptyState.tsx +73 -0
- package/src/components/EndOfListFooter.tsx +100 -0
- package/src/components/ErrorBoundary.tsx +688 -0
- package/src/components/HeadersSection.tsx +192 -0
- package/src/components/HighlightText.tsx +100 -0
- package/src/components/Inspector/AnalyticsFilterModal.tsx +1250 -0
- package/src/components/Inspector/AnalyticsTab.tsx +1336 -0
- package/src/components/Inspector/BundleTab.tsx +4760 -0
- package/src/components/Inspector/ConsoleTab.tsx +702 -0
- package/src/components/Inspector/CrashDetail.tsx +941 -0
- package/src/components/Inspector/CrashFilterModal.tsx +721 -0
- package/src/components/Inspector/CrashTab.tsx +871 -0
- package/src/components/Inspector/DeviceInfoTab.tsx +1204 -0
- package/src/components/Inspector/FabLauncher.tsx +80 -0
- package/src/components/Inspector/InspectorContext.tsx +28 -0
- package/src/components/Inspector/InspectorHeader.tsx +972 -0
- package/src/components/Inspector/LogDetail.tsx +1431 -0
- package/src/components/Inspector/MainScreen.tsx +262 -0
- package/src/components/Inspector/NavigationTracker.tsx +13 -0
- package/src/components/Inspector/NetworkDetail.tsx +794 -0
- package/src/components/Inspector/NetworkTab.tsx +1183 -0
- package/src/components/Inspector/NpmUpdateToast.tsx +392 -0
- package/src/components/Inspector/PerformanceTab.tsx +1928 -0
- package/src/components/Inspector/ReduxDetail.tsx +1651 -0
- package/src/components/Inspector/ReduxTab.tsx +954 -0
- package/src/components/Inspector/SettingsPanel.tsx +3447 -0
- package/src/components/Inspector/StorageTab.tsx +1048 -0
- package/src/components/Inspector/TabBar.tsx +207 -0
- package/src/components/Inspector/TelemetryConsentModal.tsx +416 -0
- package/src/components/Inspector/UpdateAvailableModal.tsx +557 -0
- package/src/components/JsonViewer.tsx +486 -0
- package/src/components/LogCard.tsx +491 -0
- package/src/components/LogSyntaxHighlighter.tsx +178 -0
- package/src/components/MetaAccordion.tsx +340 -0
- package/src/components/MiniBarChart.tsx +42 -0
- package/src/components/MiniLineChart.tsx +33 -0
- package/src/components/NetworkIcons.tsx +2221 -0
- package/src/components/SectionHeader.tsx +113 -0
- package/src/components/SegmentedTabs.tsx +83 -0
- package/src/components/Slider.tsx +300 -0
- package/src/components/SourcePageCard.tsx +148 -0
- package/src/components/Toast.tsx +131 -0
- package/src/components/TouchableScale.tsx +91 -0
- package/src/components/TreeNode.tsx +186 -0
- package/src/console.ts +24 -0
- package/src/constants/index.ts +38 -0
- package/src/constants/version.ts +3 -0
- package/src/crash.ts +32 -0
- package/src/customHooks/analyticsLogger.ts +336 -0
- package/src/customHooks/bundleAnalyzer.ts +1256 -0
- package/src/customHooks/consoleLogger.ts +497 -0
- package/src/customHooks/crashHandler.ts +944 -0
- package/src/customHooks/logFilters.ts +32 -0
- package/src/customHooks/networkLogger.ts +419 -0
- package/src/customHooks/performanceTracker.ts +1014 -0
- package/src/customHooks/reduxLogger.ts +406 -0
- package/src/customHooks/storageInspector.ts +509 -0
- package/src/customHooks/useAccordion.tsx +60 -0
- package/src/decorators/index.ts +184 -0
- package/src/helpers/gaAnalyticsRegistry.ts +204 -0
- package/src/helpers/index.ts +860 -0
- package/src/helpers/memoryManager.ts +138 -0
- package/src/helpers/searchQueryParser.ts +283 -0
- package/src/helpers/settingsStore.ts +171 -0
- package/src/helpers/telemetry.ts +505 -0
- package/src/helpers/toast.ts +17 -0
- package/src/i18n/index.ts +69 -0
- package/src/i18n/locales/en.json +1058 -0
- package/src/index.tsx +2356 -0
- package/src/native/NativeInspector.ts +397 -0
- package/src/native/NativeNetworkInspector.ts +24 -0
- package/src/network.ts +22 -0
- package/src/performance.ts +38 -0
- package/src/redux.ts +23 -0
- package/src/storage.ts +18 -0
- package/src/styles/AppColors.ts +408 -0
- package/src/styles/AppFonts.ts +8 -0
- package/src/styles/common.ts +209 -0
- package/src/styles/index.ts +1570 -0
- package/src/types/enums.ts +199 -0
- package/src/types/index.ts +34 -0
- package/src/types/interfaces.ts +515 -0
|
@@ -4,7 +4,7 @@ import { useInspector } from './InspectorContext';
|
|
|
4
4
|
import styles from '../../styles';
|
|
5
5
|
import { AppColors } from '../../styles/AppColors';
|
|
6
6
|
import TouchableScale from '../TouchableScale';
|
|
7
|
-
import { SignalIcon, TerminalIcon, AnalyticsIcon, PackageIcon, ReduxIcon, PerformanceIcon, CrashIcon, } from '../NetworkIcons';
|
|
7
|
+
import { SignalIcon, TerminalIcon, AnalyticsIcon, PackageIcon, ReduxIcon, PerformanceIcon, CrashIcon, SmartphoneIcon, DatabaseIcon, } from '../NetworkIcons';
|
|
8
8
|
import { isReduxConnected } from '../../customHooks/reduxLogger';
|
|
9
9
|
import { isAnalyticsConnected } from '../../customHooks/analyticsLogger';
|
|
10
10
|
const TabBar = React.memo(() => {
|
|
@@ -56,6 +56,18 @@ const TabBar = React.memo(() => {
|
|
|
56
56
|
count: crashRecords?.length || 0,
|
|
57
57
|
icon: 'crash',
|
|
58
58
|
},
|
|
59
|
+
{
|
|
60
|
+
key: 'device',
|
|
61
|
+
label: 'Device',
|
|
62
|
+
count: 0,
|
|
63
|
+
icon: 'device',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
key: 'storage',
|
|
67
|
+
label: 'Storage',
|
|
68
|
+
count: 0,
|
|
69
|
+
icon: 'storage',
|
|
70
|
+
},
|
|
59
71
|
]
|
|
60
72
|
.filter(tab => {
|
|
61
73
|
if (!tabVisibility?.[tab.key])
|
|
@@ -98,6 +110,8 @@ const TabBar = React.memo(() => {
|
|
|
98
110
|
{tab.icon === 'bundle' && (<PackageIcon color={iconColor} size={14}/>)}
|
|
99
111
|
{tab.icon === 'performance' && (<PerformanceIcon color={iconColor} size={14}/>)}
|
|
100
112
|
{tab.icon === 'crash' && (<CrashIcon color={iconColor} size={14}/>)}
|
|
113
|
+
{tab.icon === 'device' && (<SmartphoneIcon color={iconColor} size={14}/>)}
|
|
114
|
+
{tab.icon === 'storage' && (<DatabaseIcon color={iconColor} size={14}/>)}
|
|
101
115
|
<Text numberOfLines={1} ellipsizeMode="tail" style={[
|
|
102
116
|
styles.contentTabButtonText,
|
|
103
117
|
isActive &&
|
|
@@ -14,6 +14,10 @@ const CheckSvg = ({ size = 14, color = '#FFFFFF' }) => (<Svg width={size} height
|
|
|
14
14
|
const CloseSvg = ({ size = 13, color = '#64748B' }) => (<Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
15
15
|
<Path d="M18 6L6 18M6 6l12 12" stroke={color} strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round"/>
|
|
16
16
|
</Svg>);
|
|
17
|
+
const GearSvg = ({ size = 13, color = '#6366F1' }) => (<Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
18
|
+
<Path d="M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
|
19
|
+
<Path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1Z" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
|
20
|
+
</Svg>);
|
|
17
21
|
export const TelemetryConsentModal = () => {
|
|
18
22
|
const [visible, setVisible] = useState(false);
|
|
19
23
|
const fadeAnim = useState(new Animated.Value(0))[0];
|
|
@@ -90,8 +94,9 @@ export const TelemetryConsentModal = () => {
|
|
|
90
94
|
|
|
91
95
|
{/* Subheading instruction hint badge */}
|
|
92
96
|
<View style={styles.hintBadge}>
|
|
97
|
+
<GearSvg size={12} color="#6366F1"/>
|
|
93
98
|
<Text style={styles.hintBadgeText}>
|
|
94
|
-
|
|
99
|
+
You can enable or disable this anytime in Settings
|
|
95
100
|
</Text>
|
|
96
101
|
</View>
|
|
97
102
|
</View>
|
|
@@ -221,12 +226,16 @@ const styles = StyleSheet.create({
|
|
|
221
226
|
...fontStack,
|
|
222
227
|
},
|
|
223
228
|
hintBadge: {
|
|
229
|
+
flexDirection: 'row',
|
|
230
|
+
alignItems: 'center',
|
|
231
|
+
justifyContent: 'center',
|
|
232
|
+
gap: 5,
|
|
224
233
|
backgroundColor: '#EDE9FE80',
|
|
225
234
|
borderWidth: 1,
|
|
226
235
|
borderColor: '#DDD6FE',
|
|
227
236
|
borderRadius: 7,
|
|
228
237
|
paddingHorizontal: 8,
|
|
229
|
-
paddingVertical:
|
|
238
|
+
paddingVertical: 3,
|
|
230
239
|
marginBottom: 8,
|
|
231
240
|
},
|
|
232
241
|
hintBadgeText: {
|
|
@@ -25,6 +25,9 @@ const CloseSvg = ({ size = 13, color = '#64748B' }) => (<Svg width={size} height
|
|
|
25
25
|
const SparkleSvg = ({ size = 14, color = '#F59E0B' }) => (<Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
26
26
|
<Path d="M12 2l2.4 6.6L21 11l-6.6 2.4L12 20l-2.4-6.6L3 11l6.6-2.4L12 2z" fill={color}/>
|
|
27
27
|
</Svg>);
|
|
28
|
+
const ArrowRightSvg = ({ size = 14, color = '#94A3B8' }) => (<Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
29
|
+
<Path d="M5 12h14M12 5l7 7-7 7" stroke={color} strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round"/>
|
|
30
|
+
</Svg>);
|
|
28
31
|
export const UpdateAvailableModal = ({ visible, latestVersion, onClose, }) => {
|
|
29
32
|
const [copied, setCopied] = useState(false);
|
|
30
33
|
const fadeAnim = useState(new Animated.Value(0))[0];
|
|
@@ -117,7 +120,7 @@ export const UpdateAvailableModal = ({ visible, latestVersion, onClose, }) => {
|
|
|
117
120
|
</View>
|
|
118
121
|
|
|
119
122
|
<View style={styles.arrowContainer}>
|
|
120
|
-
<
|
|
123
|
+
<ArrowRightSvg size={14} color="#94A3B8"/>
|
|
121
124
|
</View>
|
|
122
125
|
|
|
123
126
|
<View style={styles.versionColumn}>
|
|
@@ -127,3 +127,9 @@ export declare const TagIcon: ({ color, size }: IconProps) => React.JSX.Element;
|
|
|
127
127
|
export declare const NpmIcon: ({ color, size }: IconProps) => React.JSX.Element;
|
|
128
128
|
export declare const ResetIcon: ({ color, size }: IconProps) => React.JSX.Element;
|
|
129
129
|
export declare const ChevronDownIcon: ({ color, size }: IconProps) => React.JSX.Element;
|
|
130
|
+
export declare const CpuIcon: ({ color, size, }: IconProps) => React.JSX.Element;
|
|
131
|
+
export declare const WifiIcon: ({ color, size, }: IconProps) => React.JSX.Element;
|
|
132
|
+
export declare const ShieldCheckIcon: ({ color, size, }: IconProps) => React.JSX.Element;
|
|
133
|
+
export declare const DatabaseIcon: ({ color, size, }: IconProps) => React.JSX.Element;
|
|
134
|
+
export declare const PencilIcon: ({ color, size, }: IconProps) => React.JSX.Element;
|
|
135
|
+
export declare const PlusIcon: ({ color, size, }: IconProps) => React.JSX.Element;
|
|
@@ -711,3 +711,26 @@ export const ResetIcon = ({ color = AppColors.white, size = 16 }) => (<Svg width
|
|
|
711
711
|
export const ChevronDownIcon = ({ color = AppColors.grayTextWeak, size = 14 }) => (<Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
712
712
|
<Path d="M6 9l6 6 6-6" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
|
713
713
|
</Svg>);
|
|
714
|
+
export const CpuIcon = ({ color = AppColors.grayTextWeak, size = 14, }) => (<Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
715
|
+
<Rect x="4" y="4" width="16" height="16" rx="2" stroke={color} strokeWidth="2"/>
|
|
716
|
+
<Rect x="9" y="9" width="6" height="6" stroke={color} strokeWidth="2"/>
|
|
717
|
+
<Path d="M9 1v3M15 1v3M9 20v3M15 20v3M20 9h3M20 14h3M1 9h3M1 14h3" stroke={color} strokeWidth="2" strokeLinecap="round"/>
|
|
718
|
+
</Svg>);
|
|
719
|
+
export const WifiIcon = ({ color = AppColors.grayTextWeak, size = 14, }) => (<Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
720
|
+
<Path d="M5 12.55a11 11 0 0 1 14.08 0M1.42 9a16 16 0 0 1 21.16 0M8.53 16.11a6 6 0 0 1 6.95 0M12 20h.01" stroke={color} strokeWidth="2" strokeLinecap="round"/>
|
|
721
|
+
</Svg>);
|
|
722
|
+
export const ShieldCheckIcon = ({ color = AppColors.grayTextWeak, size = 14, }) => (<Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
723
|
+
<Path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
|
724
|
+
<Path d="M9 12l2 2 4-4" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
|
725
|
+
</Svg>);
|
|
726
|
+
export const DatabaseIcon = ({ color = AppColors.grayTextWeak, size = 14, }) => (<Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
727
|
+
<Ellipse cx="12" cy="5" rx="9" ry="3" stroke={color} strokeWidth="2"/>
|
|
728
|
+
<Path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3" stroke={color} strokeWidth="2" strokeLinecap="round"/>
|
|
729
|
+
<Path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5" stroke={color} strokeWidth="2" strokeLinecap="round"/>
|
|
730
|
+
</Svg>);
|
|
731
|
+
export const PencilIcon = ({ color = AppColors.grayTextWeak, size = 14, }) => (<Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
732
|
+
<Path d="M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
|
733
|
+
</Svg>);
|
|
734
|
+
export const PlusIcon = ({ color = AppColors.grayTextWeak, size = 14, }) => (<Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
735
|
+
<Path d="M12 5v14M5 12h14" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
|
736
|
+
</Svg>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const LIB_VERSION = "2.2.
|
|
1
|
+
export declare const LIB_VERSION = "2.2.4";
|
|
@@ -21,8 +21,9 @@ export const getBundleModuleEnabled = () => isBundleModuleEnabled;
|
|
|
21
21
|
const getSourceCodeModule = () => {
|
|
22
22
|
try {
|
|
23
23
|
const legacy = NativeModules?.SourceCode;
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
const scriptURL = legacy?.scriptURL || legacy?.getConstants?.()?.scriptURL;
|
|
25
|
+
if (typeof scriptURL === 'string' && scriptURL.length > 0) {
|
|
26
|
+
return { scriptURL };
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
catch { }
|
|
@@ -96,9 +97,9 @@ const extractHostAndPort = (scriptURL) => {
|
|
|
96
97
|
}
|
|
97
98
|
return { host: null, port: null };
|
|
98
99
|
};
|
|
99
|
-
const probeCandidateUrlsInParallel = async (scriptURL, timeoutMs =
|
|
100
|
+
const probeCandidateUrlsInParallel = async (scriptURL, timeoutMs = 3000) => {
|
|
100
101
|
const { host: extractedHost, port: extractedPort } = extractHostAndPort(scriptURL);
|
|
101
|
-
// 1. If we have a direct scriptURL, try fetching directly
|
|
102
|
+
// 1. If we have a direct HTTP scriptURL, try fetching directly
|
|
102
103
|
if (scriptURL && scriptURL.startsWith('http')) {
|
|
103
104
|
try {
|
|
104
105
|
const controller = new AbortController();
|
|
@@ -118,7 +119,7 @@ const probeCandidateUrlsInParallel = async (scriptURL, timeoutMs = 2500) => {
|
|
|
118
119
|
// Continue to dynamic port discovery
|
|
119
120
|
}
|
|
120
121
|
}
|
|
121
|
-
// 2. Dynamic Port Discovery via lightweight Metro /status
|
|
122
|
+
// 2. Dynamic Port Discovery via parallel lightweight Metro /status probes
|
|
122
123
|
const candidateHosts = extractedHost
|
|
123
124
|
? [extractedHost, 'localhost', '127.0.0.1', ...(Platform.OS === 'android' ? ['10.0.2.2', '10.0.3.2'] : [])]
|
|
124
125
|
: ['localhost', '127.0.0.1', ...(Platform.OS === 'android' ? ['10.0.2.2', '10.0.3.2'] : [])];
|
|
@@ -126,29 +127,50 @@ const probeCandidateUrlsInParallel = async (scriptURL, timeoutMs = 2500) => {
|
|
|
126
127
|
const candidatePorts = extractedPort
|
|
127
128
|
? Array.from(new Set([extractedPort, ...DYNAMIC_DEV_PORTS]))
|
|
128
129
|
: DYNAMIC_DEV_PORTS;
|
|
129
|
-
|
|
130
|
-
// Probe lightweight /status on candidate ports (very fast 400ms timeout)
|
|
130
|
+
const probeTasks = [];
|
|
131
131
|
for (const host of uniqueHosts) {
|
|
132
132
|
for (const port of candidatePorts) {
|
|
133
|
-
|
|
133
|
+
probeTasks.push(new Promise(async (resolve, reject) => {
|
|
134
134
|
const controller = new AbortController();
|
|
135
|
-
const timer = setTimeout(() => controller.abort(),
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
135
|
+
const timer = setTimeout(() => controller.abort(), 700);
|
|
136
|
+
try {
|
|
137
|
+
const res = await fetch(`http://${host}:${port}/status`, { signal: controller.signal });
|
|
138
|
+
clearTimeout(timer);
|
|
139
|
+
if (res.ok) {
|
|
140
|
+
const statusText = await res.text();
|
|
141
|
+
if (statusText && statusText.includes('packager-status:running')) {
|
|
142
|
+
resolve({ host, port });
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
143
145
|
}
|
|
144
146
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
catch {
|
|
148
|
+
clearTimeout(timer);
|
|
149
|
+
}
|
|
150
|
+
reject(new Error('unreachable'));
|
|
151
|
+
}));
|
|
149
152
|
}
|
|
150
|
-
|
|
151
|
-
|
|
153
|
+
}
|
|
154
|
+
let activeServer = null;
|
|
155
|
+
try {
|
|
156
|
+
activeServer = await new Promise((resolve, reject) => {
|
|
157
|
+
let pending = probeTasks.length;
|
|
158
|
+
if (pending === 0) {
|
|
159
|
+
reject(new Error('No candidate hosts'));
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
probeTasks.forEach(p => {
|
|
163
|
+
p.then(resolve).catch(() => {
|
|
164
|
+
pending--;
|
|
165
|
+
if (pending === 0) {
|
|
166
|
+
reject(new Error('All probes failed'));
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
catch {
|
|
173
|
+
activeServer = null;
|
|
152
174
|
}
|
|
153
175
|
// 3. If a live Metro port was detected dynamically, fetch the bundle from it
|
|
154
176
|
if (activeServer) {
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export interface StorageEntry {
|
|
2
|
+
key: string;
|
|
3
|
+
value: string;
|
|
4
|
+
parsedValue?: any;
|
|
5
|
+
type: 'json' | 'string' | 'number' | 'boolean' | 'null';
|
|
6
|
+
byteSize: number;
|
|
7
|
+
}
|
|
8
|
+
export type StorageDriver = 'asyncStorage' | 'mmkv';
|
|
9
|
+
/**
|
|
10
|
+
* Register an AsyncStorage instance with the inspector (optional override).
|
|
11
|
+
*/
|
|
12
|
+
export declare const connectAsyncStorage: (storageInstance: any) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Register an MMKV instance with the inspector (optional override).
|
|
15
|
+
*/
|
|
16
|
+
export declare const connectMMKV: (mmkvInstance: any, id?: string) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Auto-detect AsyncStorage:
|
|
19
|
+
* 1. Explicit connection
|
|
20
|
+
* 2. Global instance
|
|
21
|
+
* 3. Dynamic require '@react-native-async-storage/async-storage'
|
|
22
|
+
* 4. Native Bridge Direct interface
|
|
23
|
+
*/
|
|
24
|
+
export declare const getResolvedAsyncStorage: () => any;
|
|
25
|
+
/**
|
|
26
|
+
* Auto-detect MMKV:
|
|
27
|
+
* 1. Explicit connection
|
|
28
|
+
* 2. Dynamic require 'react-native-mmkv' & instantiate default instance
|
|
29
|
+
* 3. Global MMKV / JSI instances
|
|
30
|
+
*/
|
|
31
|
+
export declare const getResolvedMMKV: (id?: string) => any;
|
|
32
|
+
export declare const isAsyncStorageConnected: () => boolean;
|
|
33
|
+
export declare const isMMKVConnected: () => boolean;
|
|
34
|
+
export declare const getRegisteredMMKVInstanceIds: () => string[];
|
|
35
|
+
/**
|
|
36
|
+
* Calculate approximate byte size of a UTF-8 string
|
|
37
|
+
*/
|
|
38
|
+
export declare const calculateByteSize: (str: string) => number;
|
|
39
|
+
/**
|
|
40
|
+
* Determine type and format value safely
|
|
41
|
+
*/
|
|
42
|
+
export declare const analyzeStorageValue: (rawVal: any) => {
|
|
43
|
+
strVal: string;
|
|
44
|
+
parsedVal?: any;
|
|
45
|
+
type: "json" | "string" | "number" | "boolean" | "null";
|
|
46
|
+
byteSize: number;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Fetch all storage entries for given driver
|
|
50
|
+
*/
|
|
51
|
+
export declare const fetchStorageEntries: (driver: StorageDriver, instanceId?: string) => Promise<StorageEntry[]>;
|
|
52
|
+
/**
|
|
53
|
+
* Create or Update a key-value entry (CRUD: Create / Update)
|
|
54
|
+
*/
|
|
55
|
+
export declare const setStorageEntry: (driver: StorageDriver, key: string, value: string, instanceId?: string) => Promise<boolean>;
|
|
56
|
+
/**
|
|
57
|
+
* Delete a single key (CRUD: Delete)
|
|
58
|
+
*/
|
|
59
|
+
export declare const removeStorageEntry: (driver: StorageDriver, key: string, instanceId?: string) => Promise<boolean>;
|
|
60
|
+
/**
|
|
61
|
+
* Wipe all keys for given storage (CRUD: Clear All)
|
|
62
|
+
*/
|
|
63
|
+
export declare const clearStorageDriver: (driver: StorageDriver, instanceId?: string) => Promise<boolean>;
|
|
64
|
+
/**
|
|
65
|
+
* Subscribe to storage mutations
|
|
66
|
+
*/
|
|
67
|
+
export declare const subscribeToStorageChanges: (listener: () => void) => (() => void);
|