react-native-debug-toolkit 2.1.0 → 2.2.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 +54 -92
- package/README.zh-CN.md +50 -88
- package/lib/commonjs/core/DebugToolkit.js +33 -11
- package/lib/commonjs/core/DebugToolkit.js.map +1 -1
- package/lib/commonjs/core/DebugToolkitProvider.js +18 -12
- package/lib/commonjs/core/DebugToolkitProvider.js.map +1 -1
- package/lib/commonjs/{initialize.js → core/initialize.js} +17 -17
- package/lib/commonjs/core/initialize.js.map +1 -0
- package/lib/commonjs/{components → features/clipboard}/ClipboardTab.js +2 -2
- package/lib/commonjs/features/clipboard/ClipboardTab.js.map +1 -0
- package/lib/commonjs/features/{ClipboardFeature.js → clipboard/index.js} +3 -3
- package/lib/commonjs/features/clipboard/index.js.map +1 -0
- package/lib/commonjs/{components → features/console}/ConsoleLogTab.js +9 -9
- package/lib/commonjs/features/console/ConsoleLogTab.js.map +1 -0
- package/lib/commonjs/features/{ConsoleLogFeature.js → console/index.js} +10 -7
- package/lib/commonjs/features/console/index.js.map +1 -0
- package/lib/commonjs/{components → features/environment}/EnvironmentTab.js +3 -3
- package/lib/commonjs/features/environment/EnvironmentTab.js.map +1 -0
- package/lib/commonjs/features/{EnvironmentFeature.js → environment/index.js} +18 -13
- package/lib/commonjs/features/environment/index.js.map +1 -0
- package/lib/commonjs/{components → features/navigation}/NavigationLogTab.js +4 -3
- package/lib/commonjs/features/navigation/NavigationLogTab.js.map +1 -0
- package/lib/commonjs/features/{NavigationLogFeature.js → navigation/index.js} +4 -4
- package/lib/commonjs/features/navigation/index.js.map +1 -0
- package/lib/commonjs/{hooks → features/navigation}/useNavigationLogger.js +3 -3
- package/lib/commonjs/features/navigation/useNavigationLogger.js.map +1 -0
- package/lib/commonjs/{components → features/network}/NetworkLogTab.js +8 -7
- package/lib/commonjs/features/network/NetworkLogTab.js.map +1 -0
- package/lib/commonjs/features/{NetworkFeature.js → network/index.js} +20 -31
- package/lib/commonjs/features/network/index.js.map +1 -0
- package/lib/commonjs/features/network/networkInterceptor.js +261 -0
- package/lib/commonjs/features/network/networkInterceptor.js.map +1 -0
- package/lib/commonjs/{components → features/thirdPartyLibs}/ThirdPartyLibsTab.js +3 -2
- package/lib/commonjs/features/thirdPartyLibs/ThirdPartyLibsTab.js.map +1 -0
- package/lib/commonjs/features/{ThirdPartyLibsFeature.js → thirdPartyLibs/index.js} +8 -8
- package/lib/commonjs/features/thirdPartyLibs/index.js.map +1 -0
- package/lib/commonjs/{native/NativeDebugLibs.js → features/thirdPartyLibs/nativeDebugLibs.js} +1 -1
- package/lib/commonjs/features/thirdPartyLibs/nativeDebugLibs.js.map +1 -0
- package/lib/commonjs/{components → features/track}/TrackLogTab.js +8 -8
- package/lib/commonjs/features/track/TrackLogTab.js.map +1 -0
- package/lib/commonjs/features/{TrackFeature.js → track/index.js} +10 -5
- package/lib/commonjs/features/track/index.js.map +1 -0
- package/lib/commonjs/{components → features/zustand}/ZustandLogTab.js +8 -8
- package/lib/commonjs/features/zustand/ZustandLogTab.js.map +1 -0
- package/lib/commonjs/features/{ZustandLogFeature.js → zustand/index.js} +4 -4
- package/lib/commonjs/features/zustand/index.js.map +1 -0
- package/lib/commonjs/index.js +21 -21
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types/environment.js +2 -0
- package/lib/commonjs/types/environment.js.map +1 -0
- package/lib/commonjs/types/feature.js +6 -0
- package/lib/commonjs/types/feature.js.map +1 -0
- package/lib/commonjs/types/index.js +0 -4
- package/lib/commonjs/types/logs.js +2 -0
- package/lib/commonjs/types/logs.js.map +1 -0
- package/lib/commonjs/types/navigation.js +2 -0
- package/lib/commonjs/types/navigation.js.map +1 -0
- package/lib/commonjs/types/thirdPartyLibs.js +2 -0
- package/lib/commonjs/types/thirdPartyLibs.js.map +1 -0
- package/lib/commonjs/{components → ui}/DebugView.js +2 -2
- package/lib/commonjs/ui/DebugView.js.map +1 -0
- package/lib/commonjs/{components → ui/floating}/FloatIcon.js +65 -12
- package/lib/commonjs/ui/floating/FloatIcon.js.map +1 -0
- package/lib/commonjs/{components → ui/panel}/DebugPanel.js +4 -4
- package/lib/commonjs/ui/panel/DebugPanel.js.map +1 -0
- package/lib/commonjs/{components → ui/panel}/FeatureTabBar.js +1 -1
- package/lib/commonjs/ui/panel/FeatureTabBar.js.map +1 -0
- package/lib/commonjs/{components → ui/panel}/FloatPanelView.js +36 -12
- package/lib/commonjs/ui/panel/FloatPanelView.js.map +1 -0
- package/lib/commonjs/{components → ui}/shared/CollapsibleSection.js +1 -1
- package/lib/commonjs/ui/shared/CollapsibleSection.js.map +1 -0
- package/lib/commonjs/{components → ui}/shared/CopyButton.js +1 -1
- package/lib/commonjs/ui/shared/CopyButton.js.map +1 -0
- package/lib/commonjs/ui/shared/JsonView.js.map +1 -0
- package/lib/commonjs/{components → ui}/shared/LogListScreen.js +2 -2
- package/lib/commonjs/ui/shared/LogListScreen.js.map +1 -0
- package/lib/commonjs/ui/shared/useSlideDetailAnimation.js.map +1 -0
- package/lib/commonjs/{utils → ui/theme}/colors.js +0 -5
- package/lib/commonjs/ui/theme/colors.js.map +1 -0
- package/lib/commonjs/ui/theme/layout.js.map +1 -0
- package/lib/commonjs/utils/createChannelFeature.js +18 -4
- package/lib/commonjs/utils/createChannelFeature.js.map +1 -1
- package/lib/commonjs/utils/createObservableStore.js +5 -0
- package/lib/commonjs/utils/createObservableStore.js.map +1 -1
- package/lib/commonjs/utils/createPersistedObservableStore.js +71 -0
- package/lib/commonjs/utils/createPersistedObservableStore.js.map +1 -0
- package/lib/commonjs/utils/debugPreferences.js +52 -0
- package/lib/commonjs/utils/debugPreferences.js.map +1 -0
- package/lib/module/core/DebugToolkit.js +33 -11
- package/lib/module/core/DebugToolkit.js.map +1 -1
- package/lib/module/core/DebugToolkitProvider.js +18 -12
- package/lib/module/core/DebugToolkitProvider.js.map +1 -1
- package/lib/module/{initialize.js → core/initialize.js} +10 -10
- package/lib/module/core/initialize.js.map +1 -0
- package/lib/module/{components → features/clipboard}/ClipboardTab.js +2 -2
- package/lib/module/features/clipboard/ClipboardTab.js.map +1 -0
- package/lib/module/features/{ClipboardFeature.js → clipboard/index.js} +3 -3
- package/lib/module/features/clipboard/index.js.map +1 -0
- package/lib/module/{components → features/console}/ConsoleLogTab.js +9 -9
- package/lib/module/features/console/ConsoleLogTab.js.map +1 -0
- package/lib/module/features/{ConsoleLogFeature.js → console/index.js} +10 -7
- package/lib/module/features/console/index.js.map +1 -0
- package/lib/module/{components → features/environment}/EnvironmentTab.js +3 -3
- package/lib/module/features/environment/EnvironmentTab.js.map +1 -0
- package/lib/module/features/{EnvironmentFeature.js → environment/index.js} +18 -13
- package/lib/module/features/environment/index.js.map +1 -0
- package/lib/module/{components → features/navigation}/NavigationLogTab.js +4 -3
- package/lib/module/features/navigation/NavigationLogTab.js.map +1 -0
- package/lib/module/features/{NavigationLogFeature.js → navigation/index.js} +4 -4
- package/lib/module/features/navigation/index.js.map +1 -0
- package/lib/module/{hooks → features/navigation}/useNavigationLogger.js +2 -2
- package/lib/module/features/navigation/useNavigationLogger.js.map +1 -0
- package/lib/module/{components → features/network}/NetworkLogTab.js +8 -7
- package/lib/module/features/network/NetworkLogTab.js.map +1 -0
- package/lib/module/features/{NetworkFeature.js → network/index.js} +20 -31
- package/lib/module/features/network/index.js.map +1 -0
- package/lib/module/features/network/networkInterceptor.js +256 -0
- package/lib/module/features/network/networkInterceptor.js.map +1 -0
- package/lib/module/{components → features/thirdPartyLibs}/ThirdPartyLibsTab.js +3 -2
- package/lib/module/features/thirdPartyLibs/ThirdPartyLibsTab.js.map +1 -0
- package/lib/module/features/{ThirdPartyLibsFeature.js → thirdPartyLibs/index.js} +4 -4
- package/lib/module/features/thirdPartyLibs/index.js.map +1 -0
- package/lib/module/{native/NativeDebugLibs.js → features/thirdPartyLibs/nativeDebugLibs.js} +1 -1
- package/lib/module/features/thirdPartyLibs/nativeDebugLibs.js.map +1 -0
- package/lib/module/{components → features/track}/TrackLogTab.js +8 -8
- package/lib/module/features/track/TrackLogTab.js.map +1 -0
- package/lib/module/features/{TrackFeature.js → track/index.js} +10 -5
- package/lib/module/features/track/index.js.map +1 -0
- package/lib/module/{components → features/zustand}/ZustandLogTab.js +8 -8
- package/lib/module/features/zustand/ZustandLogTab.js.map +1 -0
- package/lib/module/features/{ZustandLogFeature.js → zustand/index.js} +4 -4
- package/lib/module/features/zustand/index.js.map +1 -0
- package/lib/module/index.js +11 -11
- package/lib/module/index.js.map +1 -1
- package/lib/module/types/environment.js +2 -0
- package/lib/module/types/environment.js.map +1 -0
- package/lib/module/types/feature.js +4 -0
- package/lib/module/types/feature.js.map +1 -0
- package/lib/module/types/index.js +0 -2
- package/lib/module/types/logs.js +2 -0
- package/lib/module/types/logs.js.map +1 -0
- package/lib/module/types/navigation.js +2 -0
- package/lib/module/types/navigation.js.map +1 -0
- package/lib/module/types/thirdPartyLibs.js +2 -0
- package/lib/module/types/thirdPartyLibs.js.map +1 -0
- package/lib/module/{components → ui}/DebugView.js +2 -2
- package/lib/module/ui/DebugView.js.map +1 -0
- package/lib/module/{components → ui/floating}/FloatIcon.js +66 -13
- package/lib/module/ui/floating/FloatIcon.js.map +1 -0
- package/lib/module/{components → ui/panel}/DebugPanel.js +4 -4
- package/lib/module/ui/panel/DebugPanel.js.map +1 -0
- package/lib/module/{components → ui/panel}/FeatureTabBar.js +1 -1
- package/lib/module/ui/panel/FeatureTabBar.js.map +1 -0
- package/lib/module/{components → ui/panel}/FloatPanelView.js +36 -12
- package/lib/module/ui/panel/FloatPanelView.js.map +1 -0
- package/lib/module/{components → ui}/shared/CollapsibleSection.js +1 -1
- package/lib/module/ui/shared/CollapsibleSection.js.map +1 -0
- package/lib/module/{components → ui}/shared/CopyButton.js +1 -1
- package/lib/module/ui/shared/CopyButton.js.map +1 -0
- package/lib/module/ui/shared/JsonView.js.map +1 -0
- package/lib/module/{components → ui}/shared/LogListScreen.js +2 -2
- package/lib/module/ui/shared/LogListScreen.js.map +1 -0
- package/lib/module/ui/shared/useSlideDetailAnimation.js.map +1 -0
- package/lib/module/{utils → ui/theme}/colors.js +0 -5
- package/lib/module/ui/theme/colors.js.map +1 -0
- package/lib/module/ui/theme/layout.js.map +1 -0
- package/lib/module/utils/createChannelFeature.js +18 -4
- package/lib/module/utils/createChannelFeature.js.map +1 -1
- package/lib/module/utils/createObservableStore.js +5 -0
- package/lib/module/utils/createObservableStore.js.map +1 -1
- package/lib/module/utils/createPersistedObservableStore.js +67 -0
- package/lib/module/utils/createPersistedObservableStore.js.map +1 -0
- package/lib/module/utils/debugPreferences.js +46 -0
- package/lib/module/utils/debugPreferences.js.map +1 -0
- package/lib/typescript/src/core/DebugToolkit.d.ts +7 -3
- package/lib/typescript/src/core/DebugToolkit.d.ts.map +1 -1
- package/lib/typescript/src/core/DebugToolkitProvider.d.ts +2 -2
- package/lib/typescript/src/core/DebugToolkitProvider.d.ts.map +1 -1
- package/lib/typescript/src/{initialize.d.ts → core/initialize.d.ts} +7 -7
- package/lib/typescript/src/core/initialize.d.ts.map +1 -0
- package/lib/typescript/src/features/clipboard/ClipboardTab.d.ts +4 -0
- package/lib/typescript/src/features/clipboard/ClipboardTab.d.ts.map +1 -0
- package/lib/typescript/src/features/{ClipboardFeature.d.ts → clipboard/index.d.ts} +3 -3
- package/lib/typescript/src/features/clipboard/index.d.ts.map +1 -0
- package/lib/typescript/src/{components → features/console}/ConsoleLogTab.d.ts +2 -2
- package/lib/typescript/src/features/console/ConsoleLogTab.d.ts.map +1 -0
- package/lib/typescript/src/features/{ConsoleLogFeature.d.ts → console/index.d.ts} +3 -3
- package/lib/typescript/src/features/console/index.d.ts.map +1 -0
- package/lib/typescript/src/{components → features/environment}/EnvironmentTab.d.ts +1 -1
- package/lib/typescript/src/features/environment/EnvironmentTab.d.ts.map +1 -0
- package/lib/typescript/src/features/{EnvironmentFeature.d.ts → environment/index.d.ts} +2 -2
- package/lib/typescript/src/features/environment/index.d.ts.map +1 -0
- package/lib/typescript/src/{components → features/navigation}/NavigationLogTab.d.ts +2 -2
- package/lib/typescript/src/features/navigation/NavigationLogTab.d.ts.map +1 -0
- package/lib/typescript/src/features/{NavigationLogFeature.d.ts → navigation/index.d.ts} +3 -3
- package/lib/typescript/src/features/navigation/index.d.ts.map +1 -0
- package/lib/typescript/src/{hooks → features/navigation}/useNavigationLogger.d.ts +1 -1
- package/lib/typescript/src/features/navigation/useNavigationLogger.d.ts.map +1 -0
- package/lib/typescript/src/{components → features/network}/NetworkLogTab.d.ts +2 -2
- package/lib/typescript/src/features/network/NetworkLogTab.d.ts.map +1 -0
- package/lib/typescript/src/features/network/index.d.ts +15 -0
- package/lib/typescript/src/features/network/index.d.ts.map +1 -0
- package/lib/typescript/src/features/network/networkInterceptor.d.ts +19 -0
- package/lib/typescript/src/features/network/networkInterceptor.d.ts.map +1 -0
- package/lib/typescript/src/{components → features/thirdPartyLibs}/ThirdPartyLibsTab.d.ts +2 -2
- package/lib/typescript/src/features/thirdPartyLibs/ThirdPartyLibsTab.d.ts.map +1 -0
- package/lib/typescript/src/features/thirdPartyLibs/index.d.ts +3 -0
- package/lib/typescript/src/features/thirdPartyLibs/index.d.ts.map +1 -0
- package/lib/typescript/src/{native/NativeDebugLibs.d.ts → features/thirdPartyLibs/nativeDebugLibs.d.ts} +1 -1
- package/lib/typescript/src/features/thirdPartyLibs/nativeDebugLibs.d.ts.map +1 -0
- package/lib/typescript/src/{components → features/track}/TrackLogTab.d.ts +2 -2
- package/lib/typescript/src/features/track/TrackLogTab.d.ts.map +1 -0
- package/lib/typescript/src/features/{TrackFeature.d.ts → track/index.d.ts} +3 -3
- package/lib/typescript/src/features/track/index.d.ts.map +1 -0
- package/lib/typescript/src/{components → features/zustand}/ZustandLogTab.d.ts +2 -2
- package/lib/typescript/src/features/zustand/ZustandLogTab.d.ts.map +1 -0
- package/lib/typescript/src/features/{ZustandLogFeature.d.ts → zustand/index.d.ts} +3 -3
- package/lib/typescript/src/features/zustand/index.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +19 -19
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types/environment.d.ts +11 -0
- package/lib/typescript/src/types/environment.d.ts.map +1 -0
- package/lib/typescript/src/types/feature.d.ts +23 -0
- package/lib/typescript/src/types/feature.d.ts.map +1 -0
- package/lib/typescript/src/types/index.d.ts +5 -108
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/lib/typescript/src/types/logs.d.ts +51 -0
- package/lib/typescript/src/types/logs.d.ts.map +1 -0
- package/lib/typescript/src/types/navigation.d.ts +8 -0
- package/lib/typescript/src/types/navigation.d.ts.map +1 -0
- package/lib/typescript/src/types/thirdPartyLibs.d.ts +13 -0
- package/lib/typescript/src/types/thirdPartyLibs.d.ts.map +1 -0
- package/lib/typescript/src/{components → ui}/DebugView.d.ts +1 -1
- package/lib/typescript/src/ui/DebugView.d.ts.map +1 -0
- package/lib/typescript/src/ui/floating/FloatIcon.d.ts.map +1 -0
- package/lib/typescript/src/ui/panel/DebugPanel.d.ts.map +1 -0
- package/lib/typescript/src/ui/panel/FeatureTabBar.d.ts.map +1 -0
- package/lib/typescript/src/ui/panel/FloatPanelView.d.ts +12 -0
- package/lib/typescript/src/ui/panel/FloatPanelView.d.ts.map +1 -0
- package/lib/typescript/src/ui/shared/CollapsibleSection.d.ts.map +1 -0
- package/lib/typescript/src/ui/shared/CopyButton.d.ts.map +1 -0
- package/lib/typescript/src/ui/shared/JsonView.d.ts.map +1 -0
- package/lib/typescript/src/ui/shared/LogListScreen.d.ts.map +1 -0
- package/lib/typescript/src/ui/shared/useSlideDetailAnimation.d.ts.map +1 -0
- package/lib/typescript/src/ui/theme/colors.d.ts.map +1 -0
- package/lib/typescript/src/ui/theme/layout.d.ts.map +1 -0
- package/lib/typescript/src/utils/createChannelFeature.d.ts +12 -3
- package/lib/typescript/src/utils/createChannelFeature.d.ts.map +1 -1
- package/lib/typescript/src/utils/createObservableStore.d.ts +1 -0
- package/lib/typescript/src/utils/createObservableStore.d.ts.map +1 -1
- package/lib/typescript/src/utils/createPersistedObservableStore.d.ts +15 -0
- package/lib/typescript/src/utils/createPersistedObservableStore.d.ts.map +1 -0
- package/lib/typescript/src/utils/debugPreferences.d.ts +10 -0
- package/lib/typescript/src/utils/debugPreferences.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/core/DebugToolkit.tsx +37 -11
- package/src/core/DebugToolkitProvider.tsx +20 -13
- package/src/{initialize.ts → core/initialize.ts} +16 -16
- package/src/{components → features/clipboard}/ClipboardTab.tsx +4 -4
- package/src/features/{ClipboardFeature.ts → clipboard/index.ts} +4 -4
- package/src/{components → features/console}/ConsoleLogTab.tsx +10 -10
- package/src/features/{ConsoleLogFeature.ts → console/index.ts} +11 -8
- package/src/{components → features/environment}/EnvironmentTab.tsx +5 -5
- package/src/features/{EnvironmentFeature.ts → environment/index.ts} +23 -13
- package/src/{components → features/navigation}/NavigationLogTab.tsx +6 -5
- package/src/features/{NavigationLogFeature.ts → navigation/index.ts} +5 -5
- package/src/{hooks → features/navigation}/useNavigationLogger.ts +3 -3
- package/src/{components → features/network}/NetworkLogTab.tsx +10 -9
- package/src/features/{NetworkFeature.ts → network/index.ts} +26 -39
- package/src/features/network/networkInterceptor.ts +311 -0
- package/src/{components → features/thirdPartyLibs}/ThirdPartyLibsTab.tsx +5 -4
- package/src/features/{ThirdPartyLibsFeature.ts → thirdPartyLibs/index.ts} +5 -5
- package/src/{components → features/track}/TrackLogTab.tsx +9 -9
- package/src/features/{TrackFeature.ts → track/index.ts} +13 -6
- package/src/{components → features/zustand}/ZustandLogTab.tsx +10 -10
- package/src/features/{ZustandLogFeature.ts → zustand/index.ts} +5 -5
- package/src/index.ts +19 -19
- package/src/types/environment.ts +11 -0
- package/src/types/feature.ts +32 -0
- package/src/types/index.ts +29 -127
- package/src/types/logs.ts +54 -0
- package/src/types/navigation.ts +5 -0
- package/src/types/thirdPartyLibs.ts +13 -0
- package/src/{components → ui}/DebugView.tsx +3 -3
- package/src/{components → ui/floating}/FloatIcon.tsx +60 -29
- package/src/{components → ui/panel}/DebugPanel.tsx +4 -4
- package/src/{components → ui/panel}/FeatureTabBar.tsx +1 -1
- package/src/{components → ui/panel}/FloatPanelView.tsx +38 -13
- package/src/{components → ui}/shared/CollapsibleSection.tsx +1 -1
- package/src/{components → ui}/shared/CopyButton.tsx +1 -1
- package/src/{components → ui}/shared/LogListScreen.tsx +2 -2
- package/src/{utils → ui/theme}/colors.ts +0 -5
- package/src/utils/createChannelFeature.ts +32 -7
- package/src/utils/createObservableStore.ts +6 -0
- package/src/utils/createPersistedObservableStore.ts +76 -0
- package/src/utils/debugPreferences.ts +48 -0
- package/lib/commonjs/components/ClipboardTab.js.map +0 -1
- package/lib/commonjs/components/ConsoleLogTab.js.map +0 -1
- package/lib/commonjs/components/DebugPanel.js.map +0 -1
- package/lib/commonjs/components/DebugView.js.map +0 -1
- package/lib/commonjs/components/EnvironmentTab.js.map +0 -1
- package/lib/commonjs/components/FeatureTabBar.js.map +0 -1
- package/lib/commonjs/components/FloatIcon.js.map +0 -1
- package/lib/commonjs/components/FloatPanelView.js.map +0 -1
- package/lib/commonjs/components/NavigationLogTab.js.map +0 -1
- package/lib/commonjs/components/NetworkLogTab.js.map +0 -1
- package/lib/commonjs/components/ThirdPartyLibsTab.js.map +0 -1
- package/lib/commonjs/components/TrackLogTab.js.map +0 -1
- package/lib/commonjs/components/ZustandLogTab.js.map +0 -1
- package/lib/commonjs/components/shared/CollapsibleSection.js.map +0 -1
- package/lib/commonjs/components/shared/CopyButton.js.map +0 -1
- package/lib/commonjs/components/shared/JsonView.js.map +0 -1
- package/lib/commonjs/components/shared/LogListScreen.js.map +0 -1
- package/lib/commonjs/features/ClipboardFeature.js.map +0 -1
- package/lib/commonjs/features/ConsoleLogFeature.js.map +0 -1
- package/lib/commonjs/features/EnvironmentFeature.js.map +0 -1
- package/lib/commonjs/features/NavigationLogFeature.js.map +0 -1
- package/lib/commonjs/features/NetworkFeature.js.map +0 -1
- package/lib/commonjs/features/ThirdPartyLibsFeature.js.map +0 -1
- package/lib/commonjs/features/TrackFeature.js.map +0 -1
- package/lib/commonjs/features/ZustandLogFeature.js.map +0 -1
- package/lib/commonjs/hooks/useNavigationLogger.js.map +0 -1
- package/lib/commonjs/hooks/useSlideDetailAnimation.js.map +0 -1
- package/lib/commonjs/initialize.js.map +0 -1
- package/lib/commonjs/interceptors/networkInterceptor.js +0 -466
- package/lib/commonjs/interceptors/networkInterceptor.js.map +0 -1
- package/lib/commonjs/native/NativeDebugLibs.js.map +0 -1
- package/lib/commonjs/utils/colors.js.map +0 -1
- package/lib/commonjs/utils/layout.js.map +0 -1
- package/lib/module/components/ClipboardTab.js.map +0 -1
- package/lib/module/components/ConsoleLogTab.js.map +0 -1
- package/lib/module/components/DebugPanel.js.map +0 -1
- package/lib/module/components/DebugView.js.map +0 -1
- package/lib/module/components/EnvironmentTab.js.map +0 -1
- package/lib/module/components/FeatureTabBar.js.map +0 -1
- package/lib/module/components/FloatIcon.js.map +0 -1
- package/lib/module/components/FloatPanelView.js.map +0 -1
- package/lib/module/components/NavigationLogTab.js.map +0 -1
- package/lib/module/components/NetworkLogTab.js.map +0 -1
- package/lib/module/components/ThirdPartyLibsTab.js.map +0 -1
- package/lib/module/components/TrackLogTab.js.map +0 -1
- package/lib/module/components/ZustandLogTab.js.map +0 -1
- package/lib/module/components/shared/CollapsibleSection.js.map +0 -1
- package/lib/module/components/shared/CopyButton.js.map +0 -1
- package/lib/module/components/shared/JsonView.js.map +0 -1
- package/lib/module/components/shared/LogListScreen.js.map +0 -1
- package/lib/module/features/ClipboardFeature.js.map +0 -1
- package/lib/module/features/ConsoleLogFeature.js.map +0 -1
- package/lib/module/features/EnvironmentFeature.js.map +0 -1
- package/lib/module/features/NavigationLogFeature.js.map +0 -1
- package/lib/module/features/NetworkFeature.js.map +0 -1
- package/lib/module/features/ThirdPartyLibsFeature.js.map +0 -1
- package/lib/module/features/TrackFeature.js.map +0 -1
- package/lib/module/features/ZustandLogFeature.js.map +0 -1
- package/lib/module/hooks/useNavigationLogger.js.map +0 -1
- package/lib/module/hooks/useSlideDetailAnimation.js.map +0 -1
- package/lib/module/initialize.js.map +0 -1
- package/lib/module/interceptors/networkInterceptor.js +0 -460
- package/lib/module/interceptors/networkInterceptor.js.map +0 -1
- package/lib/module/native/NativeDebugLibs.js.map +0 -1
- package/lib/module/utils/colors.js.map +0 -1
- package/lib/module/utils/layout.js.map +0 -1
- package/lib/typescript/src/components/ClipboardTab.d.ts +0 -4
- package/lib/typescript/src/components/ClipboardTab.d.ts.map +0 -1
- package/lib/typescript/src/components/ConsoleLogTab.d.ts.map +0 -1
- package/lib/typescript/src/components/DebugPanel.d.ts.map +0 -1
- package/lib/typescript/src/components/DebugView.d.ts.map +0 -1
- package/lib/typescript/src/components/EnvironmentTab.d.ts.map +0 -1
- package/lib/typescript/src/components/FeatureTabBar.d.ts.map +0 -1
- package/lib/typescript/src/components/FloatIcon.d.ts.map +0 -1
- package/lib/typescript/src/components/FloatPanelView.d.ts +0 -9
- package/lib/typescript/src/components/FloatPanelView.d.ts.map +0 -1
- package/lib/typescript/src/components/NavigationLogTab.d.ts.map +0 -1
- package/lib/typescript/src/components/NetworkLogTab.d.ts.map +0 -1
- package/lib/typescript/src/components/ThirdPartyLibsTab.d.ts.map +0 -1
- package/lib/typescript/src/components/TrackLogTab.d.ts.map +0 -1
- package/lib/typescript/src/components/ZustandLogTab.d.ts.map +0 -1
- package/lib/typescript/src/components/shared/CollapsibleSection.d.ts.map +0 -1
- package/lib/typescript/src/components/shared/CopyButton.d.ts.map +0 -1
- package/lib/typescript/src/components/shared/JsonView.d.ts.map +0 -1
- package/lib/typescript/src/components/shared/LogListScreen.d.ts.map +0 -1
- package/lib/typescript/src/features/ClipboardFeature.d.ts.map +0 -1
- package/lib/typescript/src/features/ConsoleLogFeature.d.ts.map +0 -1
- package/lib/typescript/src/features/EnvironmentFeature.d.ts.map +0 -1
- package/lib/typescript/src/features/NavigationLogFeature.d.ts.map +0 -1
- package/lib/typescript/src/features/NetworkFeature.d.ts +0 -15
- package/lib/typescript/src/features/NetworkFeature.d.ts.map +0 -1
- package/lib/typescript/src/features/ThirdPartyLibsFeature.d.ts +0 -3
- package/lib/typescript/src/features/ThirdPartyLibsFeature.d.ts.map +0 -1
- package/lib/typescript/src/features/TrackFeature.d.ts.map +0 -1
- package/lib/typescript/src/features/ZustandLogFeature.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useNavigationLogger.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useSlideDetailAnimation.d.ts.map +0 -1
- package/lib/typescript/src/initialize.d.ts.map +0 -1
- package/lib/typescript/src/interceptors/networkInterceptor.d.ts +0 -18
- package/lib/typescript/src/interceptors/networkInterceptor.d.ts.map +0 -1
- package/lib/typescript/src/native/NativeDebugLibs.d.ts.map +0 -1
- package/lib/typescript/src/utils/colors.d.ts.map +0 -1
- package/lib/typescript/src/utils/layout.d.ts.map +0 -1
- package/src/interceptors/networkInterceptor.ts +0 -646
- /package/lib/commonjs/{components → ui}/shared/JsonView.js +0 -0
- /package/lib/commonjs/{hooks → ui/shared}/useSlideDetailAnimation.js +0 -0
- /package/lib/commonjs/{utils → ui/theme}/layout.js +0 -0
- /package/lib/module/{components → ui}/shared/JsonView.js +0 -0
- /package/lib/module/{hooks → ui/shared}/useSlideDetailAnimation.js +0 -0
- /package/lib/module/{utils → ui/theme}/layout.js +0 -0
- /package/lib/typescript/src/{components → ui/floating}/FloatIcon.d.ts +0 -0
- /package/lib/typescript/src/{components → ui/panel}/DebugPanel.d.ts +0 -0
- /package/lib/typescript/src/{components → ui/panel}/FeatureTabBar.d.ts +0 -0
- /package/lib/typescript/src/{components → ui}/shared/CollapsibleSection.d.ts +0 -0
- /package/lib/typescript/src/{components → ui}/shared/CopyButton.d.ts +0 -0
- /package/lib/typescript/src/{components → ui}/shared/JsonView.d.ts +0 -0
- /package/lib/typescript/src/{components → ui}/shared/LogListScreen.d.ts +0 -0
- /package/lib/typescript/src/{hooks → ui/shared}/useSlideDetailAnimation.d.ts +0 -0
- /package/lib/typescript/src/{utils → ui/theme}/colors.d.ts +0 -0
- /package/lib/typescript/src/{utils → ui/theme}/layout.d.ts +0 -0
- /package/src/{native/NativeDebugLibs.ts → features/thirdPartyLibs/nativeDebugLibs.ts} +0 -0
- /package/src/{components → ui}/shared/JsonView.tsx +0 -0
- /package/src/{hooks → ui/shared}/useSlideDetailAnimation.ts +0 -0
- /package/src/{utils → ui/theme}/layout.ts +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { ClipboardTab } from '
|
|
2
|
-
import type { DebugFeature } from '
|
|
1
|
+
import { ClipboardTab } from './ClipboardTab';
|
|
2
|
+
import type { DebugFeature } from '../../types';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Clipboard feature — all logic lives in ClipboardTab.
|
|
6
6
|
* Data flow is user-driven (TextInput), not event-based.
|
|
7
7
|
*/
|
|
8
|
-
export const createClipboardFeature = (): DebugFeature<
|
|
8
|
+
export const createClipboardFeature = (): DebugFeature<null> => ({
|
|
9
9
|
name: 'clipboard',
|
|
10
10
|
label: 'Clipboard',
|
|
11
11
|
renderContent: ClipboardTab,
|
|
12
12
|
setup() {},
|
|
13
|
-
|
|
13
|
+
getSnapshot: () => null,
|
|
14
14
|
cleanup() {},
|
|
15
15
|
});
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { View, Text, StyleSheet, ScrollView } from 'react-native';
|
|
3
|
-
import { Colors } from '
|
|
4
|
-
import { safeStringify } from '
|
|
5
|
-
import { CollapsibleSection } from '
|
|
6
|
-
import { JsonView } from '
|
|
7
|
-
import { CopyButton } from '
|
|
8
|
-
import { LogListScreen } from '
|
|
9
|
-
import { fmt } from '
|
|
10
|
-
import type { ConsoleLogEntry, DebugFeatureRenderProps } from '
|
|
3
|
+
import { Colors } from '../../ui/theme/colors';
|
|
4
|
+
import { safeStringify } from '../../utils/safeStringify';
|
|
5
|
+
import { CollapsibleSection } from '../../ui/shared/CollapsibleSection';
|
|
6
|
+
import { JsonView } from '../../ui/shared/JsonView';
|
|
7
|
+
import { CopyButton } from '../../ui/shared/CopyButton';
|
|
8
|
+
import { LogListScreen } from '../../ui/shared/LogListScreen';
|
|
9
|
+
import { fmt } from '../../utils/copyToComputer';
|
|
10
|
+
import type { ConsoleLogEntry, DebugFeatureRenderProps } from '../../types';
|
|
11
11
|
|
|
12
12
|
const LEVEL_COLORS: Record<string, string> = {
|
|
13
13
|
log: '#8E8E93',
|
|
@@ -23,9 +23,9 @@ const LEVEL_ICONS: Record<string, string> = {
|
|
|
23
23
|
error: '✕',
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
export const ConsoleLogTab: React.FC<DebugFeatureRenderProps<ConsoleLogEntry>> = React.memo(({
|
|
26
|
+
export const ConsoleLogTab: React.FC<DebugFeatureRenderProps<ConsoleLogEntry[]>> = React.memo(({ snapshot }) => (
|
|
27
27
|
<LogListScreen
|
|
28
|
-
data={
|
|
28
|
+
data={snapshot}
|
|
29
29
|
emptyText="No console logs"
|
|
30
30
|
renderRow={(item) => (
|
|
31
31
|
<View style={s.cardRow}>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { ConsoleLogTab } from '
|
|
2
|
-
import type { ConsoleLogEntry, DebugFeature } from '
|
|
3
|
-
import {
|
|
1
|
+
import { ConsoleLogTab } from './ConsoleLogTab';
|
|
2
|
+
import type { ConsoleLogEntry, DebugFeature } from '../../types';
|
|
3
|
+
import { createPersistedObservableStore } from '../../utils/createPersistedObservableStore';
|
|
4
|
+
import { KEYS } from '../../utils/debugPreferences';
|
|
4
5
|
|
|
5
6
|
const LEVELS: ConsoleLogEntry['level'][] = ['log', 'info', 'warn', 'error'];
|
|
6
7
|
|
|
@@ -77,10 +78,12 @@ export interface ConsoleFeatureConfig {
|
|
|
77
78
|
maxLogs?: number;
|
|
78
79
|
}
|
|
79
80
|
|
|
80
|
-
export const createConsoleLogFeature = (config?: ConsoleFeatureConfig): DebugFeature<ConsoleLogEntry> => {
|
|
81
|
+
export const createConsoleLogFeature = (config?: ConsoleFeatureConfig): DebugFeature<ConsoleLogEntry[]> => {
|
|
81
82
|
const maxLogs = config?.maxLogs ?? DEFAULT_MAX_LOGS;
|
|
82
|
-
const logStore =
|
|
83
|
-
|
|
83
|
+
const logStore = createPersistedObservableStore<ConsoleLogEntry>({
|
|
84
|
+
storageKey: KEYS.consoleLogs,
|
|
85
|
+
maxPersist: 50,
|
|
86
|
+
});
|
|
84
87
|
let initialized = false;
|
|
85
88
|
let stopCapture: (() => void) | null = null;
|
|
86
89
|
|
|
@@ -92,11 +95,11 @@ export const createConsoleLogFeature = (config?: ConsoleFeatureConfig): DebugFea
|
|
|
92
95
|
if (initialized) return;
|
|
93
96
|
|
|
94
97
|
stopCapture = consoleCapture.start((entry) => {
|
|
95
|
-
logStore.push({ ...entry, id:
|
|
98
|
+
logStore.push({ ...entry, id: logStore.nextId() }, maxLogs);
|
|
96
99
|
});
|
|
97
100
|
initialized = true;
|
|
98
101
|
},
|
|
99
|
-
|
|
102
|
+
getSnapshot: () => logStore.getData(),
|
|
100
103
|
clear: () => { logStore.clear(); },
|
|
101
104
|
cleanup: () => {
|
|
102
105
|
if (!initialized) return;
|
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
StyleSheet,
|
|
7
7
|
ScrollView,
|
|
8
8
|
} from 'react-native';
|
|
9
|
-
import { Colors } from '
|
|
10
|
-
import type { DebugFeatureRenderProps, EnvironmentState } from '
|
|
11
|
-
import type { EnvironmentFeatureAPI } from '
|
|
9
|
+
import { Colors } from '../../ui/theme/colors';
|
|
10
|
+
import type { DebugFeatureRenderProps, EnvironmentState } from '../../types';
|
|
11
|
+
import type { EnvironmentFeatureAPI } from './index';
|
|
12
12
|
|
|
13
13
|
const DEFAULT_COLORS: Record<string, string> = {
|
|
14
14
|
dev: '#34C759',
|
|
@@ -20,10 +20,10 @@ const DEFAULT_COLORS: Record<string, string> = {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
export const EnvironmentTab: React.FC<DebugFeatureRenderProps<EnvironmentState>> = React.memo(({
|
|
23
|
-
|
|
23
|
+
snapshot,
|
|
24
24
|
feature,
|
|
25
25
|
}) => {
|
|
26
|
-
const state =
|
|
26
|
+
const state = snapshot;
|
|
27
27
|
if (!state || state.environments.length === 0) {
|
|
28
28
|
return (
|
|
29
29
|
<View style={styles.container}>
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { EnvironmentTab } from '
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { EnvironmentTab } from './EnvironmentTab';
|
|
2
|
+
import type {
|
|
3
|
+
DebugFeature,
|
|
4
|
+
DebugFeatureListener,
|
|
5
|
+
EnvironmentConfig,
|
|
6
|
+
EnvironmentState,
|
|
7
|
+
} from '../../types';
|
|
8
|
+
import { urlRewriter } from '../../utils/urlRewriterRegistry';
|
|
5
9
|
|
|
6
10
|
// Lazy AsyncStorage loader
|
|
7
11
|
type AsyncStorageModule = {
|
|
@@ -76,7 +80,7 @@ export interface EnvironmentFeatureAPI extends DebugFeature<EnvironmentState> {
|
|
|
76
80
|
export const createEnvironmentFeature = (
|
|
77
81
|
initialEnvironments?: EnvironmentConfig[],
|
|
78
82
|
): EnvironmentFeatureAPI => {
|
|
79
|
-
const
|
|
83
|
+
const listeners = new Set<DebugFeatureListener>();
|
|
80
84
|
let environments: EnvironmentConfig[] = initialEnvironments ?? [];
|
|
81
85
|
let initialized = false;
|
|
82
86
|
|
|
@@ -85,9 +89,10 @@ export const createEnvironmentFeature = (
|
|
|
85
89
|
currentEnvironmentId: activeEnvironmentId,
|
|
86
90
|
});
|
|
87
91
|
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
92
|
+
const notify = () => {
|
|
93
|
+
listeners.forEach((listener) => {
|
|
94
|
+
listener();
|
|
95
|
+
});
|
|
91
96
|
};
|
|
92
97
|
|
|
93
98
|
const applyEnvironment = (envId: string | null) => {
|
|
@@ -106,7 +111,7 @@ export const createEnvironmentFeature = (
|
|
|
106
111
|
}
|
|
107
112
|
}
|
|
108
113
|
|
|
109
|
-
|
|
114
|
+
notify();
|
|
110
115
|
};
|
|
111
116
|
|
|
112
117
|
const persistSelection = async (envId: string | null) => {
|
|
@@ -139,7 +144,7 @@ export const createEnvironmentFeature = (
|
|
|
139
144
|
setup: () => {
|
|
140
145
|
if (initialized) return;
|
|
141
146
|
|
|
142
|
-
|
|
147
|
+
notify();
|
|
143
148
|
initialized = true;
|
|
144
149
|
|
|
145
150
|
// Install rewriter if an environment is already selected
|
|
@@ -150,7 +155,7 @@ export const createEnvironmentFeature = (
|
|
|
150
155
|
// Async persistence load (will override if a preference exists)
|
|
151
156
|
loadPersistedSelection();
|
|
152
157
|
},
|
|
153
|
-
|
|
158
|
+
getSnapshot: getCurrentState,
|
|
154
159
|
clear: () => {
|
|
155
160
|
applyEnvironment(null);
|
|
156
161
|
persistSelection(null);
|
|
@@ -160,10 +165,15 @@ export const createEnvironmentFeature = (
|
|
|
160
165
|
urlRewriter.set(null);
|
|
161
166
|
activeEnvironmentId = null;
|
|
162
167
|
currentHostsMap = null;
|
|
163
|
-
|
|
168
|
+
notify();
|
|
164
169
|
initialized = false;
|
|
165
170
|
},
|
|
166
|
-
subscribe: (listener) =>
|
|
171
|
+
subscribe: (listener) => {
|
|
172
|
+
listeners.add(listener);
|
|
173
|
+
return () => {
|
|
174
|
+
listeners.delete(listener);
|
|
175
|
+
};
|
|
176
|
+
},
|
|
167
177
|
registerEnvironments: (envs: EnvironmentConfig[]) => {
|
|
168
178
|
environments = envs;
|
|
169
179
|
applyEnvironment(activeEnvironmentId);
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { View, Text, FlatList, StyleSheet } from 'react-native';
|
|
3
|
-
import { Colors } from '
|
|
4
|
-
import { CopyButton } from '
|
|
5
|
-
import type { DebugFeatureRenderProps, NavigationLogEntry } from '
|
|
3
|
+
import { Colors } from '../../ui/theme/colors';
|
|
4
|
+
import { CopyButton } from '../../ui/shared/CopyButton';
|
|
5
|
+
import type { DebugFeatureRenderProps, NavigationLogEntry } from '../../types';
|
|
6
6
|
|
|
7
|
-
export const NavigationLogTab: React.FC<DebugFeatureRenderProps<NavigationLogEntry>> = React.memo(({
|
|
8
|
-
|
|
7
|
+
export const NavigationLogTab: React.FC<DebugFeatureRenderProps<NavigationLogEntry[]>> = React.memo(({
|
|
8
|
+
snapshot,
|
|
9
9
|
}) => {
|
|
10
|
+
const data = snapshot;
|
|
10
11
|
const renderItem = ({ item }: { item: NavigationLogEntry }) => (
|
|
11
12
|
<View style={styles.logItem}>
|
|
12
13
|
<View style={styles.header}>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { NavigationLogTab } from '
|
|
2
|
-
import type { DebugFeature, NavigationLogEntry } from '
|
|
3
|
-
import { createEventChannel } from '
|
|
4
|
-
import { createChannelFeature } from '
|
|
1
|
+
import { NavigationLogTab } from './NavigationLogTab';
|
|
2
|
+
import type { DebugFeature, NavigationLogEntry } from '../../types';
|
|
3
|
+
import { createEventChannel } from '../../utils/createEventChannel';
|
|
4
|
+
import { createChannelFeature } from '../../utils/createChannelFeature';
|
|
5
5
|
|
|
6
6
|
type NavigationLogPayload = Omit<NavigationLogEntry, 'id'>;
|
|
7
7
|
|
|
@@ -31,7 +31,7 @@ export interface NavigationFeatureConfig {
|
|
|
31
31
|
maxLogs?: number;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
export const createNavigationLogFeature = (config?: NavigationFeatureConfig): DebugFeature<NavigationLogEntry> =>
|
|
34
|
+
export const createNavigationLogFeature = (config?: NavigationFeatureConfig): DebugFeature<NavigationLogEntry[]> =>
|
|
35
35
|
createChannelFeature(
|
|
36
36
|
() => navigationChannel,
|
|
37
37
|
(payload, id) => ({ ...payload, id }),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect, useRef } from 'react';
|
|
2
|
-
import { addNavigationLog } from '
|
|
3
|
-
import { safeStringify } from '
|
|
4
|
-
import type { NavigationContainerRef } from '
|
|
2
|
+
import { addNavigationLog } from './index';
|
|
3
|
+
import { safeStringify } from '../../utils/safeStringify';
|
|
4
|
+
import type { NavigationContainerRef } from '../../types';
|
|
5
5
|
|
|
6
6
|
function getActiveRouteName(state: unknown): string {
|
|
7
7
|
let currentState = state as
|
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
TextInput,
|
|
7
7
|
ScrollView,
|
|
8
8
|
} from 'react-native';
|
|
9
|
-
import { Colors, getMethodColor } from '
|
|
10
|
-
import { CollapsibleSection } from '
|
|
11
|
-
import { JsonView } from '
|
|
12
|
-
import { CopyButton } from '
|
|
13
|
-
import { fmt } from '
|
|
14
|
-
import { LogListScreen } from '
|
|
15
|
-
import type { DebugFeatureRenderProps, NetworkLogEntry } from '
|
|
9
|
+
import { Colors, getMethodColor } from '../../ui/theme/colors';
|
|
10
|
+
import { CollapsibleSection } from '../../ui/shared/CollapsibleSection';
|
|
11
|
+
import { JsonView } from '../../ui/shared/JsonView';
|
|
12
|
+
import { CopyButton } from '../../ui/shared/CopyButton';
|
|
13
|
+
import { fmt } from '../../utils/copyToComputer';
|
|
14
|
+
import { LogListScreen } from '../../ui/shared/LogListScreen';
|
|
15
|
+
import type { DebugFeatureRenderProps, NetworkLogEntry } from '../../types';
|
|
16
16
|
|
|
17
17
|
const formatSize = (data: unknown): string => {
|
|
18
18
|
if (!data) return '';
|
|
@@ -37,10 +37,11 @@ const buildCurl = (log: NetworkLogEntry): string => {
|
|
|
37
37
|
return c;
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
export const NetworkLogTab: React.FC<DebugFeatureRenderProps<NetworkLogEntry>> = React.memo(({
|
|
41
|
-
|
|
40
|
+
export const NetworkLogTab: React.FC<DebugFeatureRenderProps<NetworkLogEntry[]>> = React.memo(({
|
|
41
|
+
snapshot,
|
|
42
42
|
}) => {
|
|
43
43
|
const [search, setSearch] = useState('');
|
|
44
|
+
const data = snapshot;
|
|
44
45
|
|
|
45
46
|
const filtered = search
|
|
46
47
|
? data.filter(
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { NetworkLogTab } from '
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { NetworkLogTab } from './NetworkLogTab';
|
|
2
|
+
|
|
3
|
+
export type { AxiosInstanceLike } from './networkInterceptor';
|
|
4
|
+
import type { DebugFeature, NetworkLogEntry } from '../../types';
|
|
5
|
+
import { createEventChannel } from '../../utils/createEventChannel';
|
|
6
|
+
import { createPersistedObservableStore } from '../../utils/createPersistedObservableStore';
|
|
7
|
+
import { KEYS } from '../../utils/debugPreferences';
|
|
8
|
+
import { urlRewriter } from '../../utils/urlRewriterRegistry';
|
|
9
|
+
import type { AxiosInstanceLike } from './networkInterceptor';
|
|
6
10
|
import {
|
|
7
11
|
startFetch,
|
|
8
|
-
|
|
9
|
-
setupAxios,
|
|
12
|
+
startAxios,
|
|
10
13
|
resetInterceptors,
|
|
11
|
-
} from '
|
|
12
|
-
import type { AxiosInstanceLike } from '../interceptors/networkInterceptor';
|
|
14
|
+
} from './networkInterceptor';
|
|
13
15
|
|
|
14
16
|
type NetworkLogPayload = Omit<NetworkLogEntry, 'id'>;
|
|
15
17
|
|
|
@@ -39,34 +41,32 @@ function emitNetworkLog(entry: NetworkLogPayload): void {
|
|
|
39
41
|
|
|
40
42
|
const DEFAULT_MAX_LOGS = 200;
|
|
41
43
|
|
|
42
|
-
export type { AxiosInstanceLike };
|
|
43
|
-
|
|
44
44
|
export interface NetworkFeatureConfig {
|
|
45
45
|
/** Maximum number of network logs to keep (default: 200) */
|
|
46
46
|
maxLogs?: number;
|
|
47
47
|
/** URLs to filter out from logging */
|
|
48
48
|
blacklist?: Array<string | RegExp>;
|
|
49
|
+
/** Axios instance to intercept. Pass your axios.create() instance to capture axios requests. */
|
|
50
|
+
axiosInstance?: AxiosInstanceLike;
|
|
49
51
|
}
|
|
50
52
|
|
|
51
|
-
export const createNetworkFeature = (config?: NetworkFeatureConfig): DebugFeature<NetworkLogEntry>
|
|
52
|
-
setupAxiosInterceptors: (axiosInstance: AxiosInstanceLike) => () => void;
|
|
53
|
-
} => {
|
|
53
|
+
export const createNetworkFeature = (config?: NetworkFeatureConfig): DebugFeature<NetworkLogEntry[]> => {
|
|
54
54
|
const maxLogs = config?.maxLogs ?? DEFAULT_MAX_LOGS;
|
|
55
55
|
const blacklist: Array<string | RegExp> = config?.blacklist ? [...config.blacklist] : [];
|
|
56
|
-
const logStore =
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
const logStore = createPersistedObservableStore<NetworkLogEntry>({
|
|
57
|
+
storageKey: KEYS.networkLogs,
|
|
58
|
+
maxPersist: 30,
|
|
59
|
+
});
|
|
60
60
|
let initialized = false;
|
|
61
61
|
let unsubscribeLogs: (() => void) | null = null;
|
|
62
62
|
let stopFetchFn: (() => void) | null = null;
|
|
63
|
-
let
|
|
63
|
+
let stopAxiosFn: (() => void) | null = null;
|
|
64
64
|
|
|
65
65
|
const handleLog = (entry: NetworkLogPayload) => {
|
|
66
66
|
if (isUrlBlacklisted(entry.request.url, blacklist)) {
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
|
-
logStore.push({ ...entry, id:
|
|
69
|
+
logStore.push({ ...entry, id: logStore.nextId() }, maxLogs);
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
return {
|
|
@@ -79,10 +79,12 @@ export const createNetworkFeature = (config?: NetworkFeatureConfig): DebugFeatur
|
|
|
79
79
|
}
|
|
80
80
|
unsubscribeLogs = networkChannel.subscribe(handleLog);
|
|
81
81
|
stopFetchFn = startFetch(emitNetworkLog);
|
|
82
|
-
|
|
82
|
+
if (config?.axiosInstance) {
|
|
83
|
+
stopAxiosFn = startAxios(config.axiosInstance, emitNetworkLog);
|
|
84
|
+
}
|
|
83
85
|
initialized = true;
|
|
84
86
|
},
|
|
85
|
-
|
|
87
|
+
getSnapshot: () => logStore.getData(),
|
|
86
88
|
clear: () => {
|
|
87
89
|
logStore.clear();
|
|
88
90
|
},
|
|
@@ -95,27 +97,12 @@ export const createNetworkFeature = (config?: NetworkFeatureConfig): DebugFeatur
|
|
|
95
97
|
unsubscribeLogs = null;
|
|
96
98
|
stopFetchFn?.();
|
|
97
99
|
stopFetchFn = null;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
axiosCleanupMap.forEach((c) => c());
|
|
101
|
-
axiosCleanupMap.clear();
|
|
100
|
+
stopAxiosFn?.();
|
|
101
|
+
stopAxiosFn = null;
|
|
102
102
|
logStore.clear();
|
|
103
103
|
initialized = false;
|
|
104
104
|
},
|
|
105
105
|
subscribe: (listener) => logStore.subscribe(listener),
|
|
106
|
-
setupAxiosInterceptors: (axiosInstance) => {
|
|
107
|
-
const existingCleanup = axiosCleanupMap.get(axiosInstance);
|
|
108
|
-
if (existingCleanup) {
|
|
109
|
-
return existingCleanup;
|
|
110
|
-
}
|
|
111
|
-
const cleanup = setupAxios(axiosInstance, emitNetworkLog);
|
|
112
|
-
const trackedCleanup = () => {
|
|
113
|
-
cleanup();
|
|
114
|
-
axiosCleanupMap.delete(axiosInstance);
|
|
115
|
-
};
|
|
116
|
-
axiosCleanupMap.set(axiosInstance, trackedCleanup);
|
|
117
|
-
return trackedCleanup;
|
|
118
|
-
},
|
|
119
106
|
};
|
|
120
107
|
};
|
|
121
108
|
|