@rozenite/vite-plugin 1.13.0 → 2.1.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 (57) hide show
  1. package/README.md +12 -0
  2. package/dist/bundle-dts.d.ts.map +1 -1
  3. package/dist/client-plugin.d.ts.map +1 -1
  4. package/dist/dev-host/assets/index-BgAxGQdD.js +13 -0
  5. package/dist/dev-host/assets/index-ClIYIppU.css +1 -0
  6. package/dist/dev-host/index.html +3 -3
  7. package/dist/dev-host/manifest.json +2 -2
  8. package/dist/index.cjs +34 -63
  9. package/dist/index.d.ts +9 -1
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +34 -63
  12. package/dist/load-config.d.ts.map +1 -1
  13. package/dist/package-json.d.ts.map +1 -1
  14. package/dist/react-native-plugin.d.ts.map +1 -1
  15. package/dist/require-plugin.d.ts.map +1 -1
  16. package/dist/sdk-plugin.d.ts.map +1 -1
  17. package/dist/server-plugin.d.ts.map +1 -1
  18. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  19. package/dist/utils.d.ts.map +1 -1
  20. package/package.json +29 -30
  21. package/src/bundle-dts.ts +6 -14
  22. package/src/client-plugin.ts +13 -36
  23. package/src/dev-host/App.tsx +184 -414
  24. package/src/dev-host/components/DispatchForm.tsx +97 -121
  25. package/src/dev-host/components/FlowList.tsx +70 -102
  26. package/src/dev-host/components/MessageDetailsPane.tsx +50 -83
  27. package/src/dev-host/components/MessageLogPane.tsx +75 -66
  28. package/src/dev-host/components/PanelTabs.tsx +19 -10
  29. package/src/dev-host/constants.ts +0 -19
  30. package/src/dev-host/flow-runtime.ts +15 -12
  31. package/src/dev-host/index.html +1 -1
  32. package/src/dev-host/main.tsx +1 -10
  33. package/src/dev-host/styles.css +162 -830
  34. package/src/dev-host/types.ts +0 -9
  35. package/src/dev-host/utils.ts +1 -7
  36. package/src/dev-host/vite.config.mts +2 -0
  37. package/src/index.ts +16 -16
  38. package/src/load-config.ts +9 -20
  39. package/src/package-json.ts +1 -3
  40. package/src/react-native-plugin.ts +4 -2
  41. package/src/require-plugin.ts +6 -18
  42. package/src/sdk-plugin.ts +3 -0
  43. package/src/server-plugin.ts +3 -0
  44. package/src/utils.ts +1 -4
  45. package/dist/dev-host/assets/index-CkxvBMpp.css +0 -1
  46. package/dist/dev-host/assets/index-cNKHRwej.js +0 -11
  47. package/src/dev-host/components/MessagePayloadDetail.tsx +0 -32
  48. package/src/dev-host/components/ResizeHandle.tsx +0 -33
  49. package/src/dev-host/components/icons.tsx +0 -79
  50. package/src/dev-host/components/ui/Button.tsx +0 -91
  51. package/src/dev-host/components/ui/DropdownMenu.tsx +0 -84
  52. package/src/dev-host/components/ui/IconButton.tsx +0 -41
  53. package/src/dev-host/components/ui/Input.tsx +0 -73
  54. package/src/dev-host/components/ui/ScrollArea.tsx +0 -20
  55. package/src/dev-host/components/ui/Tabs.tsx +0 -166
  56. package/src/dev-host/components/ui/Textarea.tsx +0 -79
  57. package/src/dev-host/components/ui/ToggleGroup.tsx +0 -120
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,yBAAyB,GACpC,WAAW,MAAM,EACjB,UAAU,MAAM,KACf,MAAM,GAAG,IAYX,CAAC;AAEF,eAAO,MAAM,IAAI,GAAI,CAAC,EAAE,IAAI,MAAM,CAAC,KAAG,CAAC,MAAM,CAAC,CAU7C,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,yBAAyB,GAAI,WAAW,MAAM,EAAE,UAAU,MAAM,KAAG,MAAM,GAAG,IAYxF,CAAC;AAEF,eAAO,MAAM,IAAI,GAAI,CAAC,EAAE,IAAI,MAAM,CAAC,KAAG,CAAC,MAAM,CAAC,CAU7C,CAAC"}
package/package.json CHANGED
@@ -1,35 +1,32 @@
1
1
  {
2
2
  "name": "@rozenite/vite-plugin",
3
- "version": "1.13.0",
3
+ "version": "2.1.0",
4
4
  "description": "Vite plugin for developing React Native DevTools plugins with hot reload and development tools",
5
- "type": "module",
6
- "main": "./dist/index.cjs",
7
- "module": "./dist/index.js",
8
- "types": "./dist/index.d.ts",
9
- "files": [
10
- "dist",
11
- "src",
12
- "templates"
13
- ],
14
5
  "keywords": [
15
- "react-native",
16
6
  "devtools",
17
- "vite",
18
- "plugin"
7
+ "plugin",
8
+ "react-native",
9
+ "vite"
19
10
  ],
20
11
  "homepage": "https://github.com/callstackincubator/rozenite#readme",
21
12
  "bugs": {
22
13
  "url": "https://github.com/callstackincubator/rozenite/issues"
23
14
  },
15
+ "license": "MIT",
16
+ "author": "Szymon Chmal <szymon.chmal@callstack.com>",
24
17
  "repository": {
25
18
  "type": "git",
26
19
  "url": "https://github.com/callstackincubator/rozenite.git"
27
20
  },
28
- "author": "Szymon Chmal <szymon.chmal@callstack.com>",
29
- "license": "MIT",
30
- "publishConfig": {
31
- "access": "public"
32
- },
21
+ "files": [
22
+ "dist",
23
+ "src",
24
+ "templates"
25
+ ],
26
+ "type": "module",
27
+ "main": "./dist/index.cjs",
28
+ "module": "./dist/index.js",
29
+ "types": "./dist/index.d.ts",
33
30
  "exports": {
34
31
  "./package.json": "./package.json",
35
32
  ".": {
@@ -39,29 +36,31 @@
39
36
  "default": "./dist/index.cjs"
40
37
  }
41
38
  },
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
42
42
  "dependencies": {
43
43
  "@microsoft/api-extractor": "^7.50.1",
44
+ "@tailwindcss/vite": "4.2.2",
44
45
  "@vitejs/plugin-react": "^4.3.4",
45
46
  "ejs": "^3.1.9",
47
+ "lucide-react": "^0.263.1",
46
48
  "vite-plugin-dts": "~4.5.0",
47
- "vite-plugin-react-native-web": "^2.1.1"
49
+ "vite-plugin-react-native-web": "^2.1.1",
50
+ "@rozenite/ui": "2.1.0"
51
+ },
52
+ "devDependencies": {
53
+ "@types/ejs": "^3.1.5",
54
+ "@types/react": "~19.2.3",
55
+ "@types/react-dom": "~19.2.3",
56
+ "react": "19.2.3",
57
+ "react-dom": "19.2.3"
48
58
  },
49
59
  "peerDependencies": {
50
60
  "react": "*",
51
61
  "react-dom": "*",
52
62
  "vite": "^7.3.1"
53
63
  },
54
- "devDependencies": {
55
- "@types/ejs": "^3.1.5",
56
- "@types/react": "~19.2.2",
57
- "@types/react-dom": "~19.1.7",
58
- "baseui": "^16.1.1",
59
- "react-json-tree": "^0.20.0",
60
- "react": "19.2.0",
61
- "react-dom": "19.2.0",
62
- "styletron-engine-monolithic": "^1.0.0",
63
- "styletron-react": "^6.1.1"
64
- },
65
64
  "engines": {
66
65
  "node": ">=20"
67
66
  },
package/src/bundle-dts.ts CHANGED
@@ -1,10 +1,6 @@
1
1
  import fs from 'node:fs/promises';
2
2
  import path from 'node:path';
3
- import {
4
- Extractor,
5
- ExtractorConfig,
6
- ExtractorLogLevel,
7
- } from '@microsoft/api-extractor';
3
+ import { Extractor, ExtractorConfig, ExtractorLogLevel } from '@microsoft/api-extractor';
8
4
 
9
5
  type Target = 'react-native' | 'metro' | 'sdk';
10
6
 
@@ -37,19 +33,15 @@ export const normalizeRolledUpDeclarations = (content: string) => {
37
33
  );
38
34
  };
