@rozenite/storage-plugin 2.2.0 → 2.3.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.
Files changed (90) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/devtools/assets/panel-CcThj-0Z.js +32 -0
  3. package/dist/devtools/assets/panel-DTYbHqnH.css +1 -0
  4. package/dist/devtools/panel.html +2 -2
  5. package/dist/react-native/cjs/package.json +3 -0
  6. package/dist/react-native/cjs/react-native.js +38 -0
  7. package/dist/react-native/cjs/src/react-native/adapters/async-storage.js +60 -0
  8. package/dist/react-native/cjs/src/react-native/adapters/index.js +10 -0
  9. package/dist/react-native/cjs/src/react-native/adapters/mmkv.js +143 -0
  10. package/dist/react-native/cjs/src/react-native/adapters/secure-storage.js +51 -0
  11. package/dist/react-native/cjs/src/react-native/entry-preview-pagination.js +198 -0
  12. package/dist/react-native/cjs/src/react-native/export-snapshot.js +70 -0
  13. package/dist/react-native/cjs/src/react-native/full-entry-request.js +72 -0
  14. package/dist/react-native/cjs/src/react-native/import.js +185 -0
  15. package/dist/react-native/cjs/src/react-native/storage-discovery.js +69 -0
  16. package/dist/react-native/cjs/src/react-native/storage-view.js +128 -0
  17. package/dist/react-native/cjs/src/react-native/useRozeniteStoragePlugin.js +145 -0
  18. package/dist/react-native/cjs/src/react-native/useStorageAgentTools.js +228 -0
  19. package/dist/react-native/cjs/src/shared/agent-tools.js +119 -0
  20. package/dist/react-native/cjs/src/shared/entry-preview.js +48 -0
  21. package/dist/react-native/cjs/src/shared/messaging.js +2 -0
  22. package/dist/react-native/cjs/src/shared/snapshot.js +185 -0
  23. package/dist/react-native/cjs/src/shared/types.js +13 -0
  24. package/dist/react-native/package.json +3 -0
  25. package/dist/react-native/react-native.d.ts +7 -0
  26. package/dist/react-native/react-native.js +40 -0
  27. package/dist/react-native/src/react-native/adapters/async-storage.d.ts +34 -0
  28. package/dist/react-native/src/react-native/adapters/async-storage.js +56 -0
  29. package/dist/react-native/src/react-native/adapters/index.d.ts +6 -0
  30. package/dist/react-native/src/react-native/adapters/index.js +3 -0
  31. package/dist/react-native/src/react-native/adapters/mmkv.d.ts +13 -0
  32. package/dist/react-native/src/react-native/adapters/mmkv.js +139 -0
  33. package/dist/react-native/src/react-native/adapters/secure-storage.d.ts +18 -0
  34. package/dist/react-native/src/react-native/adapters/secure-storage.js +47 -0
  35. package/dist/react-native/src/react-native/entry-preview-pagination.d.ts +7 -0
  36. package/dist/react-native/src/react-native/entry-preview-pagination.js +194 -0
  37. package/dist/react-native/src/react-native/export-snapshot.d.ts +5 -0
  38. package/dist/react-native/src/react-native/export-snapshot.js +66 -0
  39. package/dist/react-native/src/react-native/full-entry-request.d.ts +5 -0
  40. package/dist/react-native/src/react-native/full-entry-request.js +68 -0
  41. package/dist/react-native/src/react-native/import.d.ts +7 -0
  42. package/dist/react-native/src/react-native/import.js +180 -0
  43. package/dist/react-native/src/react-native/storage-discovery.d.ts +5 -0
  44. package/dist/react-native/src/react-native/storage-discovery.js +65 -0
  45. package/dist/react-native/src/react-native/storage-view.d.ts +19 -0
  46. package/dist/react-native/src/react-native/storage-view.js +123 -0
  47. package/dist/react-native/src/react-native/useRozeniteStoragePlugin.d.ts +6 -0
  48. package/dist/react-native/src/react-native/useRozeniteStoragePlugin.js +141 -0
  49. package/dist/react-native/src/react-native/useStorageAgentTools.d.ts +37 -0
  50. package/dist/react-native/src/react-native/useStorageAgentTools.js +223 -0
  51. package/dist/react-native/src/shared/agent-tools.d.ts +76 -0
  52. package/dist/react-native/src/shared/agent-tools.js +116 -0
  53. package/dist/react-native/src/shared/entry-preview.d.ts +4 -0
  54. package/dist/react-native/src/shared/entry-preview.js +44 -0
  55. package/dist/react-native/src/shared/messaging.d.ts +134 -0
  56. package/dist/react-native/src/shared/messaging.js +1 -0
  57. package/dist/react-native/src/shared/snapshot.d.ts +53 -0
  58. package/dist/react-native/src/shared/snapshot.js +179 -0
  59. package/dist/react-native/src/shared/types.d.ts +78 -0
  60. package/dist/react-native/src/shared/types.js +8 -0
  61. package/dist/rozenite.json +1 -1
  62. package/dist/sdk/package.json +3 -0
  63. package/dist/sdk/sdk.d.ts +44 -0
  64. package/dist/sdk/sdk.js +9 -0
  65. package/dist/sdk/src/shared/agent-tools.d.ts +76 -0
  66. package/dist/sdk/src/shared/agent-tools.js +119 -0
  67. package/dist/sdk/src/shared/types.d.ts +78 -0
  68. package/dist/sdk/src/shared/types.js +13 -0
  69. package/package.json +16 -16
  70. package/react-native.ts +8 -1
  71. package/rozenite.config.ts +1 -0
  72. package/src/__tests__/release-bundle.test.ts +32 -0
  73. package/dist/devtools/assets/panel-D5z1BY8U.js +0 -32
  74. package/dist/devtools/assets/panel-DVlWRg6d.css +0 -1
  75. package/dist/react-native/chunks/async-storage.require.cjs +0 -1
  76. package/dist/react-native/chunks/async-storage.require.js +0 -53
  77. package/dist/react-native/chunks/index.require.cjs +0 -1
  78. package/dist/react-native/chunks/index.require.js +0 -103
  79. package/dist/react-native/chunks/secure-storage.require.cjs +0 -1
  80. package/dist/react-native/chunks/secure-storage.require.js +0 -46
  81. package/dist/react-native/chunks/types.cjs +0 -1
  82. package/dist/react-native/chunks/types.js +0 -11
  83. package/dist/react-native/chunks/useRozeniteStoragePlugin.require.cjs +0 -1
  84. package/dist/react-native/chunks/useRozeniteStoragePlugin.require.js +0 -1037
  85. package/dist/react-native/index.cjs +0 -1
  86. package/dist/react-native/index.d.ts +0 -365
  87. package/dist/react-native/index.js +0 -28
  88. package/dist/sdk/index.cjs +0 -1
  89. package/dist/sdk/index.d.ts +0 -206
  90. package/dist/sdk/index.js +0 -122
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rozenite/storage-plugin",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "Generic Storage Inspector for Rozenite.",
5
5
  "homepage": "https://github.com/callstackincubator/rozenite#readme",
