@rozenite/vite-plugin 1.9.0 → 1.10.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/client-plugin.d.ts.map +1 -1
- package/dist/dev-config-module.d.ts +6 -0
- package/dist/dev-config-module.d.ts.map +1 -0
- package/dist/dev-host/assets/index-PNYu6V-J.css +1 -0
- package/dist/dev-host/assets/index-kRQeUY6W.js +11 -0
- package/{src/dev-host/dev-host.html → dist/dev-host/index.html} +2 -0
- package/dist/dev-host/manifest.json +11 -0
- package/dist/index.cjs +112 -10
- package/dist/index.js +112 -10
- package/dist/load-config.d.ts +39 -0
- package/dist/load-config.d.ts.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/dist/dev-host/App.d.ts +0 -3
- package/dist/dev-host/App.d.ts.map +0 -1
- package/dist/dev-host/components/DispatchForm.d.ts +0 -13
- package/dist/dev-host/components/DispatchForm.d.ts.map +0 -1
- package/dist/dev-host/components/MessageDetailsPane.d.ts +0 -18
- package/dist/dev-host/components/MessageDetailsPane.d.ts.map +0 -1
- package/dist/dev-host/components/MessageLogPane.d.ts +0 -10
- package/dist/dev-host/components/MessageLogPane.d.ts.map +0 -1
- package/dist/dev-host/components/MessagePayloadDetail.d.ts +0 -6
- package/dist/dev-host/components/MessagePayloadDetail.d.ts.map +0 -1
- package/dist/dev-host/components/PanelTabs.d.ts +0 -9
- package/dist/dev-host/components/PanelTabs.d.ts.map +0 -1
- package/dist/dev-host/components/ResizeHandle.d.ts +0 -12
- package/dist/dev-host/components/ResizeHandle.d.ts.map +0 -1
- package/dist/dev-host/components/icons.d.ts +0 -3
- package/dist/dev-host/components/icons.d.ts.map +0 -1
- package/dist/dev-host/components/ui/ScrollArea.d.ts +0 -6
- package/dist/dev-host/components/ui/ScrollArea.d.ts.map +0 -1
- package/dist/dev-host/components/ui/Tabs.d.ts +0 -5
- package/dist/dev-host/components/ui/Tabs.d.ts.map +0 -1
- package/dist/dev-host/constants.d.ts +0 -28
- package/dist/dev-host/constants.d.ts.map +0 -1
- package/dist/dev-host/index.d.ts +0 -1
- package/dist/dev-host/index.d.ts.map +0 -1
- package/dist/dev-host/types.d.ts +0 -29
- package/dist/dev-host/types.d.ts.map +0 -1
- package/dist/dev-host/utils.d.ts +0 -13
- package/dist/dev-host/utils.d.ts.map +0 -1
- package/src/dev-host/App.tsx +0 -403
- package/src/dev-host/components/DispatchForm.tsx +0 -87
- package/src/dev-host/components/MessageDetailsPane.tsx +0 -108
- package/src/dev-host/components/MessageLogPane.tsx +0 -84
- package/src/dev-host/components/MessagePayloadDetail.tsx +0 -32
- package/src/dev-host/components/PanelTabs.tsx +0 -22
- package/src/dev-host/components/ResizeHandle.tsx +0 -33
- package/src/dev-host/components/icons.tsx +0 -27
- package/src/dev-host/components/ui/ScrollArea.tsx +0 -46
- package/src/dev-host/components/ui/Tabs.tsx +0 -33
- package/src/dev-host/constants.ts +0 -29
- package/src/dev-host/index.tsx +0 -19
- package/src/dev-host/styles.css +0 -631
- package/src/dev-host/types.ts +0 -33
- package/src/dev-host/utils.ts +0 -96
package/src/dev-host/utils.ts
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { DEV_HOST_STATE_ELEMENT_ID } from './constants.js';
|
|
2
|
-
import type { DevHostPanelEntry, DevHostState, MessageEntry, PluginMessage } from './types.js';
|
|
3
|
-
|
|
4
|
-
export const cn = (...parts: Array<string | false | null | undefined>) => {
|
|
5
|
-
return parts.filter(Boolean).join(' ');
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export const formatPayloadPreview = (payload: unknown) => {
|
|
9
|
-
if (payload == null) {
|
|
10
|
-
return 'null';
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (typeof payload === 'string') {
|
|
14
|
-
return payload;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
try {
|
|
18
|
-
return JSON.stringify(payload);
|
|
19
|
-
} catch {
|
|
20
|
-
return String(payload);
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const isJsonTreeData = (value: unknown): value is Record<string, unknown> | unknown[] => {
|
|
25
|
-
return Array.isArray(value) || (typeof value === 'object' && value !== null);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const formatMessageDate = (date: string) => {
|
|
29
|
-
return new Date(date).toLocaleString();
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export const formatMessageTableDate = (date: string) => {
|
|
33
|
-
return new Date(date).toLocaleString([], {
|
|
34
|
-
month: '2-digit',
|
|
35
|
-
day: '2-digit',
|
|
36
|
-
hour: '2-digit',
|
|
37
|
-
minute: '2-digit',
|
|
38
|
-
second: '2-digit',
|
|
39
|
-
hour12: false,
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const formatPayloadForCommandInput = (payload: unknown) => {
|
|
44
|
-
try {
|
|
45
|
-
return JSON.stringify(payload, null, 2);
|
|
46
|
-
} catch {
|
|
47
|
-
return String(payload);
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export const isPluginMessage = (value: unknown): value is PluginMessage => {
|
|
52
|
-
return (
|
|
53
|
-
typeof value === 'object' &&
|
|
54
|
-
value !== null &&
|
|
55
|
-
'pluginId' in value &&
|
|
56
|
-
'type' in value &&
|
|
57
|
-
'payload' in value
|
|
58
|
-
);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const getInitialPanel = (panels: DevHostPanelEntry[]) => {
|
|
62
|
-
const requestedPanel = new URLSearchParams(window.location.search).get('panel');
|
|
63
|
-
|
|
64
|
-
if (requestedPanel) {
|
|
65
|
-
const matchedPanel = panels.find((panel) => panel.label === requestedPanel);
|
|
66
|
-
if (matchedPanel) {
|
|
67
|
-
return matchedPanel;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return panels[0] ?? null;
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export const createMessageEntry = (
|
|
75
|
-
input: Omit<MessageEntry, 'id' | 'date'>,
|
|
76
|
-
): MessageEntry => {
|
|
77
|
-
return {
|
|
78
|
-
id: crypto.randomUUID(),
|
|
79
|
-
date: new Date().toISOString(),
|
|
80
|
-
...input,
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export const clamp = (value: number, min: number, max: number) => {
|
|
85
|
-
return Math.min(Math.max(value, min), max);
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
export const readDevHostState = (): DevHostState => {
|
|
89
|
-
const stateElement = document.getElementById(DEV_HOST_STATE_ELEMENT_ID);
|
|
90
|
-
|
|
91
|
-
if (!stateElement?.textContent) {
|
|
92
|
-
throw new Error('Rozenite dev host failed to initialize.');
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return JSON.parse(stateElement.textContent) as DevHostState;
|
|
96
|
-
};
|