@rozenite/vite-plugin 1.8.0 → 1.9.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/dist/bundle-dts.d.ts +1 -0
- package/dist/bundle-dts.d.ts.map +1 -1
- package/dist/client-plugin.d.ts.map +1 -1
- package/dist/dev-host/App.d.ts +3 -0
- package/dist/dev-host/App.d.ts.map +1 -0
- package/dist/dev-host/components/DispatchForm.d.ts +13 -0
- package/dist/dev-host/components/DispatchForm.d.ts.map +1 -0
- package/dist/dev-host/components/MessageDetailsPane.d.ts +18 -0
- package/dist/dev-host/components/MessageDetailsPane.d.ts.map +1 -0
- package/dist/dev-host/components/MessageLogPane.d.ts +10 -0
- package/dist/dev-host/components/MessageLogPane.d.ts.map +1 -0
- package/dist/dev-host/components/MessagePayloadDetail.d.ts +6 -0
- package/dist/dev-host/components/MessagePayloadDetail.d.ts.map +1 -0
- package/dist/dev-host/components/PanelTabs.d.ts +9 -0
- package/dist/dev-host/components/PanelTabs.d.ts.map +1 -0
- package/dist/dev-host/components/ResizeHandle.d.ts +12 -0
- package/dist/dev-host/components/ResizeHandle.d.ts.map +1 -0
- package/dist/dev-host/components/icons.d.ts +3 -0
- package/dist/dev-host/components/icons.d.ts.map +1 -0
- package/dist/dev-host/components/ui/ScrollArea.d.ts +6 -0
- package/dist/dev-host/components/ui/ScrollArea.d.ts.map +1 -0
- package/dist/dev-host/components/ui/Tabs.d.ts +5 -0
- package/dist/dev-host/components/ui/Tabs.d.ts.map +1 -0
- package/dist/dev-host/constants.d.ts +28 -0
- package/dist/dev-host/constants.d.ts.map +1 -0
- package/dist/dev-host/index.d.ts +1 -0
- package/dist/dev-host/index.d.ts.map +1 -0
- package/dist/dev-host/types.d.ts +29 -0
- package/dist/dev-host/types.d.ts.map +1 -0
- package/dist/dev-host/utils.d.ts +13 -0
- package/dist/dev-host/utils.d.ts.map +1 -0
- package/dist/index.cjs +101 -12
- package/dist/index.js +101 -12
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +14 -3
- package/src/dev-host/App.tsx +403 -0
- package/src/dev-host/components/DispatchForm.tsx +87 -0
- package/src/dev-host/components/MessageDetailsPane.tsx +108 -0
- package/src/dev-host/components/MessageLogPane.tsx +84 -0
- package/src/dev-host/components/MessagePayloadDetail.tsx +32 -0
- package/src/dev-host/components/PanelTabs.tsx +22 -0
- package/src/dev-host/components/ResizeHandle.tsx +33 -0
- package/src/dev-host/components/icons.tsx +27 -0
- package/src/dev-host/components/ui/ScrollArea.tsx +46 -0
- package/src/dev-host/components/ui/Tabs.tsx +33 -0
- package/src/dev-host/constants.ts +29 -0
- package/src/dev-host/dev-host.html +11 -0
- package/src/dev-host/index.tsx +19 -0
- package/src/dev-host/styles.css +631 -0
- package/src/dev-host/types.ts +33 -0
- package/src/dev-host/utils.ts +96 -0
- package/templates/panel.ejs +1 -1
package/dist/bundle-dts.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
type Target = 'react-native' | 'metro' | 'sdk';
|
|
2
|
+
export declare const normalizeRolledUpDeclarations: (content: string) => string;
|
|
2
3
|
export declare const bundleTargetDeclarations: (projectRoot: string, target: Target) => Promise<void>;
|
|
3
4
|
export {};
|
|
4
5
|
//# sourceMappingURL=bundle-dts.d.ts.map
|
package/dist/bundle-dts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle-dts.d.ts","sourceRoot":"","sources":["../src/bundle-dts.ts"],"names":[],"mappings":"AAQA,KAAK,MAAM,GAAG,cAAc,GAAG,OAAO,GAAG,KAAK,CAAC;AAE/C,eAAO,MAAM,wBAAwB,GACnC,aAAa,MAAM,EACnB,QAAQ,MAAM,
|
|
1
|
+
{"version":3,"file":"bundle-dts.d.ts","sourceRoot":"","sources":["../src/bundle-dts.ts"],"names":[],"mappings":"AAQA,KAAK,MAAM,GAAG,cAAc,GAAG,OAAO,GAAG,KAAK,CAAC;AAE/C,eAAO,MAAM,6BAA6B,GAAI,SAAS,MAAM,WA2B5D,CAAC;AAEF,eAAO,MAAM,wBAAwB,GACnC,aAAa,MAAM,EACnB,QAAQ,MAAM,kBAmFf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-plugin.d.ts","sourceRoot":"","sources":["../src/client-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"client-plugin.d.ts","sourceRoot":"","sources":["../src/client-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,MAAM,CAAC;AAuDlD,eAAO,MAAM,oBAAoB,QAAO,MA6QvC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../src/dev-host/App.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAEV,YAAY,EAIb,MAAM,YAAY,CAAC;AAiBpB,eAAO,MAAM,GAAG,GAAI,6CAA6C,YAAY,4CAyW5E,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FormEvent } from 'react';
|
|
2
|
+
type DispatchFormProps = {
|
|
3
|
+
commandType: string;
|
|
4
|
+
commandPayload: string;
|
|
5
|
+
canDispatch: boolean;
|
|
6
|
+
onCommandTypeChange: (value: string) => void;
|
|
7
|
+
onCommandPayloadChange: (value: string) => void;
|
|
8
|
+
onReset: () => void;
|
|
9
|
+
onSubmit: (event: FormEvent<HTMLFormElement>) => void;
|
|
10
|
+
};
|
|
11
|
+
export declare const DispatchForm: ({ commandType, commandPayload, canDispatch, onCommandTypeChange, onCommandPayloadChange, onReset, onSubmit, }: DispatchFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=DispatchForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DispatchForm.d.ts","sourceRoot":"","sources":["../../../src/dev-host/components/DispatchForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,KAAK,iBAAiB,GAAG;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,OAAO,CAAC;IACrB,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,sBAAsB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;CACvD,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,+GAQ1B,iBAAiB,4CAgEnB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PointerEvent as ReactPointerEvent } from 'react';
|
|
2
|
+
import { MessageEntry, ResizeHandleId } from '../types.js';
|
|
3
|
+
type MessageDetailsPaneProps = {
|
|
4
|
+
selectedMessage: MessageEntry | null;
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
isNarrowViewport: boolean;
|
|
7
|
+
activeResizeHandle: ResizeHandleId | null;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
onUseMessage: (message: MessageEntry) => void;
|
|
10
|
+
onResizeStart: (event: ReactPointerEvent<HTMLDivElement>) => void;
|
|
11
|
+
};
|
|
12
|
+
export declare const MessageDetailsPane: ({ selectedMessage, isOpen, isNarrowViewport, activeResizeHandle, onClose, onUseMessage, onResizeStart, }: MessageDetailsPaneProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const getDispatcherValuesFromMessage: (message: MessageEntry) => {
|
|
14
|
+
commandType: string;
|
|
15
|
+
commandPayload: string;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=MessageDetailsPane.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageDetailsPane.d.ts","sourceRoot":"","sources":["../../../src/dev-host/components/MessageDetailsPane.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,IAAI,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAOhE,KAAK,uBAAuB,GAAG;IAC7B,eAAe,EAAE,YAAY,GAAG,IAAI,CAAC;IACrC,MAAM,EAAE,OAAO,CAAC;IAChB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,kBAAkB,EAAE,cAAc,GAAG,IAAI,CAAC;IAC1C,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;IAC9C,aAAa,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;CACnE,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,0GAQhC,uBAAuB,4CA0EzB,CAAC;AAEF,eAAO,MAAM,8BAA8B,GAAI,SAAS,YAAY;;;CAKnE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MessageEntry } from '../types.js';
|
|
2
|
+
type MessageLogPaneProps = {
|
|
3
|
+
messages: MessageEntry[];
|
|
4
|
+
selectedMessageId: string | null;
|
|
5
|
+
onSelectMessage: (messageId: string) => void;
|
|
6
|
+
onClearMessages: () => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const MessageLogPane: ({ messages, selectedMessageId, onSelectMessage, onClearMessages, }: MessageLogPaneProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=MessageLogPane.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageLogPane.d.ts","sourceRoot":"","sources":["../../../src/dev-host/components/MessageLogPane.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAKhD,KAAK,mBAAmB,GAAG;IACzB,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,eAAe,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,eAAe,EAAE,MAAM,IAAI,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,oEAK5B,mBAAmB,4CAkErB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessagePayloadDetail.d.ts","sourceRoot":"","sources":["../../../src/dev-host/components/MessagePayloadDetail.tsx"],"names":[],"mappings":"AAIA,KAAK,yBAAyB,GAAG;IAC/B,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,aAAa,yBAAyB,4CAuB1E,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DevHostPanelEntry } from '../types.js';
|
|
2
|
+
type PanelTabsProps = {
|
|
3
|
+
panels: DevHostPanelEntry[];
|
|
4
|
+
activeSource: string;
|
|
5
|
+
onValueChange: (value: string) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare const PanelTabs: ({ panels, activeSource, onValueChange }: PanelTabsProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=PanelTabs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PanelTabs.d.ts","sourceRoot":"","sources":["../../../src/dev-host/components/PanelTabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGrD,KAAK,cAAc,GAAG;IACpB,MAAM,EAAE,iBAAiB,EAAE,CAAC;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,yCAAyC,cAAc,4CAYhF,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PointerEvent as ReactPointerEvent } from 'react';
|
|
2
|
+
type ResizeHandleProps = {
|
|
3
|
+
className?: string;
|
|
4
|
+
isDragging: boolean;
|
|
5
|
+
isHidden?: boolean;
|
|
6
|
+
orientation: 'horizontal' | 'vertical';
|
|
7
|
+
label: string;
|
|
8
|
+
onPointerDown: (event: ReactPointerEvent<HTMLDivElement>) => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const ResizeHandle: ({ className, isDragging, isHidden, orientation, label, onPointerDown, }: ResizeHandleProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=ResizeHandle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResizeHandle.d.ts","sourceRoot":"","sources":["../../../src/dev-host/components/ResizeHandle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,IAAI,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG/D,KAAK,iBAAiB,GAAG;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,YAAY,GAAG,UAAU,CAAC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;CACnE,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,yEAO1B,iBAAiB,4CAanB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../../src/dev-host/components/icons.tsx"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,+CAYrB,CAAC;AAEF,eAAO,MAAM,QAAQ,+CAYpB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
3
|
+
export declare const ScrollArea: import('react').ForwardRefExoticComponent<Omit<ScrollAreaPrimitive.ScrollAreaProps & import('react').RefAttributes<HTMLDivElement>, "ref"> & {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
} & import('react').RefAttributes<HTMLDivElement>>;
|
|
6
|
+
//# sourceMappingURL=ScrollArea.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScrollArea.d.ts","sourceRoot":"","sources":["../../../../src/dev-host/components/ui/ScrollArea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,mBAAmB,MAAM,6BAA6B,CAAC;AAwBnE,eAAO,MAAM,UAAU;cApBX,SAAS;kDAiCnB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
2
|
+
export declare const Tabs: import('react').ForwardRefExoticComponent<TabsPrimitive.TabsProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
3
|
+
export declare const TabsList: import('react').ForwardRefExoticComponent<Omit<TabsPrimitive.TabsListProps & import('react').RefAttributes<HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
4
|
+
export declare const TabsTrigger: import('react').ForwardRefExoticComponent<Omit<TabsPrimitive.TabsTriggerProps & import('react').RefAttributes<HTMLButtonElement>, "ref"> & import('react').RefAttributes<HTMLButtonElement>>;
|
|
5
|
+
//# sourceMappingURL=Tabs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../../src/dev-host/components/ui/Tabs.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,aAAa,MAAM,sBAAsB,CAAC;AAGtD,eAAO,MAAM,IAAI,oHAAqB,CAAC;AAEvC,eAAO,MAAM,QAAQ,qLAKnB,CAAC;AAIH,eAAO,MAAM,WAAW,8LAWtB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const DEV_HOST_STATE_ELEMENT_ID = "__rozenite-dev-host__";
|
|
2
|
+
export declare const DEFAULT_DEVTOOLS_HEIGHT = 288;
|
|
3
|
+
export declare const MIN_DEVTOOLS_HEIGHT = 180;
|
|
4
|
+
export declare const MIN_IFRAME_HEIGHT = 220;
|
|
5
|
+
export declare const DETAILS_PANEL_WIDTH = 360;
|
|
6
|
+
export declare const MIN_DETAILS_WIDTH = 280;
|
|
7
|
+
export declare const DEFAULT_COMMAND_WIDTH = 320;
|
|
8
|
+
export declare const MIN_COMMAND_WIDTH = 260;
|
|
9
|
+
export declare const SPLITTER_SIZE = 6;
|
|
10
|
+
export declare const jsonTreeTheme: {
|
|
11
|
+
base00: string;
|
|
12
|
+
base01: string;
|
|
13
|
+
base02: string;
|
|
14
|
+
base03: string;
|
|
15
|
+
base04: string;
|
|
16
|
+
base05: string;
|
|
17
|
+
base06: string;
|
|
18
|
+
base07: string;
|
|
19
|
+
base08: string;
|
|
20
|
+
base09: string;
|
|
21
|
+
base0A: string;
|
|
22
|
+
base0B: string;
|
|
23
|
+
base0C: string;
|
|
24
|
+
base0D: string;
|
|
25
|
+
base0E: string;
|
|
26
|
+
base0F: string;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/dev-host/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,yBAAyB,0BAA0B,CAAC;AAEjE,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAC3C,eAAO,MAAM,mBAAmB,MAAM,CAAC;AACvC,eAAO,MAAM,iBAAiB,MAAM,CAAC;AACrC,eAAO,MAAM,mBAAmB,MAAM,CAAC;AACvC,eAAO,MAAM,iBAAiB,MAAM,CAAC;AACrC,eAAO,MAAM,qBAAqB,MAAM,CAAC;AACzC,eAAO,MAAM,iBAAiB,MAAM,CAAC;AACrC,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;CAiBzB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dev-host/index.tsx"],"names":[],"mappings":"AAGA,OAAO,cAAc,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type DevHostPanelEntry = {
|
|
2
|
+
label: string;
|
|
3
|
+
source: string;
|
|
4
|
+
};
|
|
5
|
+
export type DevHostState = {
|
|
6
|
+
packageName: string;
|
|
7
|
+
packageDescription: string;
|
|
8
|
+
panels: DevHostPanelEntry[];
|
|
9
|
+
};
|
|
10
|
+
export type MessageEntry = {
|
|
11
|
+
id: string;
|
|
12
|
+
direction: 'in' | 'out';
|
|
13
|
+
date: string;
|
|
14
|
+
type: string;
|
|
15
|
+
payload: unknown;
|
|
16
|
+
};
|
|
17
|
+
export type PluginMessage = {
|
|
18
|
+
pluginId: string;
|
|
19
|
+
type: string;
|
|
20
|
+
payload: unknown;
|
|
21
|
+
};
|
|
22
|
+
export type ResizeHandleId = 'devtools-height' | 'command-width' | 'details-width';
|
|
23
|
+
export type ResizeSession = {
|
|
24
|
+
handleId: ResizeHandleId;
|
|
25
|
+
pointerId: number;
|
|
26
|
+
element: HTMLElement;
|
|
27
|
+
onMove: (event: PointerEvent) => void;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/dev-host/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,iBAAiB,EAAE,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,IAAI,GAAG,KAAK,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,iBAAiB,GAAG,eAAe,GAAG,eAAe,CAAC;AAEnF,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EAAE,cAAc,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,WAAW,CAAC;IACrB,MAAM,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;CACvC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DevHostPanelEntry, DevHostState, MessageEntry, PluginMessage } from './types.js';
|
|
2
|
+
export declare const cn: (...parts: Array<string | false | null | undefined>) => string;
|
|
3
|
+
export declare const formatPayloadPreview: (payload: unknown) => string;
|
|
4
|
+
export declare const isJsonTreeData: (value: unknown) => value is Record<string, unknown> | unknown[];
|
|
5
|
+
export declare const formatMessageDate: (date: string) => string;
|
|
6
|
+
export declare const formatMessageTableDate: (date: string) => string;
|
|
7
|
+
export declare const formatPayloadForCommandInput: (payload: unknown) => string;
|
|
8
|
+
export declare const isPluginMessage: (value: unknown) => value is PluginMessage;
|
|
9
|
+
export declare const getInitialPanel: (panels: DevHostPanelEntry[]) => DevHostPanelEntry;
|
|
10
|
+
export declare const createMessageEntry: (input: Omit<MessageEntry, "id" | "date">) => MessageEntry;
|
|
11
|
+
export declare const clamp: (value: number, min: number, max: number) => number;
|
|
12
|
+
export declare const readDevHostState: () => DevHostState;
|
|
13
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/dev-host/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE/F,eAAO,MAAM,EAAE,GAAI,GAAG,OAAO,KAAK,CAAC,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,SAAS,CAAC,WAEpE,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,SAAS,OAAO,WAcpD,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,EAEzF,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,WAE7C,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,MAAM,MAAM,WASlD,CAAC;AAEF,eAAO,MAAM,4BAA4B,GAAI,SAAS,OAAO,WAM5D,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,aAQzD,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,QAAQ,iBAAiB,EAAE,sBAW1D,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,OAAO,IAAI,CAAC,YAAY,EAAE,IAAI,GAAG,MAAM,CAAC,KACvC,YAMF,CAAC;AAEF,eAAO,MAAM,KAAK,GAAI,OAAO,MAAM,EAAE,KAAK,MAAM,EAAE,KAAK,MAAM,WAE5D,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAO,YAQnC,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -87,14 +87,24 @@ const getPackageJSON = async (projectRoot) => {
|
|
|
87
87
|
const packageJSON = await fs$1.readFile(packageJSONPath, "utf8");
|
|
88
88
|
return JSON.parse(packageJSON);
|
|
89
89
|
};
|
|
90
|
+
const DEV_HOST_STATE_ELEMENT_ID = "__rozenite-dev-host__";
|
|
90
91
|
const TEMPLATES_DIR = path.resolve(
|
|
91
92
|
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),
|
|
92
93
|
"..",
|
|
93
94
|
"..",
|
|
94
95
|
"templates"
|
|
95
96
|
);
|
|
97
|
+
const PACKAGE_DIR = path.resolve(
|
|
98
|
+
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),
|
|
99
|
+
"..",
|
|
100
|
+
".."
|
|
101
|
+
);
|
|
102
|
+
const DEV_HOST_DIR = path.join(PACKAGE_DIR, "src", "dev-host");
|
|
103
|
+
const DEV_HOST_HTML_TEMPLATE = path.join(DEV_HOST_DIR, "dev-host.html");
|
|
104
|
+
const DEV_HOST_ENTRY_FILE = path.join(DEV_HOST_DIR, "index.tsx");
|
|
96
105
|
const PANELS_DIR = "./panels";
|
|
97
106
|
const DEVTOOLS_DIR = "devtools";
|
|
107
|
+
const DEV_HOST_ROUTE = "/";
|
|
98
108
|
const rozeniteClientPlugin = () => {
|
|
99
109
|
let projectRoot = process$1.cwd();
|
|
100
110
|
let viteServer = null;
|
|
@@ -117,6 +127,18 @@ const rozeniteClientPlugin = () => {
|
|
|
117
127
|
});
|
|
118
128
|
};
|
|
119
129
|
const PANEL_TEMPLATE = path.join(TEMPLATES_DIR, "panel.ejs");
|
|
130
|
+
const getManifestPanels = () => {
|
|
131
|
+
return getPanels().map((panel) => ({
|
|
132
|
+
name: panel.label,
|
|
133
|
+
source: `/${DEVTOOLS_DIR}/` + panel.htmlFile
|
|
134
|
+
}));
|
|
135
|
+
};
|
|
136
|
+
const getDevHostPanels = () => {
|
|
137
|
+
return getPanels().map((panel) => ({
|
|
138
|
+
label: panel.label,
|
|
139
|
+
source: `/${DEVTOOLS_DIR}/` + panel.htmlFile
|
|
140
|
+
}));
|
|
141
|
+
};
|
|
120
142
|
const generatePanelHtmlContent = (panel) => {
|
|
121
143
|
const template = fs.readFileSync(PANEL_TEMPLATE, "utf-8");
|
|
122
144
|
const relativePath = path.relative(projectRoot, panel.sourceFile);
|
|
@@ -125,6 +147,17 @@ const rozeniteClientPlugin = () => {
|
|
|
125
147
|
panelFile: relativePath
|
|
126
148
|
});
|
|
127
149
|
};
|
|
150
|
+
const getDevHostState = async () => {
|
|
151
|
+
const packageJSON = await getPackageJSON(projectRoot);
|
|
152
|
+
return {
|
|
153
|
+
packageName: packageJSON.name,
|
|
154
|
+
packageDescription: packageJSON.description,
|
|
155
|
+
panels: getDevHostPanels()
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
const serializeDevHostState = (state) => {
|
|
159
|
+
return JSON.stringify(state).replace(/</g, "\\u003c");
|
|
160
|
+
};
|
|
128
161
|
return {
|
|
129
162
|
name: "rozenite-client-plugin",
|
|
130
163
|
async config(config) {
|
|
@@ -136,7 +169,7 @@ const rozeniteClientPlugin = () => {
|
|
|
136
169
|
);
|
|
137
170
|
const panels = getPanels();
|
|
138
171
|
config.server ??= {};
|
|
139
|
-
config.server.open =
|
|
172
|
+
config.server.open = config.server.open === true ? DEV_HOST_ROUTE : config.server.open ?? DEV_HOST_ROUTE;
|
|
140
173
|
config.server.port = 8888;
|
|
141
174
|
config.build ??= {};
|
|
142
175
|
config.build.rollupOptions ??= {};
|
|
@@ -174,6 +207,32 @@ const rozeniteClientPlugin = () => {
|
|
|
174
207
|
}
|
|
175
208
|
return null;
|
|
176
209
|
},
|
|
210
|
+
async transformIndexHtml(_html, context) {
|
|
211
|
+
const pathname = context?.path ?? DEV_HOST_ROUTE;
|
|
212
|
+
if (pathname !== DEV_HOST_ROUTE) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
const state = await getDevHostState();
|
|
216
|
+
return [
|
|
217
|
+
{
|
|
218
|
+
tag: "script",
|
|
219
|
+
attrs: {
|
|
220
|
+
id: DEV_HOST_STATE_ELEMENT_ID,
|
|
221
|
+
type: "application/json"
|
|
222
|
+
},
|
|
223
|
+
children: serializeDevHostState(state),
|
|
224
|
+
injectTo: "body"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
tag: "script",
|
|
228
|
+
attrs: {
|
|
229
|
+
type: "module",
|
|
230
|
+
src: `/@fs${vite.normalizePath(DEV_HOST_ENTRY_FILE)}`
|
|
231
|
+
},
|
|
232
|
+
injectTo: "body"
|
|
233
|
+
}
|
|
234
|
+
];
|
|
235
|
+
},
|
|
177
236
|
async configureServer(server) {
|
|
178
237
|
viteServer = server;
|
|
179
238
|
const packageJSON = await getPackageJSON(projectRoot);
|
|
@@ -193,7 +252,17 @@ const rozeniteClientPlugin = () => {
|
|
|
193
252
|
return;
|
|
194
253
|
}
|
|
195
254
|
const panels = getPanels();
|
|
196
|
-
const
|
|
255
|
+
const requestUrl = req.url || "/";
|
|
256
|
+
const url = new URL(requestUrl, "http://localhost").pathname;
|
|
257
|
+
if (url === DEV_HOST_ROUTE) {
|
|
258
|
+
fs.promises.readFile(DEV_HOST_HTML_TEMPLATE, "utf-8").then((htmlContent) => server.transformIndexHtml(requestUrl, htmlContent)).then((html) => {
|
|
259
|
+
res.setHeader("Content-Type", "text/html");
|
|
260
|
+
res.end(html);
|
|
261
|
+
}).catch((err) => {
|
|
262
|
+
next(err);
|
|
263
|
+
});
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
197
266
|
if (url === "/rozenite.json") {
|
|
198
267
|
res.setHeader("Content-Type", "application/json");
|
|
199
268
|
res.end(
|
|
@@ -202,10 +271,7 @@ const rozeniteClientPlugin = () => {
|
|
|
202
271
|
name: packageJSON.name,
|
|
203
272
|
version: packageJSON.version,
|
|
204
273
|
description: packageJSON.description,
|
|
205
|
-
panels:
|
|
206
|
-
name: panel2.label,
|
|
207
|
-
source: `/${DEVTOOLS_DIR}/` + panel2.htmlFile
|
|
208
|
-
}))
|
|
274
|
+
panels: getManifestPanels()
|
|
209
275
|
},
|
|
210
276
|
null,
|
|
211
277
|
2
|
|
@@ -218,7 +284,7 @@ const rozeniteClientPlugin = () => {
|
|
|
218
284
|
);
|
|
219
285
|
if (panel) {
|
|
220
286
|
const htmlContent = generatePanelHtmlContent(panel);
|
|
221
|
-
server.transformIndexHtml(
|
|
287
|
+
server.transformIndexHtml(requestUrl, htmlContent).then((html) => {
|
|
222
288
|
res.setHeader("Content-Type", "text/html");
|
|
223
289
|
res.end(html);
|
|
224
290
|
}).catch((err) => {
|
|
@@ -243,7 +309,6 @@ const rozeniteClientPlugin = () => {
|
|
|
243
309
|
});
|
|
244
310
|
},
|
|
245
311
|
async generateBundle() {
|
|
246
|
-
const panels = getPanels();
|
|
247
312
|
const packageJSON = await getPackageJSON(projectRoot);
|
|
248
313
|
this.emitFile({
|
|
249
314
|
type: "asset",
|
|
@@ -252,10 +317,7 @@ const rozeniteClientPlugin = () => {
|
|
|
252
317
|
name: packageJSON.name,
|
|
253
318
|
version: packageJSON.version,
|
|
254
319
|
description: packageJSON.description,
|
|
255
|
-
panels:
|
|
256
|
-
name: panel.label,
|
|
257
|
-
source: `/${DEVTOOLS_DIR}/` + panel.htmlFile
|
|
258
|
-
}))
|
|
320
|
+
panels: getManifestPanels()
|
|
259
321
|
})
|
|
260
322
|
});
|
|
261
323
|
}
|
|
@@ -499,6 +561,28 @@ function requirePlugin() {
|
|
|
499
561
|
}
|
|
500
562
|
};
|
|
501
563
|
}
|
|
564
|
+
const normalizeRolledUpDeclarations = (content) => {
|
|
565
|
+
const valueDeclarationNames = /* @__PURE__ */ new Set();
|
|
566
|
+
content.replace(
|
|
567
|
+
/^\s*declare\s+(?:const|let|var|function)\s+([A-Za-z_$][\w$]*)\b/gm,
|
|
568
|
+
(_, name) => {
|
|
569
|
+
valueDeclarationNames.add(name);
|
|
570
|
+
return _;
|
|
571
|
+
}
|
|
572
|
+
);
|
|
573
|
+
const normalizeTypeReference = (name) => valueDeclarationNames.has(name) ? `typeof ${name}` : name;
|
|
574
|
+
return content.replace(
|
|
575
|
+
/^(\s*(?:export\s+)?declare\s+(?:const|let|var)\s+[A-Za-z_$][\w$]*\s*:\s*)([A-Za-z_$][\w$]*)(\s*;)$/gm,
|
|
576
|
+
(_, prefix, name, suffix) => {
|
|
577
|
+
return `${prefix}${normalizeTypeReference(name)}${suffix}`;
|
|
578
|
+
}
|
|
579
|
+
).replace(
|
|
580
|
+
/^(\s*(?:export\s+)?declare\s+type\s+[A-Za-z_$][\w$]*\s*=\s*)([A-Za-z_$][\w$]*)(\s*;)$/gm,
|
|
581
|
+
(_, prefix, name, suffix) => {
|
|
582
|
+
return `${prefix}${normalizeTypeReference(name)}${suffix}`;
|
|
583
|
+
}
|
|
584
|
+
);
|
|
585
|
+
};
|
|
502
586
|
const bundleTargetDeclarations = async (projectRoot, target) => {
|
|
503
587
|
const targetRoot = path.join(projectRoot, "dist", target);
|
|
504
588
|
const publicEntryPath = path.join(targetRoot, "index.d.ts");
|
|
@@ -564,6 +648,11 @@ const bundleTargetDeclarations = async (projectRoot, target) => {
|
|
|
564
648
|
}
|
|
565
649
|
await fs$1.rm(entryPath, { force: true });
|
|
566
650
|
await fs$1.rename(tempOutputPath, publicEntryPath);
|
|
651
|
+
const bundledContent = await fs$1.readFile(publicEntryPath, "utf8");
|
|
652
|
+
const normalizedContent = normalizeRolledUpDeclarations(bundledContent);
|
|
653
|
+
if (normalizedContent !== bundledContent) {
|
|
654
|
+
await fs$1.writeFile(publicEntryPath, normalizedContent);
|
|
655
|
+
}
|
|
567
656
|
await fs$1.rm(srcDeclarationsPath, { recursive: true, force: true });
|
|
568
657
|
};
|
|
569
658
|
const dtsPlugin = "default" in maybeDtsPlugin ? maybeDtsPlugin.default : maybeDtsPlugin;
|