Skip to content

Commit c447f1e

Browse files
authored
feat(storage-plugin): add storage plugin (#184)
## Description This PR introduces a new official plugin: `@rozenite/storage-plugin`. It provides a generic storage inspector experience across multiple storage backends, with adapter-based integration and support for both single-storage and multi-storage setups. User-facing highlights: - Adds a new Storage plugin package with a React Native hook API: - `useRozeniteStoragePlugin({ storages })` - Supports multiple adapters and named storages so users can inspect and manage distinct storage instances in one place. - Includes adapters for: - MMKV (multiple storages, full typed values) - AsyncStorage (v2 and v3-style usage) - Expo SecureStore - Improves editing workflow in the panel: - clicking an entry pre-fills the key field for faster update/delete actions. - Adds Storage plugin documentation page to the website and links it from the official plugins overview. - Adds deprecation guidance to MMKV docs, pointing users to the new generic Storage plugin as the future path. ## Related Issue N/A ## Context The goal is to move from a MMKV-specific experience to a generic storage plugin that can support multiple storage libraries consistently. This phase intentionally keeps `@rozenite/mmkv-plugin` intact while introducing the new plugin and docs migration path. ## Testing - `pnpm --filter @rozenite/storage-plugin typecheck` - `pnpm --filter @rozenite/storage-plugin build` - Manual playground verification for storage plugin flows (including AsyncStorage variants and MMKV/SecureStore adapters)
1 parent 9ceeb53 commit c447f1e

40 files changed

Lines changed: 4183 additions & 97 deletions

.changeset/bright-toes-share.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
"@rozenite/storage-plugin": minor
3+
---
4+
5+
Introduce `@rozenite/storage-plugin` as a generic storage inspector for React Native devtools.
6+
7+
User-facing changes:
8+
- Add `useRozeniteStoragePlugin({ storages })` API for registering one or more adapters.
9+
- Support named storages across adapters so multiple independent stores can be inspected in a single plugin panel.
10+
- Provide built-in adapters for MMKV, AsyncStorage (including v2 and v3-style usage), and Expo SecureStore.
11+
- Improve entry workflows in the panel by prefilling the key when an entry is selected, making update/delete actions faster.
12+
- Add official documentation for the new Storage plugin and guide users from MMKV docs toward the generic plugin path.

apps/playground/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
},
1515
"dependencies": {
1616
"@expo/vector-icons": "^15.0.3",
17+
"@react-native-async-storage/async-storage": "^3.0.1",
1718
"@react-navigation/bottom-tabs": "^7.4.7",
1819
"@react-navigation/elements": "^2.6.3",
1920
"@react-navigation/native": "^7.1.17",
@@ -28,6 +29,7 @@
2829
"@rozenite/react-navigation-plugin": "workspace:*",
2930
"@rozenite/redux-devtools-plugin": "workspace:*",
3031
"@rozenite/require-profiler-plugin": "workspace:*",
32+
"@rozenite/storage-plugin": "workspace:*",
3133
"@rozenite/tanstack-query-plugin": "workspace:*",
3234
"@rozenite/web": "workspace:*",
3335
"@tanstack/react-query": "^5.81.5",
@@ -38,6 +40,7 @@
3840
"expo-image": "~55.0.3",
3941
"expo-linking": "~55.0.4",
4042
"expo-router": "~55.0.0-preview.7",
43+
"expo-secure-store": "^55.0.8",
4144
"expo-splash-screen": "~55.0.5",
4245
"expo-status-bar": "~55.0.2",
4346
"expo-symbols": "~55.0.3",

apps/playground/src/app/App.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { useMMKVDevTools } from '@rozenite/mmkv-plugin';
77
import { useNetworkActivityDevTools } from '@rozenite/network-activity-plugin';
88
import { usePerformanceMonitorDevTools } from '@rozenite/performance-monitor-plugin';
99
import { useReactNavigationDevTools } from '@rozenite/react-navigation-plugin';
10+
import { useRozeniteStoragePlugin } from '@rozenite/storage-plugin';
1011
import { useTanStackQueryDevTools } from '@rozenite/tanstack-query-plugin';
1112
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
1213
import { useRef } from 'react';
@@ -25,6 +26,8 @@ import { PerformanceMonitorScreen } from './screens/PerformanceMonitorScreen';
2526
import { ReduxTestScreen } from './screens/ReduxTestScreen';
2627
import { RequestBodyTestScreen } from './screens/RequestBodyTestScreen';
2728
import { RequireProfilerTestScreen } from './screens/RequireProfilerTestScreen';
29+
import { StoragePluginScreen } from './screens/StoragePluginScreen';
30+
import { storagePluginAdapters } from './storage-plugin-adapters';
2831
import { primaryStore } from './store';
2932
import { useRequireProfilerDevTools } from '@rozenite/require-profiler-plugin';
3033
import { withOnBootNetworkActivityRecording } from '@rozenite/network-activity-plugin';
@@ -47,6 +50,9 @@ const Wrapper = () => {
4750
storages: mmkvStorages,
4851
blacklist: /user-storage:sensitiveToken/,
4952
});
53+
useRozeniteStoragePlugin({
54+
storages: storagePluginAdapters,
55+
});
5056
usePerformanceMonitorDevTools();
5157
useRequireProfilerDevTools();
5258

@@ -60,6 +66,7 @@ const Wrapper = () => {
6066
>
6167
<Stack.Screen name="Landing" component={LandingScreen} />
6268
<Stack.Screen name="MMKVPlugin" component={MMKVPluginScreen} />
69+
<Stack.Screen name="StoragePlugin" component={StoragePluginScreen} />
6370
<Stack.Screen name="NetworkTest" component={NetworkTestScreen} />
6471
<Stack.Screen name="RequestBodyTest" component={RequestBodyTestScreen} />
6572
<Stack.Screen name="ReduxTest" component={ReduxTestScreen} />
@@ -104,6 +111,7 @@ const linking = {
104111
screens: {
105112
Landing: '',
106113
MMKVPlugin: 'mmkv',
114+
StoragePlugin: 'storage',
107115
NetworkTest: 'network',
108116
ReduxTest: 'redux',
109117
PerformanceMonitor: 'performance',

apps/playground/src/app/navigation/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { NativeStackNavigationProp } from '@react-navigation/native-stack';
33
export type RootStackParamList = {
44
Landing: undefined;
55
MMKVPlugin: undefined;
6+
StoragePlugin: undefined;
67
NetworkTest: undefined;
78
RequestBodyTest: undefined;
89
ReduxTest: undefined;

apps/playground/src/app/screens/LandingScreen.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ export const LandingScreen = () => {
3030
<Text style={styles.buttonText}>MMKV Plugin</Text>
3131
</TouchableOpacity>
3232

33+
<TouchableOpacity
34+
style={styles.navigationButton}
35+
onPress={() => navigation.navigate('StoragePlugin' as never)}
36+
>
37+
<Text style={styles.buttonText}>Storage Plugin</Text>
38+
</TouchableOpacity>
39+
3340
<TouchableOpacity
3441
style={styles.navigationButton}
3542
onPress={() => navigation.navigate('NetworkTest' as never)}

0 commit comments

Comments
 (0)