@rozenite/vite-plugin 1.12.0 → 2.0.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 +12 -0
- package/dist/bundle-dts.d.ts.map +1 -1
- package/dist/client-plugin.d.ts.map +1 -1
- package/dist/dev-config-module.d.ts.map +1 -1
- package/dist/dev-host/assets/index-DU3zXL2c.css +1 -0
- package/dist/dev-host/assets/index-Xsb6uYhI.js +13 -0
- package/dist/dev-host/index.html +3 -3
- package/dist/dev-host/manifest.json +2 -2
- package/dist/index.cjs +24 -8
- package/dist/index.d.ts +9 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -8
- package/dist/react-native-plugin.d.ts.map +1 -1
- package/dist/sdk-plugin.d.ts.map +1 -1
- package/dist/server-plugin.d.ts.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +10 -10
- package/src/bundle-dts.ts +126 -0
- package/src/client-plugin.ts +394 -0
- package/src/dev-config-module.ts +32 -0
- package/src/dev-host/App.tsx +373 -0
- package/src/dev-host/components/DispatchForm.tsx +155 -0
- package/src/dev-host/components/FlowList.tsx +122 -0
- package/src/dev-host/components/MessageDetailsPane.tsx +82 -0
- package/src/dev-host/components/MessageLogPane.tsx +102 -0
- package/src/dev-host/components/PanelTabs.tsx +41 -0
- package/src/dev-host/config.ts +111 -0
- package/src/dev-host/constants.ts +12 -0
- package/src/dev-host/flow-runtime.ts +318 -0
- package/src/dev-host/index.html +12 -0
- package/src/dev-host/main.tsx +22 -0
- package/src/dev-host/server.ts +61 -0
- package/src/dev-host/styles.css +301 -0
- package/src/dev-host/types.ts +56 -0
- package/src/dev-host/utils.ts +99 -0
- package/src/dev-host/vite.config.mts +22 -0
- package/src/index.ts +124 -0
- package/src/load-config.ts +117 -0
- package/src/package-json.ts +16 -0
- package/src/react-native-plugin.ts +52 -0
- package/src/require-plugin.ts +221 -0
- package/src/sdk-plugin.ts +47 -0
- package/src/server-plugin.ts +39 -0
- package/src/utils.ts +31 -0
- package/src/virtual-modules.d.ts +7 -0
- package/dist/dev-host/assets/index-CkxvBMpp.css +0 -1
- package/dist/dev-host/assets/index-cNKHRwej.js +0 -11
package/dist/dev-host/index.html
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
<!
|
|
1
|
+
<!doctype html>
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Rozenite Dev Host</title>
|
|
7
|
-
<script type="module" crossorigin src="./assets/index-
|
|
8
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
7
|
+
<script type="module" crossorigin src="./assets/index-Xsb6uYhI.js"></script>
|
|
8
|
+
<link rel="stylesheet" crossorigin href="./assets/index-DU3zXL2c.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
11
11
|
<div id="root"></div>
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const tailwindcss = require("@tailwindcss/vite");
|
|
3
4
|
const react = require("@vitejs/plugin-react");
|
|
4
5
|
const reactNativeWeb = require("vite-plugin-react-native-web");
|
|
5
6
|
const path = require("node:path");
|
|
@@ -19,6 +20,9 @@ const rozeniteServerPlugin = () => {
|
|
|
19
20
|
config(config) {
|
|
20
21
|
const projectRoot = config.root ?? process$1.cwd();
|
|
21
22
|
config.build ??= {};
|
|
23
|
+
if (process$1.env.ROZENITE_BUILD === "1") {
|
|
24
|
+
config.build.emptyOutDir = false;
|
|
25
|
+
}
|
|
22
26
|
config.build.lib = {
|
|
23
27
|
entry: path.resolve(projectRoot, "metro.ts"),
|
|
24
28
|
formats: ["es", "cjs"],
|
|
@@ -112,10 +116,14 @@ const getBuiltDevHostAssets = (packageDir) => {
|
|
|
112
116
|
if (!fs.existsSync(manifestPath)) {
|
|
113
117
|
return null;
|
|
114
118
|
}
|
|
115
|
-
const manifest = JSON.parse(
|
|
119
|
+
const manifest = JSON.parse(
|
|
120
|
+
fs.readFileSync(manifestPath, "utf8")
|
|
121
|
+
);
|
|
116
122
|
const entry = manifest[DEV_HOST_BUILD_ENTRY_KEY];
|
|
117
123
|
if (!entry?.file) {
|
|
118
|
-
throw new Error(
|
|
124
|
+
throw new Error(
|
|
125
|
+
`Missing ${DEV_HOST_BUILD_ENTRY_KEY} entry in dev host manifest.`
|
|
126
|
+
);
|
|
119
127
|
}
|
|
120
128
|
return {
|
|
121
129
|
script: path.join(devHostDistDir, entry.file),
|
|
@@ -147,11 +155,7 @@ const TEMPLATES_DIR = path.resolve(
|
|
|
147
155
|
"..",
|
|
148
156
|
"templates"
|
|
149
157
|
);
|
|
150
|
-
const PACKAGE_DIR = path.resolve(
|
|
151
|
-
node_url.fileURLToPath(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index.cjs", document.baseURI).href),
|
|
152
|
-
"..",
|
|
153
|
-
".."
|
|
154
|
-
);
|
|
158
|
+
const PACKAGE_DIR = path.resolve(node_url.fileURLToPath(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index.cjs", document.baseURI).href), "..", "..");
|
|
155
159
|
const DEV_HOST_SOURCE_ENTRY_FILE = getDevHostSourceEntryFile(PACKAGE_DIR);
|
|
156
160
|
const PANELS_DIR = "./panels";
|
|
157
161
|
const DEVTOOLS_DIR = "devtools";
|
|
@@ -257,6 +261,9 @@ const rozeniteClientPlugin = () => {
|
|
|
257
261
|
config.server.open = config.server.open === true ? DEV_HOST_ROUTE : config.server.open ?? DEV_HOST_ROUTE;
|
|
258
262
|
config.server.port = 8888;
|
|
259
263
|
config.build ??= {};
|
|
264
|
+
if (process$1.env.ROZENITE_BUILD === "1") {
|
|
265
|
+
config.build.emptyOutDir = false;
|
|
266
|
+
}
|
|
260
267
|
config.build.rollupOptions ??= {};
|
|
261
268
|
config.build.rollupOptions.input = {
|
|
262
269
|
...config.build.rollupOptions.input,
|
|
@@ -431,6 +438,9 @@ const rozeniteReactNativePlugin = () => {
|
|
|
431
438
|
config(config) {
|
|
432
439
|
const projectRoot = config.root ?? process.cwd();
|
|
433
440
|
config.build ??= {};
|
|
441
|
+
if (process.env.ROZENITE_BUILD === "1") {
|
|
442
|
+
config.build.emptyOutDir = false;
|
|
443
|
+
}
|
|
434
444
|
config.build.rollupOptions ??= {};
|
|
435
445
|
config.build.lib = {
|
|
436
446
|
entry: path.resolve(projectRoot, "react-native.ts"),
|
|
@@ -470,6 +480,9 @@ const rozeniteSdkPlugin = () => {
|
|
|
470
480
|
config(config) {
|
|
471
481
|
const projectRoot = config.root ?? process.cwd();
|
|
472
482
|
config.build ??= {};
|
|
483
|
+
if (process.env.ROZENITE_BUILD === "1") {
|
|
484
|
+
config.build.emptyOutDir = false;
|
|
485
|
+
}
|
|
473
486
|
config.build.lib = {
|
|
474
487
|
entry: path.resolve(projectRoot, "sdk.ts"),
|
|
475
488
|
formats: ["es", "cjs"],
|
|
@@ -809,7 +822,9 @@ const getDtsPlugin = (target) => {
|
|
|
809
822
|
}
|
|
810
823
|
});
|
|
811
824
|
};
|
|
812
|
-
const rozenitePlugin = (
|
|
825
|
+
const rozenitePlugin = ({
|
|
826
|
+
tailwind = true
|
|
827
|
+
} = {}) => {
|
|
813
828
|
const isServer = process.env.VITE_ROZENITE_TARGET === "server";
|
|
814
829
|
const isReactNative = process.env.VITE_ROZENITE_TARGET === "react-native";
|
|
815
830
|
const isSdk = process.env.VITE_ROZENITE_TARGET === "sdk";
|
|
@@ -826,6 +841,7 @@ const rozenitePlugin = () => {
|
|
|
826
841
|
return [rozeniteSdkPlugin(), getDtsPlugin("sdk")];
|
|
827
842
|
}
|
|
828
843
|
return [
|
|
844
|
+
...tailwind ? [tailwindcss()] : [],
|
|
829
845
|
react(),
|
|
830
846
|
// @ts-expect-error: TypeScript gets confused by the dual export
|
|
831
847
|
reactNativeWeb(),
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import { PluginOption } from 'vite';
|
|
2
|
-
export
|
|
2
|
+
export type RozenitePluginOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* Configure Tailwind CSS v4 for client panels.
|
|
5
|
+
*
|
|
6
|
+
* @default true
|
|
7
|
+
*/
|
|
8
|
+
tailwind?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare const rozenitePlugin: ({ tailwind, }?: RozenitePluginOptions) => PluginOption[];
|
|
3
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAuFzC,MAAM,MAAM,qBAAqB,GAAG;IAClC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,gBAE5B,qBAA0B,KAAG,YAAY,EAyB3C,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import tailwindcss from "@tailwindcss/vite";
|
|
1
2
|
import react from "@vitejs/plugin-react";
|
|
2
3
|
import reactNativeWeb from "vite-plugin-react-native-web";
|
|
3
4
|
import path from "node:path";
|
|
@@ -16,6 +17,9 @@ const rozeniteServerPlugin = () => {
|
|
|
16
17
|
config(config) {
|
|
17
18
|
const projectRoot = config.root ?? process$1.cwd();
|
|
18
19
|
config.build ??= {};
|
|
20
|
+
if (process$1.env.ROZENITE_BUILD === "1") {
|
|
21
|
+
config.build.emptyOutDir = false;
|
|
22
|
+
}
|
|
19
23
|
config.build.lib = {
|
|
20
24
|
entry: path.resolve(projectRoot, "metro.ts"),
|
|
21
25
|
formats: ["es", "cjs"],
|
|
@@ -109,10 +113,14 @@ const getBuiltDevHostAssets = (packageDir) => {
|
|
|
109
113
|
if (!fs.existsSync(manifestPath)) {
|
|
110
114
|
return null;
|
|
111
115
|
}
|
|
112
|
-
const manifest = JSON.parse(
|
|
116
|
+
const manifest = JSON.parse(
|
|
117
|
+
fs.readFileSync(manifestPath, "utf8")
|
|
118
|
+
);
|
|
113
119
|
const entry = manifest[DEV_HOST_BUILD_ENTRY_KEY];
|
|
114
120
|
if (!entry?.file) {
|
|
115
|
-
throw new Error(
|
|
121
|
+
throw new Error(
|
|
122
|
+
`Missing ${DEV_HOST_BUILD_ENTRY_KEY} entry in dev host manifest.`
|
|
123
|
+
);
|
|
116
124
|
}
|
|
117
125
|
return {
|
|
118
126
|
script: path.join(devHostDistDir, entry.file),
|
|
@@ -144,11 +152,7 @@ const TEMPLATES_DIR = path.resolve(
|
|
|
144
152
|
"..",
|
|
145
153
|
"templates"
|
|
146
154
|
);
|
|
147
|
-
const PACKAGE_DIR = path.resolve(
|
|
148
|
-
fileURLToPath(import.meta.url),
|
|
149
|
-
"..",
|
|
150
|
-
".."
|
|
151
|
-
);
|
|
155
|
+
const PACKAGE_DIR = path.resolve(fileURLToPath(import.meta.url), "..", "..");
|
|
152
156
|
const DEV_HOST_SOURCE_ENTRY_FILE = getDevHostSourceEntryFile(PACKAGE_DIR);
|
|
153
157
|
const PANELS_DIR = "./panels";
|
|
154
158
|
const DEVTOOLS_DIR = "devtools";
|
|
@@ -254,6 +258,9 @@ const rozeniteClientPlugin = () => {
|
|
|
254
258
|
config.server.open = config.server.open === true ? DEV_HOST_ROUTE : config.server.open ?? DEV_HOST_ROUTE;
|
|
255
259
|
config.server.port = 8888;
|
|
256
260
|
config.build ??= {};
|
|
261
|
+
if (process$1.env.ROZENITE_BUILD === "1") {
|
|
262
|
+
config.build.emptyOutDir = false;
|
|
263
|
+
}
|
|
257
264
|
config.build.rollupOptions ??= {};
|
|
258
265
|
config.build.rollupOptions.input = {
|
|
259
266
|
...config.build.rollupOptions.input,
|
|
@@ -428,6 +435,9 @@ const rozeniteReactNativePlugin = () => {
|
|
|
428
435
|
config(config) {
|
|
429
436
|
const projectRoot = config.root ?? process.cwd();
|
|
430
437
|
config.build ??= {};
|
|
438
|
+
if (process.env.ROZENITE_BUILD === "1") {
|
|
439
|
+
config.build.emptyOutDir = false;
|
|
440
|
+
}
|
|
431
441
|
config.build.rollupOptions ??= {};
|
|
432
442
|
config.build.lib = {
|
|
433
443
|
entry: path.resolve(projectRoot, "react-native.ts"),
|
|
@@ -467,6 +477,9 @@ const rozeniteSdkPlugin = () => {
|
|
|
467
477
|
config(config) {
|
|
468
478
|
const projectRoot = config.root ?? process.cwd();
|
|
469
479
|
config.build ??= {};
|
|
480
|
+
if (process.env.ROZENITE_BUILD === "1") {
|
|
481
|
+
config.build.emptyOutDir = false;
|
|
482
|
+
}
|
|
470
483
|
config.build.lib = {
|
|
471
484
|
entry: path.resolve(projectRoot, "sdk.ts"),
|
|
472
485
|
formats: ["es", "cjs"],
|
|
@@ -806,7 +819,9 @@ const getDtsPlugin = (target) => {
|
|
|
806
819
|
}
|
|
807
820
|
});
|
|
808
821
|
};
|
|
809
|
-
const rozenitePlugin = (
|
|
822
|
+
const rozenitePlugin = ({
|
|
823
|
+
tailwind = true
|
|
824
|
+
} = {}) => {
|
|
810
825
|
const isServer = process.env.VITE_ROZENITE_TARGET === "server";
|
|
811
826
|
const isReactNative = process.env.VITE_ROZENITE_TARGET === "react-native";
|
|
812
827
|
const isSdk = process.env.VITE_ROZENITE_TARGET === "sdk";
|
|
@@ -823,6 +838,7 @@ const rozenitePlugin = () => {
|
|
|
823
838
|
return [rozeniteSdkPlugin(), getDtsPlugin("sdk")];
|
|
824
839
|
}
|
|
825
840
|
return [
|
|
841
|
+
...tailwind ? [tailwindcss()] : [],
|
|
826
842
|
react(),
|
|
827
843
|
// @ts-expect-error: TypeScript gets confused by the dual export
|
|
828
844
|
reactNativeWeb(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-native-plugin.d.ts","sourceRoot":"","sources":["../src/react-native-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAG9B,eAAO,MAAM,yBAAyB,QAAO,
|
|
1
|
+
{"version":3,"file":"react-native-plugin.d.ts","sourceRoot":"","sources":["../src/react-native-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAG9B,eAAO,MAAM,yBAAyB,QAAO,MAgD5C,CAAC"}
|
package/dist/sdk-plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-plugin.d.ts","sourceRoot":"","sources":["../src/sdk-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAGnC,eAAO,MAAM,iBAAiB,QAAO,
|
|
1
|
+
{"version":3,"file":"sdk-plugin.d.ts","sourceRoot":"","sources":["../src/sdk-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAGnC,eAAO,MAAM,iBAAiB,QAAO,MA2CpC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-plugin.d.ts","sourceRoot":"","sources":["../src/server-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAInC,eAAO,MAAM,oBAAoB,QAAO,
|
|
1
|
+
{"version":3,"file":"server-plugin.d.ts","sourceRoot":"","sources":["../src/server-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAInC,eAAO,MAAM,oBAAoB,QAAO,MAkCvC,CAAC"}
|