react-native-inapp-inspector 1.1.32 → 1.1.33

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.
@@ -346,22 +346,25 @@ function buildBundleFileTree(files) {
346
346
  }
347
347
  const downloadBundleFile = async (file, scriptURL) => {
348
348
  let content = '';
349
- // 1. Attempt to fetch real source code from Metro dev server if available
349
+ // 1. Attempt to fetch real source code from Metro dev server dynamically
350
350
  try {
351
- let devServerOrigin = 'http://localhost:8081';
352
- if (scriptURL && scriptURL.startsWith('http')) {
353
- const match = scriptURL.match(/^(https?:\/\/[^/]+)/);
351
+ let devServerOrigin = '';
352
+ const activeUrl = scriptURL || (0, bundleAnalyzer_1.getHostScriptURL)();
353
+ if (activeUrl && activeUrl.startsWith('http')) {
354
+ const match = activeUrl.match(/^(https?:\/\/[^/]+)/);
354
355
  if (match) {
355
356
  devServerOrigin = match[1];
356
357
  }
357
358
  }
358
- const cleanPath = file.path.replace(/^\/+/, '');
359
- const url = `${devServerOrigin}/${cleanPath}`;
360
- const res = await fetch(url);
361
- if (res.ok) {
362
- const text = await res.text();
363
- if (text && text.length > 0) {
364
- content = text;
359
+ if (devServerOrigin) {
360
+ const cleanPath = file.path.replace(/^\/+/, '');
361
+ const url = `${devServerOrigin}/${cleanPath}`;
362
+ const res = await fetch(url);
363
+ if (res.ok) {
364
+ const text = await res.text();
365
+ if (text && text.length > 0) {
366
+ content = text;
367
+ }
365
368
  }
366
369
  }
367
370
  }
@@ -523,22 +526,32 @@ const BundleTab = react_1.default.memo(() => {
523
526
  const [search, setSearch] = (0, react_1.useState)('');
524
527
  const [activeCategory, setActiveCategory] = (0, react_1.useState)('ALL');
525
528
  // ─── Live Host App Bundle Analysis (fetched from Metro / runtime) ─────────
526
- const [analysis, setAnalysis] = (0, react_1.useState)(() => (0, bundleAnalyzer_1.getCachedBundleAnalysis)());
527
- const [isAnalyzing, setIsAnalyzing] = (0, react_1.useState)(!(0, bundleAnalyzer_1.getCachedBundleAnalysis)());
529
+ const [analysis, setAnalysis] = (0, react_1.useState)(() => (0, bundleAnalyzer_1.getCachedBundleAnalysis)() || (0, bundleAnalyzer_1.getInitialBundleAnalysis)());
530
+ const [isAnalyzing, setIsAnalyzing] = (0, react_1.useState)(false);
528
531
  const refreshAnalysis = (0, react_1.useCallback)(() => {
529
532
  setIsAnalyzing(true);
530
- (0, bundleAnalyzer_1.analyzeHostAppBundle)(true).then(result => {
533
+ (0, bundleAnalyzer_1.analyzeHostAppBundle)(true)
534
+ .then(result => {
531
535
  setAnalysis(result);
532
536
  setIsAnalyzing(false);
537
+ })
538
+ .catch(() => {
539
+ setIsAnalyzing(false);
533
540
  });
534
541
  }, []);
535
542
  (0, react_1.useEffect)(() => {
536
543
  let mounted = true;
537
- (0, bundleAnalyzer_1.analyzeHostAppBundle)().then(result => {
544
+ (0, bundleAnalyzer_1.analyzeHostAppBundle)()
545
+ .then(result => {
538
546
  if (mounted) {
539
547
  setAnalysis(result);
540
548
  setIsAnalyzing(false);
541
549
  }
550
+ })
551
+ .catch(() => {
552
+ if (mounted) {
553
+ setIsAnalyzing(false);
554
+ }
542
555
  });
543
556
  return () => {
544
557
  mounted = false;
@@ -792,21 +805,10 @@ const BundleTab = react_1.default.memo(() => {
792
805
  </TouchableScale_1.default>
793
806
  </react_native_1.View>
794
807
 
795
- {/* ─── Live Bundle Analysis Loading State ─── */}
796
- {isAnalyzing && (<react_native_1.View style={bundleStyles.analyzingContainer}>
797
- <react_native_1.ActivityIndicator size="small" color={AppColors_1.AppColors.brandPurple}/>
798
- <react_native_1.Text style={bundleStyles.analyzingText}>
799
- {t('bundle.analyzingTitle')}
800
- </react_native_1.Text>
801
- <react_native_1.Text style={bundleStyles.analyzingHint}>
802
- {t('bundle.analyzingHint')}
803
- </react_native_1.Text>
804
- </react_native_1.View>)}
805
-
806
808
  {/* ══════════════════════════════════════════════════════════════════════ */}
807
809
  {/* ── 1. TAB: OVERVIEW & TREEMAP ───────────────────────────────────────── */}
808
810
  {/* ══════════════════════════════════════════════════════════════════════ */}
809
- {activeSubTab === 'overview' && !isAnalyzing && (<react_native_1.ScrollView style={{ flex: 1 }} contentContainerStyle={bundleStyles.contentContainer} keyboardShouldPersistTaps="handled">
811
+ {activeSubTab === 'overview' && (<react_native_1.ScrollView style={{ flex: 1 }} contentContainerStyle={bundleStyles.contentContainer} keyboardShouldPersistTaps="handled">
810
812
 
811
813
  {/* Hero Overview Card */}
812
814
  <react_native_1.View style={bundleStyles.heroCard}>
@@ -1129,7 +1131,7 @@ const BundleTab = react_1.default.memo(() => {
1129
1131
  {/* ══════════════════════════════════════════════════════════════════════ */}
1130
1132
  {/* ── 2. TAB: PRODUCTION BUILDS & PLATFORMS ───────────────────────────── */}
1131
1133
  {/* ══════════════════════════════════════════════════════════════════════ */}
1132
- {activeSubTab === 'production' && !isAnalyzing && (<react_native_1.ScrollView style={{ flex: 1 }} contentContainerStyle={bundleStyles.contentContainer} keyboardShouldPersistTaps="handled">
1134
+ {activeSubTab === 'production' && (<react_native_1.ScrollView style={{ flex: 1 }} contentContainerStyle={bundleStyles.contentContainer} keyboardShouldPersistTaps="handled">
1133
1135
 
1134
1136
  {/* Platform Segmented Switcher (Horizontally Scrollable) */}
1135
1137
  <react_native_1.ScrollView horizontal showsHorizontalScrollIndicator={false} contentContainerStyle={bundleStyles.prodPlatformScroll}>
@@ -1357,7 +1359,7 @@ const BundleTab = react_1.default.memo(() => {
1357
1359
  {/* ══════════════════════════════════════════════════════════════════════ */}
1358
1360
  {/* ── 2. TAB: FILES BREAKDOWN ─────────────────────────────────────────── */}
1359
1361
  {/* ══════════════════════════════════════════════════════════════════════ */}
1360
- {activeSubTab === 'files' && !isAnalyzing && (<react_native_1.View style={{ flex: 1 }}>
1362
+ {activeSubTab === 'files' && (<react_native_1.View style={{ flex: 1 }}>
1361
1363
  {/* Search & Category Filter */}
1362
1364
  <react_native_1.View style={bundleStyles.filterContainer}>
1363
1365
  <react_native_1.View style={bundleStyles.searchRow}>
@@ -1551,7 +1553,7 @@ const BundleTab = react_1.default.memo(() => {
1551
1553
  {/* ══════════════════════════════════════════════════════════════════════ */}
1552
1554
  {/* ── 3. TAB: PACKAGES & NODE_MODULES ─────────────────────────────────── */}
1553
1555
  {/* ══════════════════════════════════════════════════════════════════════ */}
1554
- {activeSubTab === 'packages' && !isAnalyzing && (<react_native_1.View style={{ flex: 1 }}>
1556
+ {activeSubTab === 'packages' && (<react_native_1.View style={{ flex: 1 }}>
1555
1557
  <react_native_1.ScrollView style={{ flex: 1 }} contentContainerStyle={bundleStyles.contentContainer} keyboardShouldPersistTaps="handled">
1556
1558
 
1557
1559
  <react_native_1.View style={bundleStyles.filterContainer}>
@@ -1705,7 +1707,7 @@ const BundleTab = react_1.default.memo(() => {
1705
1707
  {/* ══════════════════════════════════════════════════════════════════════ */}
1706
1708
  {/* ── 4. TAB: MEDIA & ASSET AUDITOR ───────────────────────────────────── */}
1707
1709
  {/* ══════════════════════════════════════════════════════════════════════ */}
1708
- {activeSubTab === 'media' && !isAnalyzing && (<react_native_1.View style={{ flex: 1 }}>
1710
+ {activeSubTab === 'media' && (<react_native_1.View style={{ flex: 1 }}>
1709
1711
  <react_native_1.ScrollView style={{ flex: 1 }} contentContainerStyle={bundleStyles.contentContainer} keyboardShouldPersistTaps="handled">
1710
1712
 
1711
1713
  <react_native_1.View style={bundleStyles.tipsCard}>