39
35
 
40
- export const bundleTargetDeclarations = async (
41
- projectRoot: string,
42
- target: Target,
43
- ) => {
36
+ export const bundleTargetDeclarations = async (projectRoot: string, target: Target) => {
44
37
  const targetRoot = path.join(projectRoot, 'dist', target);
45
38
  const publicEntryPath = path.join(targetRoot, 'index.d.ts');
46
39
  const bundleEntryPath =
47
40
  target === 'sdk' ? path.join(targetRoot, `${target}.d.ts`) : publicEntryPath;
48
- const entryPath =
49
- (await fs
50
- .access(bundleEntryPath)
51
- .then(() => bundleEntryPath)
52
- .catch(() => publicEntryPath));
41
+ const entryPath = await fs
42
+ .access(bundleEntryPath)
43
+ .then(() => bundleEntryPath)
44
+ .catch(() => publicEntryPath);
53
45
  const tempOutputPath = path.join(targetRoot, 'index.public.d.ts');
54
46
  const srcDeclarationsPath = path.join(targetRoot, 'src');
55
47
  const configObjectFullPath = path.join(projectRoot, 'api-extractor.json');
@@ -43,18 +43,9 @@ type DevHostState = {
43
43
  panels: DevHostPanelEntry[];
44
44
  };
45
45
 
46
- const TEMPLATES_DIR = path.resolve(
47
- fileURLToPath(import.meta.url),
48
- '..',
49
- '..',
50
- 'templates',
51
- );
52
-
53
- const PACKAGE_DIR = path.resolve(
54
- fileURLToPath(import.meta.url),
55
- '..',
56
- '..',
57
- );
46
+ const TEMPLATES_DIR = path.resolve(fileURLToPath(import.meta.url), '..', '..', 'templates');
47
+
48
+ const PACKAGE_DIR = path.resolve(fileURLToPath(import.meta.url), '..', '..');
58
49
 
59
50
  const DEV_HOST_SOURCE_ENTRY_FILE = getDevHostSourceEntryFile(PACKAGE_DIR);
60
51
 
@@ -179,21 +170,19 @@ export const rozeniteClientPlugin = (): Plugin => {
179
170
 
180
171
  config.server ??= {};
181
172
  config.server.open =
182
- config.server.open === true
183
- ? DEV_HOST_ROUTE
184
- : (config.server.open ?? DEV_HOST_ROUTE);
173
+ config.server.open === true ? DEV_HOST_ROUTE : (config.server.open ?? DEV_HOST_ROUTE);
185
174
  // Keep in sync with `DEV_SERVER_URL` in packages/runtime/src/dev-mode.ts
186
175
  config.server.port = 8888;
187
176
 
188
177
  config.build ??= {};
178
+ if (process.env.ROZENITE_BUILD === '1') {
179
+ config.build.emptyOutDir = false;
180
+ }
189
181
  config.build.rollupOptions ??= {};
190
182
  config.build.rollupOptions.input = {
191
183
  ...(config.build.rollupOptions.input as Record<string, string>),
192
184
  ...Object.fromEntries(
193
- panels.map((panel) => [
194
- panel.name,
195
- `${DEVTOOLS_DIR}/${panel.htmlFile}`,
196
- ]),
185
+ panels.map((panel) => [panel.name, `${DEVTOOLS_DIR}/${panel.htmlFile}`]),
197
186
  ),
198
187
  };
199
188
  config.build.rollupOptions.output = {
@@ -211,9 +200,7 @@ export const rozeniteClientPlugin = (): Plugin => {
211
200
  return devConfigModuleId;
212
201
  }
213
202
 
214
- const isPanel = getPanels().some(
215
- (panel) => `${DEVTOOLS_DIR}/${panel.htmlFile}` === id,
216
- );
203
+ const isPanel = getPanels().some((panel) => `${DEVTOOLS_DIR}/${panel.htmlFile}` === id);
217
204
 
218
205
  if (isPanel) {
219
206
  return id;
@@ -229,9 +216,7 @@ export const rozeniteClientPlugin = (): Plugin => {
229
216
  return devConfigModule;
230
217
  }
231
218
 
232
- const panel = getPanels().find(
233
- (panel) => `${DEVTOOLS_DIR}/${panel.htmlFile}` === id,
234
- );
219
+ const panel = getPanels().find((panel) => `${DEVTOOLS_DIR}/${panel.htmlFile}` === id);
235
220
 
236
221
  if (panel) {
237
222
  return generatePanelHtmlContent(panel);
@@ -285,14 +270,8 @@ export const rozeniteClientPlugin = (): Plugin => {
285
270
 
286
271
  server.middlewares.use((req, res, next) => {
287
272
  res.setHeader('Access-Control-Allow-Origin', '*');
288
- res.setHeader(
289
- 'Access-Control-Allow-Methods',
290
- 'GET, POST, PUT, DELETE, OPTIONS',
291
- );
292
- res.setHeader(
293
- 'Access-Control-Allow-Headers',
294
- 'Content-Type, Authorization',
295
- );
273
+ res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
274
+ res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization');
296
275
 
297
276
  if (req.method === 'OPTIONS') {
298
277
  res.statusCode = 200;
@@ -334,9 +313,7 @@ export const rozeniteClientPlugin = (): Plugin => {
334
313
  return;
335
314
  }
336
315
 
337
- const panel = panels.find(
338
- (panel) => `/${DEVTOOLS_DIR}/` + panel.htmlFile === url,
339
- );
316
+ const panel = panels.find((panel) => `/${DEVTOOLS_DIR}/` + panel.htmlFile === url);
340
317
 
341
318
  if (panel) {
342
319
  const htmlContent = generatePanelHtmlContent(panel);