react-native-debug-toolkit 2.0.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 +82 -120
- package/README.zh-CN.md +171 -0
- package/lib/commonjs/core/DebugToolkit.js +117 -115
- package/lib/commonjs/core/DebugToolkit.js.map +1 -1
- package/lib/commonjs/core/DebugToolkitProvider.js +38 -30
- package/lib/commonjs/core/DebugToolkitProvider.js.map +1 -1
- package/lib/commonjs/core/initialize.js +84 -0
- package/lib/commonjs/core/initialize.js.map +1 -0
- package/lib/commonjs/{components → features/clipboard}/ClipboardTab.js +16 -17
- package/lib/commonjs/features/clipboard/ClipboardTab.js.map +1 -0
- package/lib/commonjs/features/{ClipboardFeature.js → clipboard/index.js} +9 -5
- package/lib/commonjs/features/clipboard/index.js.map +1 -0
- package/lib/commonjs/features/console/ConsoleLogTab.js +162 -0
- package/lib/commonjs/features/console/ConsoleLogTab.js.map +1 -0
- package/lib/commonjs/features/console/index.js +118 -0
- package/lib/commonjs/features/console/index.js.map +1 -0
- package/lib/commonjs/{components → features/environment}/EnvironmentTab.js +24 -25
- package/lib/commonjs/features/environment/EnvironmentTab.js.map +1 -0
- package/lib/commonjs/features/{EnvironmentFeature.js → environment/index.js} +22 -25
- package/lib/commonjs/features/environment/index.js.map +1 -0
- package/lib/commonjs/{components → features/navigation}/NavigationLogTab.js +11 -10
- package/lib/commonjs/features/navigation/NavigationLogTab.js.map +1 -0
- package/lib/commonjs/features/navigation/index.js +39 -0
- 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/features/network/NetworkLogTab.js +405 -0
- package/lib/commonjs/features/network/NetworkLogTab.js.map +1 -0
- package/lib/commonjs/features/network/index.js +96 -0
- 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 +10 -9
- 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/features/track/TrackLogTab.js +230 -0
- package/lib/commonjs/features/track/TrackLogTab.js.map +1 -0
- package/lib/commonjs/features/track/index.js +39 -0
- package/lib/commonjs/features/track/index.js.map +1 -0
- package/lib/commonjs/features/zustand/ZustandLogTab.js +311 -0
- package/lib/commonjs/features/zustand/ZustandLogTab.js.map +1 -0
- package/lib/commonjs/features/zustand/index.js +59 -0
- package/lib/commonjs/features/zustand/index.js.map +1 -0
- package/lib/commonjs/index.js +27 -40
- 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/ui/DebugView.js +66 -0
- package/lib/commonjs/ui/DebugView.js.map +1 -0
- package/lib/commonjs/ui/floating/FloatIcon.js +240 -0
- package/lib/commonjs/ui/floating/FloatIcon.js.map +1 -0
- package/lib/commonjs/ui/panel/DebugPanel.js +230 -0
- package/lib/commonjs/ui/panel/DebugPanel.js.map +1 -0
- package/lib/commonjs/ui/panel/FeatureTabBar.js +182 -0
- package/lib/commonjs/ui/panel/FeatureTabBar.js.map +1 -0
- package/lib/commonjs/ui/panel/FloatPanelView.js +238 -0
- package/lib/commonjs/ui/panel/FloatPanelView.js.map +1 -0
- package/lib/commonjs/{components → ui}/shared/CollapsibleSection.js +4 -4
- package/lib/commonjs/ui/shared/CollapsibleSection.js.map +1 -0
- package/lib/commonjs/{components → ui}/shared/CopyButton.js +3 -3
- package/lib/commonjs/ui/shared/CopyButton.js.map +1 -0
- package/lib/commonjs/ui/shared/JsonView.js.map +1 -0
- package/lib/commonjs/ui/shared/LogListScreen.js +174 -0
- package/lib/commonjs/ui/shared/LogListScreen.js.map +1 -0
- package/lib/commonjs/ui/shared/useSlideDetailAnimation.js.map +1 -0
- package/lib/commonjs/ui/theme/colors.js +43 -0
- package/lib/commonjs/ui/theme/colors.js.map +1 -0
- package/lib/commonjs/ui/theme/layout.js +8 -0
- package/lib/commonjs/ui/theme/layout.js.map +1 -0
- package/lib/commonjs/utils/createChannelFeature.js +62 -0
- package/lib/commonjs/utils/createChannelFeature.js.map +1 -0
- 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/commonjs/utils/urlRewriterRegistry.js +14 -0
- package/lib/commonjs/utils/urlRewriterRegistry.js.map +1 -0
- package/lib/module/core/DebugToolkit.js +117 -114
- package/lib/module/core/DebugToolkit.js.map +1 -1
- package/lib/module/core/DebugToolkitProvider.js +39 -31
- package/lib/module/core/DebugToolkitProvider.js.map +1 -1
- package/lib/module/core/initialize.js +80 -0
- package/lib/module/core/initialize.js.map +1 -0
- package/lib/module/{components → features/clipboard}/ClipboardTab.js +9 -9
- package/lib/module/features/clipboard/ClipboardTab.js.map +1 -0
- package/lib/module/features/clipboard/index.js +16 -0
- package/lib/module/features/clipboard/index.js.map +1 -0
- package/lib/module/features/console/ConsoleLogTab.js +157 -0
- package/lib/module/features/console/ConsoleLogTab.js.map +1 -0
- package/lib/module/features/console/index.js +112 -0
- package/lib/module/features/console/index.js.map +1 -0
- package/lib/module/{components → features/environment}/EnvironmentTab.js +5 -5
- package/lib/module/features/environment/EnvironmentTab.js.map +1 -0
- package/lib/module/features/{EnvironmentFeature.js → environment/index.js} +22 -25
- 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/navigation/index.js +32 -0
- 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/features/network/NetworkLogTab.js +400 -0
- package/lib/module/features/network/NetworkLogTab.js.map +1 -0
- package/lib/module/features/network/index.js +90 -0
- 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/features/track/TrackLogTab.js +225 -0
- package/lib/module/features/track/TrackLogTab.js.map +1 -0
- package/lib/module/features/track/index.js +32 -0
- package/lib/module/features/track/index.js.map +1 -0
- package/lib/module/features/zustand/ZustandLogTab.js +306 -0
- package/lib/module/features/zustand/ZustandLogTab.js.map +1 -0
- package/lib/module/features/zustand/index.js +53 -0
- package/lib/module/features/zustand/index.js.map +1 -0
- package/lib/module/index.js +11 -12
- 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/ui/DebugView.js +61 -0
- package/lib/module/ui/DebugView.js.map +1 -0
- package/lib/module/ui/floating/FloatIcon.js +235 -0
- package/lib/module/ui/floating/FloatIcon.js.map +1 -0
- package/lib/module/ui/panel/DebugPanel.js +225 -0
- package/lib/module/ui/panel/DebugPanel.js.map +1 -0
- package/lib/module/ui/panel/FeatureTabBar.js +177 -0
- package/lib/module/ui/panel/FeatureTabBar.js.map +1 -0
- package/lib/module/ui/panel/FloatPanelView.js +233 -0
- 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/ui/shared/LogListScreen.js +169 -0
- package/lib/module/ui/shared/LogListScreen.js.map +1 -0
- package/lib/module/ui/shared/useSlideDetailAnimation.js.map +1 -0
- package/lib/module/ui/theme/colors.js +38 -0
- package/lib/module/ui/theme/colors.js.map +1 -0
- package/lib/module/ui/theme/layout.js +4 -0
- package/lib/module/ui/theme/layout.js.map +1 -0
- package/lib/module/utils/createChannelFeature.js +58 -0
- package/lib/module/utils/createChannelFeature.js.map +1 -0
- 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/module/utils/urlRewriterRegistry.js +10 -0
- package/lib/module/utils/urlRewriterRegistry.js.map +1 -0
- package/lib/typescript/src/core/DebugToolkit.d.ts +17 -20
- package/lib/typescript/src/core/DebugToolkit.d.ts.map +1 -1
- package/lib/typescript/src/core/DebugToolkitProvider.d.ts +4 -7
- package/lib/typescript/src/core/DebugToolkitProvider.d.ts.map +1 -1
- package/lib/typescript/src/core/initialize.d.ts +32 -0
- 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/clipboard/index.d.ts +7 -0
- 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/console/index.d.ts +9 -0
- 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} +5 -3
- package/lib/typescript/src/features/navigation/index.d.ts.map +1 -0
- package/lib/typescript/src/{hooks → features/navigation}/useNavigationLogger.d.ts +1 -8
- 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} +5 -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} +5 -3
- package/lib/typescript/src/features/zustand/index.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +20 -20
- 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 -111
- 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/ui/DebugView.d.ts +19 -0
- package/lib/typescript/src/ui/DebugView.d.ts.map +1 -0
- package/lib/typescript/src/ui/floating/FloatIcon.d.ts +12 -0
- package/lib/typescript/src/ui/floating/FloatIcon.d.ts.map +1 -0
- package/lib/typescript/src/ui/panel/DebugPanel.d.ts +9 -0
- package/lib/typescript/src/ui/panel/DebugPanel.d.ts.map +1 -0
- package/lib/typescript/src/ui/panel/FeatureTabBar.d.ts +13 -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 +21 -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 +21 -0
- package/lib/typescript/src/ui/theme/colors.d.ts.map +1 -0
- package/lib/typescript/src/ui/theme/layout.d.ts +2 -0
- package/lib/typescript/src/ui/theme/layout.d.ts.map +1 -0
- package/lib/typescript/src/utils/createChannelFeature.d.ts +27 -0
- package/lib/typescript/src/utils/createChannelFeature.d.ts.map +1 -0
- 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/lib/typescript/src/utils/urlRewriterRegistry.d.ts +7 -0
- package/lib/typescript/src/utils/urlRewriterRegistry.d.ts.map +1 -0
- package/package.json +5 -1
- package/src/core/DebugToolkit.tsx +144 -142
- package/src/core/DebugToolkitProvider.tsx +44 -43
- package/src/core/initialize.ts +122 -0
- package/src/{components → features/clipboard}/ClipboardTab.tsx +10 -10
- package/src/features/clipboard/index.ts +15 -0
- package/src/features/console/ConsoleLogTab.tsx +95 -0
- package/src/features/console/index.ts +119 -0
- package/src/{components → features/environment}/EnvironmentTab.tsx +7 -7
- package/src/features/{EnvironmentFeature.ts → environment/index.ts} +27 -25
- package/src/{components → features/navigation}/NavigationLogTab.tsx +6 -5
- package/src/features/navigation/index.ts +44 -0
- package/src/{hooks → features/navigation}/useNavigationLogger.ts +3 -8
- package/src/features/network/NetworkLogTab.tsx +271 -0
- package/src/features/network/index.ts +113 -0
- package/src/features/network/networkInterceptor.ts +311 -0
- package/src/{components → features/thirdPartyLibs}/ThirdPartyLibsTab.tsx +6 -5
- package/src/features/{ThirdPartyLibsFeature.ts → thirdPartyLibs/index.ts} +5 -5
- package/src/features/track/TrackLogTab.tsx +110 -0
- package/src/features/track/index.ts +41 -0
- package/src/features/zustand/ZustandLogTab.tsx +203 -0
- package/src/features/{ZustandLogFeature.ts → zustand/index.ts} +19 -45
- package/src/index.ts +20 -24
- package/src/types/environment.ts +11 -0
- package/src/types/feature.ts +32 -0
- package/src/types/index.ts +29 -138
- package/src/types/logs.ts +54 -0
- package/src/types/navigation.ts +5 -0
- package/src/types/thirdPartyLibs.ts +13 -0
- package/src/ui/DebugView.tsx +80 -0
- package/src/ui/floating/FloatIcon.tsx +202 -0
- package/src/ui/panel/DebugPanel.tsx +215 -0
- package/src/ui/panel/FeatureTabBar.tsx +204 -0
- package/src/ui/panel/FloatPanelView.tsx +227 -0
- package/src/{components → ui}/shared/CollapsibleSection.tsx +1 -1
- package/src/{components → ui}/shared/CopyButton.tsx +1 -1
- package/src/ui/shared/LogListScreen.tsx +164 -0
- package/src/ui/theme/colors.ts +33 -0
- package/src/ui/theme/layout.ts +1 -0
- package/src/utils/createChannelFeature.ts +80 -0
- package/src/utils/createObservableStore.ts +6 -0
- package/src/utils/createPersistedObservableStore.ts +76 -0
- package/src/utils/debugPreferences.ts +48 -0
- package/src/utils/urlRewriterRegistry.ts +10 -0
- package/lib/commonjs/components/ClipboardTab.js.map +0 -1
- package/lib/commonjs/components/ConsoleLogTab.js +0 -295
- package/lib/commonjs/components/ConsoleLogTab.js.map +0 -1
- package/lib/commonjs/components/EnvironmentTab.js.map +0 -1
- package/lib/commonjs/components/FloatPanelView.js +0 -797
- package/lib/commonjs/components/FloatPanelView.js.map +0 -1
- package/lib/commonjs/components/NavigationLogTab.js.map +0 -1
- package/lib/commonjs/components/NetworkLogTab.js +0 -575
- package/lib/commonjs/components/NetworkLogTab.js.map +0 -1
- package/lib/commonjs/components/ThirdPartyLibsTab.js.map +0 -1
- package/lib/commonjs/components/TrackLogTab.js +0 -372
- package/lib/commonjs/components/TrackLogTab.js.map +0 -1
- package/lib/commonjs/components/ZustandLogTab.js +0 -451
- 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/features/ClipboardFeature.js.map +0 -1
- package/lib/commonjs/features/ConsoleLogFeature.js +0 -98
- package/lib/commonjs/features/ConsoleLogFeature.js.map +0 -1
- package/lib/commonjs/features/EnvironmentFeature.js.map +0 -1
- package/lib/commonjs/features/NavigationLogFeature.js +0 -60
- package/lib/commonjs/features/NavigationLogFeature.js.map +0 -1
- package/lib/commonjs/features/NetworkFeature.js +0 -328
- package/lib/commonjs/features/NetworkFeature.js.map +0 -1
- package/lib/commonjs/features/ThirdPartyLibsFeature.js.map +0 -1
- package/lib/commonjs/features/TrackFeature.js +0 -55
- package/lib/commonjs/features/TrackFeature.js.map +0 -1
- package/lib/commonjs/features/ZustandLogFeature.js +0 -76
- 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 +0 -161
- package/lib/commonjs/initialize.js.map +0 -1
- package/lib/commonjs/native/NativeDebugLibs.js.map +0 -1
- package/lib/commonjs/utils/constants.js +0 -135
- package/lib/commonjs/utils/constants.js.map +0 -1
- package/lib/module/components/ClipboardTab.js.map +0 -1
- package/lib/module/components/ConsoleLogTab.js +0 -290
- package/lib/module/components/ConsoleLogTab.js.map +0 -1
- package/lib/module/components/EnvironmentTab.js.map +0 -1
- package/lib/module/components/FloatPanelView.js +0 -791
- package/lib/module/components/FloatPanelView.js.map +0 -1
- package/lib/module/components/NavigationLogTab.js.map +0 -1
- package/lib/module/components/NetworkLogTab.js +0 -570
- package/lib/module/components/NetworkLogTab.js.map +0 -1
- package/lib/module/components/ThirdPartyLibsTab.js.map +0 -1
- package/lib/module/components/TrackLogTab.js +0 -367
- package/lib/module/components/TrackLogTab.js.map +0 -1
- package/lib/module/components/ZustandLogTab.js +0 -446
- 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/features/ClipboardFeature.js +0 -12
- package/lib/module/features/ClipboardFeature.js.map +0 -1
- package/lib/module/features/ConsoleLogFeature.js +0 -93
- package/lib/module/features/ConsoleLogFeature.js.map +0 -1
- package/lib/module/features/EnvironmentFeature.js.map +0 -1
- package/lib/module/features/NavigationLogFeature.js +0 -54
- package/lib/module/features/NavigationLogFeature.js.map +0 -1
- package/lib/module/features/NetworkFeature.js +0 -322
- package/lib/module/features/NetworkFeature.js.map +0 -1
- package/lib/module/features/ThirdPartyLibsFeature.js.map +0 -1
- package/lib/module/features/TrackFeature.js +0 -49
- package/lib/module/features/TrackFeature.js.map +0 -1
- package/lib/module/features/ZustandLogFeature.js +0 -69
- 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 +0 -156
- package/lib/module/initialize.js.map +0 -1
- package/lib/module/native/NativeDebugLibs.js.map +0 -1
- package/lib/module/utils/constants.js +0 -130
- package/lib/module/utils/constants.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/EnvironmentTab.d.ts.map +0 -1
- package/lib/typescript/src/components/FloatPanelView.d.ts +0 -64
- 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/features/ClipboardFeature.d.ts +0 -3
- package/lib/typescript/src/features/ClipboardFeature.d.ts.map +0 -1
- package/lib/typescript/src/features/ConsoleLogFeature.d.ts +0 -7
- 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 -28
- 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 +0 -51
- package/lib/typescript/src/initialize.d.ts.map +0 -1
- package/lib/typescript/src/native/NativeDebugLibs.d.ts.map +0 -1
- package/lib/typescript/src/utils/constants.d.ts +0 -96
- package/lib/typescript/src/utils/constants.d.ts.map +0 -1
- package/src/components/ConsoleLogTab.tsx +0 -209
- package/src/components/FloatPanelView.tsx +0 -714
- package/src/components/NetworkLogTab.tsx +0 -411
- package/src/components/TrackLogTab.tsx +0 -245
- package/src/components/ZustandLogTab.tsx +0 -305
- package/src/features/ClipboardFeature.ts +0 -11
- package/src/features/ConsoleLogFeature.ts +0 -118
- package/src/features/NavigationLogFeature.ts +0 -74
- package/src/features/NetworkFeature.ts +0 -488
- package/src/features/TrackFeature.ts +0 -69
- package/src/initialize.ts +0 -214
- package/src/utils/constants.ts +0 -91
- /package/lib/commonjs/{components → ui}/shared/JsonView.js +0 -0
- /package/lib/commonjs/{hooks → ui/shared}/useSlideDetailAnimation.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/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/{hooks → ui/shared}/useSlideDetailAnimation.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
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, Text, StyleSheet, ScrollView } from 'react-native';
|
|
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
|
+
|
|
12
|
+
const LEVEL_COLORS: Record<string, string> = {
|
|
13
|
+
log: '#8E8E93',
|
|
14
|
+
info: '#007AFF',
|
|
15
|
+
warn: '#FF9500',
|
|
16
|
+
error: '#FF3B30',
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const LEVEL_ICONS: Record<string, string> = {
|
|
20
|
+
log: '●',
|
|
21
|
+
info: 'ℹ',
|
|
22
|
+
warn: '⚠',
|
|
23
|
+
error: '✕',
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const ConsoleLogTab: React.FC<DebugFeatureRenderProps<ConsoleLogEntry[]>> = React.memo(({ snapshot }) => (
|
|
27
|
+
<LogListScreen
|
|
28
|
+
data={snapshot}
|
|
29
|
+
emptyText="No console logs"
|
|
30
|
+
renderRow={(item) => (
|
|
31
|
+
<View style={s.cardRow}>
|
|
32
|
+
<View style={[s.levelDot, { backgroundColor: LEVEL_COLORS[item.level] ?? '#8E8E93' }]}>
|
|
33
|
+
<Text style={s.levelIcon}>{LEVEL_ICONS[item.level] ?? '●'}</Text>
|
|
34
|
+
</View>
|
|
35
|
+
<View style={s.cardContent}>
|
|
36
|
+
<Text style={s.logMessage} numberOfLines={2}>
|
|
37
|
+
{item.data.map((d) => (typeof d === 'string' ? d : safeStringify(d))).join(' ')}
|
|
38
|
+
</Text>
|
|
39
|
+
<Text style={s.time}>{new Date(item.timestamp).toLocaleTimeString()}</Text>
|
|
40
|
+
</View>
|
|
41
|
+
</View>
|
|
42
|
+
)}
|
|
43
|
+
renderDetailHeader={(item) => (
|
|
44
|
+
<>
|
|
45
|
+
<View style={[s.levelBadge, { backgroundColor: LEVEL_COLORS[item.level] ?? '#8E8E93' }]}>
|
|
46
|
+
<Text style={s.levelBadgeText}>{item.level.toUpperCase()}</Text>
|
|
47
|
+
</View>
|
|
48
|
+
<Text style={s.detailTime}>{new Date(item.timestamp).toLocaleString()}</Text>
|
|
49
|
+
</>
|
|
50
|
+
)}
|
|
51
|
+
renderDetailBody={(item) => (
|
|
52
|
+
<ScrollView style={s.detailBody} contentContainerStyle={s.detailBodyContent}>
|
|
53
|
+
{item.data.map((d, index) => {
|
|
54
|
+
const formatted = typeof d === 'object' && d !== null ? fmt(d) : String(d);
|
|
55
|
+
return (
|
|
56
|
+
<CollapsibleSection
|
|
57
|
+
key={index}
|
|
58
|
+
title={typeof d === 'object' && d !== null ? `Arg ${index + 1} (object)` : `Arg ${index + 1}`}
|
|
59
|
+
initiallyExpanded={index === 0}
|
|
60
|
+
>
|
|
61
|
+
<View style={s.sectionWithCopy}>
|
|
62
|
+
<CopyButton text={formatted} label={`Console Arg ${index + 1}`} />
|
|
63
|
+
{typeof d === 'object' && d !== null ? (
|
|
64
|
+
<JsonView data={d} maxHeight={250} />
|
|
65
|
+
) : (
|
|
66
|
+
<Text style={s.plainText} selectable>{String(d)}</Text>
|
|
67
|
+
)}
|
|
68
|
+
</View>
|
|
69
|
+
</CollapsibleSection>
|
|
70
|
+
);
|
|
71
|
+
})}
|
|
72
|
+
</ScrollView>
|
|
73
|
+
)}
|
|
74
|
+
/>
|
|
75
|
+
));
|
|
76
|
+
|
|
77
|
+
const s = StyleSheet.create({
|
|
78
|
+
cardRow: { flexDirection: 'row', padding: 14, alignItems: 'flex-start' },
|
|
79
|
+
levelDot: {
|
|
80
|
+
width: 24, height: 24, borderRadius: 12,
|
|
81
|
+
alignItems: 'center', justifyContent: 'center',
|
|
82
|
+
marginRight: 12, marginTop: 1,
|
|
83
|
+
},
|
|
84
|
+
levelIcon: { color: '#FFF', fontSize: 11, fontWeight: '700' },
|
|
85
|
+
cardContent: { flex: 1 },
|
|
86
|
+
logMessage: { fontSize: 14, color: Colors.text, lineHeight: 20 },
|
|
87
|
+
time: { fontSize: 12, color: Colors.textSecondary, marginTop: 4 },
|
|
88
|
+
levelBadge: { paddingHorizontal: 10, paddingVertical: 4, borderRadius: 6 },
|
|
89
|
+
levelBadgeText: { color: '#FFF', fontSize: 12, fontWeight: '700' },
|
|
90
|
+
detailTime: { flex: 1, fontSize: 13, color: Colors.textSecondary, textAlign: 'right' },
|
|
91
|
+
detailBody: { flex: 1 },
|
|
92
|
+
detailBodyContent: { padding: 12 },
|
|
93
|
+
sectionWithCopy: { gap: 8 },
|
|
94
|
+
plainText: { fontFamily: 'Courier', fontSize: 13, color: Colors.text, lineHeight: 20 },
|
|
95
|
+
});
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { ConsoleLogTab } from './ConsoleLogTab';
|
|
2
|
+
import type { ConsoleLogEntry, DebugFeature } from '../../types';
|
|
3
|
+
import { createPersistedObservableStore } from '../../utils/createPersistedObservableStore';
|
|
4
|
+
import { KEYS } from '../../utils/debugPreferences';
|
|
5
|
+
|
|
6
|
+
const LEVELS: ConsoleLogEntry['level'][] = ['log', 'info', 'warn', 'error'];
|
|
7
|
+
|
|
8
|
+
// ─── Console capture manager (encapsulated mutable state) ──
|
|
9
|
+
|
|
10
|
+
const consoleCapture = (() => {
|
|
11
|
+
const originalMethods: Partial<Record<ConsoleLogEntry['level'], (...args: unknown[]) => void>> = {};
|
|
12
|
+
let refCount = 0;
|
|
13
|
+
|
|
14
|
+
function stop(): void {
|
|
15
|
+
refCount = Math.max(0, refCount - 1);
|
|
16
|
+
if (refCount > 0) return;
|
|
17
|
+
|
|
18
|
+
LEVELS.forEach((level) => {
|
|
19
|
+
const original = originalMethods[level];
|
|
20
|
+
if (original) {
|
|
21
|
+
console[level] = original;
|
|
22
|
+
delete originalMethods[level];
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function isIntercepted(): boolean {
|
|
28
|
+
return LEVELS.some((level) => originalMethods[level] !== undefined);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function start(emit: (entry: ConsoleLogEntry) => void): () => void {
|
|
32
|
+
refCount += 1;
|
|
33
|
+
if (isIntercepted()) {
|
|
34
|
+
return () => { stop(); };
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
LEVELS.forEach((level) => {
|
|
38
|
+
originalMethods[level] = console[level];
|
|
39
|
+
|
|
40
|
+
console[level] = (...args: unknown[]) => {
|
|
41
|
+
originalMethods[level]?.apply(console, args);
|
|
42
|
+
if (level === 'log' && typeof args[0] === 'string' && args[0].startsWith('[DebugToolkit:Copy]')) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
emit({
|
|
46
|
+
id: '',
|
|
47
|
+
timestamp: Date.now(),
|
|
48
|
+
level,
|
|
49
|
+
data: args,
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
return () => { stop(); };
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
start,
|
|
59
|
+
reset() {
|
|
60
|
+
LEVELS.forEach((level) => {
|
|
61
|
+
const original = originalMethods[level];
|
|
62
|
+
if (original) {
|
|
63
|
+
console[level] = original;
|
|
64
|
+
delete originalMethods[level];
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
refCount = 0;
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
})();
|
|
71
|
+
|
|
72
|
+
// ─── Feature factory ──────────────────────────────────
|
|
73
|
+
|
|
74
|
+
const DEFAULT_MAX_LOGS = 200;
|
|
75
|
+
|
|
76
|
+
export interface ConsoleFeatureConfig {
|
|
77
|
+
/** Maximum number of console logs to keep (default: 200) */
|
|
78
|
+
maxLogs?: number;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export const createConsoleLogFeature = (config?: ConsoleFeatureConfig): DebugFeature<ConsoleLogEntry[]> => {
|
|
82
|
+
const maxLogs = config?.maxLogs ?? DEFAULT_MAX_LOGS;
|
|
83
|
+
const logStore = createPersistedObservableStore<ConsoleLogEntry>({
|
|
84
|
+
storageKey: KEYS.consoleLogs,
|
|
85
|
+
maxPersist: 50,
|
|
86
|
+
});
|
|
87
|
+
let initialized = false;
|
|
88
|
+
let stopCapture: (() => void) | null = null;
|
|
89
|
+
|
|
90
|
+
return {
|
|
91
|
+
name: 'console',
|
|
92
|
+
label: 'Console',
|
|
93
|
+
renderContent: ConsoleLogTab,
|
|
94
|
+
setup: () => {
|
|
95
|
+
if (initialized) return;
|
|
96
|
+
|
|
97
|
+
stopCapture = consoleCapture.start((entry) => {
|
|
98
|
+
logStore.push({ ...entry, id: logStore.nextId() }, maxLogs);
|
|
99
|
+
});
|
|
100
|
+
initialized = true;
|
|
101
|
+
},
|
|
102
|
+
getSnapshot: () => logStore.getData(),
|
|
103
|
+
clear: () => { logStore.clear(); },
|
|
104
|
+
cleanup: () => {
|
|
105
|
+
if (!initialized) return;
|
|
106
|
+
|
|
107
|
+
stopCapture?.();
|
|
108
|
+
stopCapture = null;
|
|
109
|
+
logStore.clear();
|
|
110
|
+
initialized = false;
|
|
111
|
+
},
|
|
112
|
+
subscribe: (listener) => logStore.subscribe(listener),
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
/** Reset module-level state for testing */
|
|
117
|
+
export function _resetConsoleForTesting(): void {
|
|
118
|
+
consoleCapture.reset();
|
|
119
|
+
}
|
|
@@ -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',
|
|
@@ -19,11 +19,11 @@ const DEFAULT_COLORS: Record<string, string> = {
|
|
|
19
19
|
prod: '#FF3B30',
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
export const EnvironmentTab: React.FC<DebugFeatureRenderProps<EnvironmentState>> = ({
|
|
23
|
-
|
|
22
|
+
export const EnvironmentTab: React.FC<DebugFeatureRenderProps<EnvironmentState>> = React.memo(({
|
|
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}>
|
|
@@ -114,7 +114,7 @@ export const EnvironmentTab: React.FC<DebugFeatureRenderProps<EnvironmentState>>
|
|
|
114
114
|
) : null}
|
|
115
115
|
</View>
|
|
116
116
|
);
|
|
117
|
-
};
|
|
117
|
+
});
|
|
118
118
|
|
|
119
119
|
const styles = StyleSheet.create({
|
|
120
120
|
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) => {
|
|
@@ -97,16 +102,16 @@ export const createEnvironmentFeature = (
|
|
|
97
102
|
if (initialized) {
|
|
98
103
|
try {
|
|
99
104
|
if (envId && environments.length > 0) {
|
|
100
|
-
|
|
105
|
+
urlRewriter.set(createUrlRewriter());
|
|
101
106
|
} else {
|
|
102
|
-
|
|
107
|
+
urlRewriter.set(null);
|
|
103
108
|
}
|
|
104
109
|
} catch (err) {
|
|
105
110
|
if (__DEV__) console.warn('[DebugToolkit] Failed to set URL rewriter:', err);
|
|
106
111
|
}
|
|
107
112
|
}
|
|
108
113
|
|
|
109
|
-
|
|
114
|
+
notify();
|
|
110
115
|
};
|
|
111
116
|
|
|
112
117
|
const persistSelection = async (envId: string | null) => {
|
|
@@ -139,39 +144,36 @@ 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
|
|
146
151
|
if (activeEnvironmentId && environments.length > 0) {
|
|
147
|
-
|
|
148
|
-
setUrlRewriter(createUrlRewriter());
|
|
149
|
-
} catch {
|
|
150
|
-
// NetworkFeature may not be available
|
|
151
|
-
}
|
|
152
|
+
urlRewriter.set(createUrlRewriter());
|
|
152
153
|
}
|
|
153
154
|
|
|
154
155
|
// Async persistence load (will override if a preference exists)
|
|
155
156
|
loadPersistedSelection();
|
|
156
157
|
},
|
|
157
|
-
|
|
158
|
+
getSnapshot: getCurrentState,
|
|
158
159
|
clear: () => {
|
|
159
160
|
applyEnvironment(null);
|
|
160
161
|
persistSelection(null);
|
|
161
162
|
},
|
|
162
163
|
cleanup: () => {
|
|
163
164
|
if (!initialized) return;
|
|
164
|
-
|
|
165
|
-
setUrlRewriter(null);
|
|
166
|
-
} catch (err) {
|
|
167
|
-
if (__DEV__) console.warn('[DebugToolkit] Failed to set URL rewriter:', err);
|
|
168
|
-
}
|
|
165
|
+
urlRewriter.set(null);
|
|
169
166
|
activeEnvironmentId = null;
|
|
170
167
|
currentHostsMap = null;
|
|
171
|
-
|
|
168
|
+
notify();
|
|
172
169
|
initialized = false;
|
|
173
170
|
},
|
|
174
|
-
subscribe: (listener) =>
|
|
171
|
+
subscribe: (listener) => {
|
|
172
|
+
listeners.add(listener);
|
|
173
|
+
return () => {
|
|
174
|
+
listeners.delete(listener);
|
|
175
|
+
};
|
|
176
|
+
},
|
|
175
177
|
registerEnvironments: (envs: EnvironmentConfig[]) => {
|
|
176
178
|
environments = envs;
|
|
177
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}>
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
|
|
6
|
+
type NavigationLogPayload = Omit<NavigationLogEntry, 'id'>;
|
|
7
|
+
|
|
8
|
+
let navigationChannel = createEventChannel<NavigationLogPayload>();
|
|
9
|
+
|
|
10
|
+
export const addNavigationLog = (
|
|
11
|
+
action: string,
|
|
12
|
+
from: string,
|
|
13
|
+
to: string,
|
|
14
|
+
startTime?: number,
|
|
15
|
+
duration?: number,
|
|
16
|
+
debugLog?: string,
|
|
17
|
+
): void => {
|
|
18
|
+
navigationChannel.emit({
|
|
19
|
+
timestamp: Date.now(),
|
|
20
|
+
action,
|
|
21
|
+
from,
|
|
22
|
+
to,
|
|
23
|
+
startTime,
|
|
24
|
+
duration,
|
|
25
|
+
debugLog,
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export interface NavigationFeatureConfig {
|
|
30
|
+
/** Maximum number of navigation logs to keep (default: 200) */
|
|
31
|
+
maxLogs?: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const createNavigationLogFeature = (config?: NavigationFeatureConfig): DebugFeature<NavigationLogEntry[]> =>
|
|
35
|
+
createChannelFeature(
|
|
36
|
+
() => navigationChannel,
|
|
37
|
+
(payload, id) => ({ ...payload, id }),
|
|
38
|
+
{ name: 'navigation', label: 'Navigation', renderContent: NavigationLogTab, maxLogs: config?.maxLogs },
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
/** Reset module-level state for testing */
|
|
42
|
+
export function _resetNavigationForTesting(): void {
|
|
43
|
+
navigationChannel = createEventChannel<NavigationLogPayload>();
|
|
44
|
+
}
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import { useEffect, useRef } from 'react';
|
|
2
|
-
import { addNavigationLog } from '
|
|
3
|
-
import { safeStringify } from '
|
|
4
|
-
|
|
5
|
-
interface NavigationContainerRef {
|
|
6
|
-
getCurrentRoute?: () => { name?: string } | undefined;
|
|
7
|
-
getRootState?: () => unknown;
|
|
8
|
-
addListener: (event: string, callback: () => void) => () => void;
|
|
9
|
-
}
|
|
2
|
+
import { addNavigationLog } from './index';
|
|
3
|
+
import { safeStringify } from '../../utils/safeStringify';
|
|
4
|
+
import type { NavigationContainerRef } from '../../types';
|
|
10
5
|
|
|
11
6
|
function getActiveRouteName(state: unknown): string {
|
|
12
7
|
let currentState = state as
|