6
6
  "bugs": {
@@ -12,20 +12,19 @@
12
12
  "url": "https://github.com/callstackincubator/rozenite.git"
13
13
  },
14
14
  "type": "module",
15
- "main": "./dist/react-native/index.cjs",
16
- "module": "./dist/react-native/index.js",
17
- "types": "./dist/react-native/index.d.ts",
15
+ "main": "./dist/react-native/cjs/react-native.js",
16
+ "module": "./dist/react-native/react-native.js",
17
+ "types": "./dist/react-native/react-native.d.ts",
18
18
  "exports": {
19
19
  ".": {
20
- "types": "./dist/react-native/index.d.ts",
21
- "import": "./dist/react-native/index.js",
22
- "require": "./dist/react-native/index.cjs"
20
+ "types": "./dist/react-native/react-native.d.ts",
21
+ "import": "./dist/react-native/react-native.js",
22
+ "require": "./dist/react-native/cjs/react-native.js"
23
23
  },
24
24
  "./sdk": {
25
25
  "development": "./sdk.ts",
26
- "types": "./dist/sdk/index.d.ts",
27
- "import": "./dist/sdk/index.js",
28
- "require": "./dist/sdk/index.cjs"
26
+ "types": "./dist/sdk/sdk.d.ts",
27
+ "default": "./dist/sdk/sdk.js"
29
28
  },
30
29
  "./package.json": "./package.json"
31
30
  },
@@ -33,10 +32,10 @@
33
32
  "access": "public"
34
33
  },
35
34
  "dependencies": {
36
- "@rozenite/agent-bridge": "2.2.0",
37
- "@rozenite/agent-shared": "2.2.0",
38
- "@rozenite/plugin-bridge": "2.2.0",
39
- "@rozenite/ui": "2.2.0"
35
+ "@rozenite/agent-shared": "2.3.0",
36
+ "@rozenite/plugin-bridge": "2.3.0",
37
+ "@rozenite/ui": "2.3.0",
38
+ "@rozenite/agent-bridge": "2.3.0"
40
39
  },
41
40
  "devDependencies": {
42
41
  "@codemirror/commands": "^6.10.3",
@@ -57,8 +56,9 @@
57
56
  "react-virtuoso": "^4.14.1",
58
57
  "typescript": "~5.9.3",
59
58
  "vite": "^7.3.1",
60
- "@rozenite/vite-plugin": "2.2.0",
61
- "rozenite": "2.2.0"
59
+ "@rozenite/test-utils": "2.3.0",
60
+ "@rozenite/vite-plugin": "2.3.0",
61
+ "rozenite": "2.3.0"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "@react-native-async-storage/async-storage": "*",
package/react-native.ts CHANGED
@@ -26,8 +26,15 @@ export let createMMKVStorageAdapter: typeof import('./src/react-native/adapters'
26
26
  export let useRozeniteStoragePlugin: typeof import('./src/react-native/useRozeniteStoragePlugin').useRozeniteStoragePlugin;
27
27
 
28
28
  const isWeb = typeof window !== 'undefined' && window.navigator.product !== 'ReactNative';
29
+ // Neither Lynx runtime has a `window`, so `typeof window` alone reported
30
+ // every Lynx app as a server and installed the no-op stub below. `lynx` is
31
+ // a free binding in module scope, not a property of `globalThis`. Kept
32
+ // inline rather than imported so this stays a foldable expression and the
33
+ // `require`s below can still be dropped from production bundles.
34
+ declare const lynx: unknown;
35
+
29
36
  const isDev = process.env.NODE_ENV !== 'production';
30
- const isServer = typeof window === 'undefined';
37
+ const isServer = typeof window === 'undefined' && typeof lynx === 'undefined';
31
38
 
32
39
  const createNoopStorageAdapter = (
33
40
  options: { adapterId?: string; adapterName?: string } | undefined,
@@ -51,6 +51,7 @@ const storageFixtures = [
51
51
  ];
52
52
 
53
53
  export default {
54
+ integrations: ['react-native'],
54
55
  panels: [
55
56
  {
56
57
  name: 'Storage',
@@ -0,0 +1,32 @@
1
+ import path from 'node:path';
2
+ import { fileURLToPath } from 'node:url';
3
+ import { bundleForRelease, RELEASE_BUNDLE_TIMEOUT } from '@rozenite/test-utils';
4
+ import { describe, expect, it } from 'vitest';
5
+
6
+ // An app importing this plugin ships its React Native code -- that much is
7
+ // the app's own choice. What must never follow it into the bundle is the
8
+ // panel: the DevTools UI, its React DOM tree and `@rozenite/ui`.
9
+ // See docs/agents/release-bundle-testing.md.
10
+ const packageRoot = path.resolve(fileURLToPath(import.meta.url), '../../..');
11
+ const reactNativeEntry = path.join(packageRoot, 'dist/react-native/cjs/react-native.js');
12
+
13
+ describe('@rozenite/storage-plugin in a release bundle', () => {
14
+ it(
15
+ 'ships no panel code when an app imports it',
16
+ async () => {
17
+ const result = await bundleForRelease({
18
+ resolveFrom: packageRoot,
19
+ files: {
20
+ 'index.js': `require(${JSON.stringify(reactNativeEntry)});\n`,
21
+ },
22
+ });
23
+
24
+ // Keeps the check below honest: the entry really did get bundled.
25
+ expect(result.rozeniteModules).toContain(
26
+ 'packages/storage-plugin/dist/react-native/cjs/react-native.js',
27
+ );
28
+ expect(result.panelModules).toEqual([]);
29
+ },
30
+ RELEASE_BUNDLE_TIMEOUT,
31
+ );
32
+ });