elit 2.0.0 → 3.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 +436 -237
- package/dist/build.d.mts +10 -1
- package/dist/build.d.ts +10 -1
- package/dist/build.js +670 -1
- package/dist/build.mjs +641 -1
- package/dist/chokidar.d.mts +134 -0
- package/dist/chokidar.d.ts +134 -0
- package/dist/chokidar.js +240 -0
- package/dist/chokidar.mjs +221 -0
- package/dist/cli.js +2792 -495
- package/dist/dom.d.mts +10 -3
- package/dist/dom.d.ts +10 -3
- package/dist/dom.js +676 -1
- package/dist/dom.mjs +647 -1
- package/dist/el.d.mts +16 -36
- package/dist/el.d.ts +16 -36
- package/dist/el.js +789 -1
- package/dist/el.mjs +583 -1
- package/dist/fs.d.mts +255 -0
- package/dist/fs.d.ts +255 -0
- package/dist/fs.js +513 -0
- package/dist/fs.mjs +469 -0
- package/dist/hmr.js +112 -1
- package/dist/hmr.mjs +91 -1
- package/dist/http.d.mts +163 -0
- package/dist/http.d.ts +163 -0
- package/dist/http.js +632 -0
- package/dist/http.mjs +605 -0
- package/dist/https.d.mts +108 -0
- package/dist/https.d.ts +108 -0
- package/dist/https.js +907 -0
- package/dist/https.mjs +901 -0
- package/dist/index.d.mts +613 -33
- package/dist/index.d.ts +613 -33
- package/dist/index.js +2589 -1
- package/dist/index.mjs +2312 -1
- package/dist/mime-types.d.mts +48 -0
- package/dist/mime-types.d.ts +48 -0
- package/dist/mime-types.js +197 -0
- package/dist/mime-types.mjs +166 -0
- package/dist/path.d.mts +163 -0
- package/dist/path.d.ts +163 -0
- package/dist/path.js +350 -0
- package/dist/path.mjs +310 -0
- package/dist/router.d.mts +3 -1
- package/dist/router.d.ts +3 -1
- package/dist/router.js +830 -1
- package/dist/router.mjs +801 -1
- package/dist/runtime.d.mts +97 -0
- package/dist/runtime.d.ts +97 -0
- package/dist/runtime.js +43 -0
- package/dist/runtime.mjs +15 -0
- package/dist/server.d.mts +5 -1
- package/dist/server.d.ts +5 -1
- package/dist/server.js +3267 -1
- package/dist/server.mjs +3241 -1
- package/dist/state.d.mts +3 -1
- package/dist/state.d.ts +3 -1
- package/dist/state.js +1036 -1
- package/dist/state.mjs +992 -1
- package/dist/style.d.mts +47 -1
- package/dist/style.d.ts +47 -1
- package/dist/style.js +551 -1
- package/dist/style.mjs +483 -1
- package/dist/{types-DOAdFFJB.d.ts → types-C0nGi6MX.d.mts} +29 -13
- package/dist/{types-DOAdFFJB.d.mts → types-Du6kfwTm.d.ts} +29 -13
- package/dist/types.d.mts +452 -3
- package/dist/types.d.ts +452 -3
- package/dist/types.js +18 -1
- package/dist/ws.d.mts +195 -0
- package/dist/ws.d.ts +195 -0
- package/dist/ws.js +380 -0
- package/dist/ws.mjs +358 -0
- package/dist/wss.d.mts +108 -0
- package/dist/wss.d.ts +108 -0
- package/dist/wss.js +1306 -0
- package/dist/wss.mjs +1300 -0
- package/package.json +53 -6
- package/dist/client.d.mts +0 -9
- package/dist/client.d.ts +0 -9
- package/dist/client.js +0 -1
- package/dist/client.mjs +0 -1
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import { IncomingMessage, ServerResponse
|
|
2
|
-
import { WebSocket
|
|
1
|
+
import { IncomingMessage, ServerResponse } from './http.js';
|
|
2
|
+
import { WebSocket } from './ws.js';
|
|
3
|
+
import { Server } from 'http';
|
|
4
|
+
import { WebSocketServer } from 'ws';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* Development server with HMR support
|
|
8
|
+
* Cross-runtime transpilation support
|
|
9
|
+
* - Node.js: uses esbuild
|
|
10
|
+
* - Bun: uses Bun.Transpiler
|
|
11
|
+
* - Deno: uses Deno.emit
|
|
6
12
|
*/
|
|
7
13
|
|
|
8
14
|
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS' | 'HEAD';
|
|
@@ -20,22 +26,22 @@ declare class ServerRouter {
|
|
|
20
26
|
private routes;
|
|
21
27
|
private middlewares;
|
|
22
28
|
use(middleware: Middleware): this;
|
|
23
|
-
get(path: string, handler: ServerRouteHandler)
|
|
24
|
-
post(path: string, handler: ServerRouteHandler)
|
|
25
|
-
put(path: string, handler: ServerRouteHandler)
|
|
26
|
-
delete(path: string, handler: ServerRouteHandler)
|
|
27
|
-
patch(path: string, handler: ServerRouteHandler)
|
|
28
|
-
options(path: string, handler: ServerRouteHandler)
|
|
29
|
+
get: (path: string, handler: ServerRouteHandler) => this;
|
|
30
|
+
post: (path: string, handler: ServerRouteHandler) => this;
|
|
31
|
+
put: (path: string, handler: ServerRouteHandler) => this;
|
|
32
|
+
delete: (path: string, handler: ServerRouteHandler) => this;
|
|
33
|
+
patch: (path: string, handler: ServerRouteHandler) => this;
|
|
34
|
+
options: (path: string, handler: ServerRouteHandler) => this;
|
|
29
35
|
private addRoute;
|
|
30
36
|
private pathToRegex;
|
|
31
37
|
private parseQuery;
|
|
32
38
|
private parseBody;
|
|
33
39
|
handle(req: IncomingMessage, res: ServerResponse): Promise<boolean>;
|
|
34
40
|
}
|
|
35
|
-
declare const json: (res: ServerResponse, data: any, status?: number) =>
|
|
36
|
-
declare const text: (res: ServerResponse, data: string, status?: number) =>
|
|
37
|
-
declare const html: (res: ServerResponse, data: string, status?: number) =>
|
|
38
|
-
declare const status: (res: ServerResponse, code: number, message?: string) =>
|
|
41
|
+
declare const json: (res: ServerResponse, data: any, status?: number) => ServerResponse;
|
|
42
|
+
declare const text: (res: ServerResponse, data: string, status?: number) => ServerResponse;
|
|
43
|
+
declare const html: (res: ServerResponse, data: string, status?: number) => ServerResponse;
|
|
44
|
+
declare const status: (res: ServerResponse, code: number, message?: string) => ServerResponse;
|
|
39
45
|
declare function cors(options?: {
|
|
40
46
|
origin?: string | string[];
|
|
41
47
|
methods?: string[];
|
|
@@ -165,6 +171,8 @@ interface ClientConfig {
|
|
|
165
171
|
root: string;
|
|
166
172
|
/** Base path for the client application (e.g., '/app1', '/app2') */
|
|
167
173
|
basePath: string;
|
|
174
|
+
/** Custom index file path (relative to root, e.g., './public/index.html') */
|
|
175
|
+
index?: string;
|
|
168
176
|
/** SSR render function - returns HTML VNode or string */
|
|
169
177
|
ssr?: () => Child | string;
|
|
170
178
|
/** Watch patterns for file changes */
|
|
@@ -179,6 +187,8 @@ interface ClientConfig {
|
|
|
179
187
|
api?: Router;
|
|
180
188
|
/** Custom middleware specific to this client */
|
|
181
189
|
middleware?: ((req: any, res: any, next: () => void) => void)[];
|
|
190
|
+
/** Server mode: 'dev' uses source files, 'preview' uses built files (default: 'dev') */
|
|
191
|
+
mode?: 'dev' | 'preview';
|
|
182
192
|
}
|
|
183
193
|
interface ProxyConfig {
|
|
184
194
|
/** Path prefix to match for proxying (e.g., '/api', '/graphql') */
|
|
@@ -211,6 +221,8 @@ interface DevServerOptions {
|
|
|
211
221
|
root?: string;
|
|
212
222
|
/** Base path for the client application (e.g., '/app1', '/app2') */
|
|
213
223
|
basePath?: string;
|
|
224
|
+
/** Custom index file path (relative to root, e.g., './public/index.html') */
|
|
225
|
+
index?: string;
|
|
214
226
|
/** Array of client configurations - allows multiple clients on same port */
|
|
215
227
|
clients?: ClientConfig[];
|
|
216
228
|
/** Enable HTTPS (default: false) */
|
|
@@ -233,6 +245,8 @@ interface DevServerOptions {
|
|
|
233
245
|
ssr?: () => Child | string;
|
|
234
246
|
/** Proxy configuration for API requests */
|
|
235
247
|
proxy?: ProxyConfig[];
|
|
248
|
+
/** Server mode: 'dev' uses source files, 'preview' uses built files (default: 'dev') */
|
|
249
|
+
mode?: 'dev' | 'preview';
|
|
236
250
|
}
|
|
237
251
|
interface DevServer {
|
|
238
252
|
/** HTTP server instance */
|
|
@@ -307,6 +321,8 @@ interface PreviewOptions {
|
|
|
307
321
|
root?: string;
|
|
308
322
|
/** Base path for the application (e.g., '/app') */
|
|
309
323
|
basePath?: string;
|
|
324
|
+
/** Custom index file path (relative to root, e.g., './public/index.html') */
|
|
325
|
+
index?: string;
|
|
310
326
|
/** Array of client configurations - allows multiple clients on same port */
|
|
311
327
|
clients?: ClientConfig[];
|
|
312
328
|
/** Enable HTTPS (default: false) */
|
|
@@ -327,4 +343,4 @@ interface PreviewOptions {
|
|
|
327
343
|
worker?: WorkerConfig[];
|
|
328
344
|
}
|
|
329
345
|
|
|
330
|
-
export {
|
|
346
|
+
export { security as A, type BuildOptions as B, type Children as C, type DevServerOptions as D, type ElementFactory as E, createProxyHandler as F, type StateChangeHandler as G, type HMRMessage as H, type SharedStateOptions as I, type JsonNode as J, SharedState as K, StateManager$1 as L, type Middleware as M, createDevServer as N, type Props as P, type RefCallback as R, type StateOptions as S, type VNode as V, type WorkerConfig as W, type Child as a, type State as b, type VirtualListController as c, type VNodeJson as d, type RefObject as e, type StateManager as f, type ClientConfig as g, type ProxyConfig as h, type DevServer as i, type BuildResult as j, type PreviewOptions as k, type HttpMethod as l, type ServerRouteContext as m, type ServerRouteHandler as n, ServerRouter as o, json as p, html as q, cors as r, status as s, text as t, logger as u, errorHandler as v, rateLimit as w, bodyLimit as x, cacheControl as y, compress as z };
|
package/dist/types.d.mts
CHANGED
|
@@ -1,3 +1,452 @@
|
|
|
1
|
-
|
|
2
|
-
import '
|
|
3
|
-
import '
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
import { EventEmitter as EventEmitter$1 } from 'events';
|
|
3
|
+
import { Server } from 'http';
|
|
4
|
+
import { WebSocketServer } from 'ws';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* HTTP module with unified API across runtimes
|
|
8
|
+
* Ultra-optimized for maximum performance across Node.js, Bun, and Deno
|
|
9
|
+
*
|
|
10
|
+
* Performance optimizations:
|
|
11
|
+
* - Bun fast path: Zero class instantiation (object literals only)
|
|
12
|
+
* - Eliminated EventEmitter overhead for Bun/Deno
|
|
13
|
+
* - Zero-copy headers conversion
|
|
14
|
+
* - Inline response creation
|
|
15
|
+
* - Reduced object allocations
|
|
16
|
+
* - Direct closure capture (no resolver indirection)
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* HTTP Headers type
|
|
21
|
+
*/
|
|
22
|
+
type IncomingHttpHeaders = Record<string, string | string[] | undefined>;
|
|
23
|
+
type OutgoingHttpHeaders = Record<string, string | string[] | number>;
|
|
24
|
+
/**
|
|
25
|
+
* IncomingMessage - Ultra-optimized for zero-copy operations
|
|
26
|
+
*/
|
|
27
|
+
declare class IncomingMessage extends EventEmitter {
|
|
28
|
+
method: string;
|
|
29
|
+
url: string;
|
|
30
|
+
headers: IncomingHttpHeaders;
|
|
31
|
+
statusCode?: number;
|
|
32
|
+
statusMessage?: string;
|
|
33
|
+
httpVersion: string;
|
|
34
|
+
rawHeaders: string[];
|
|
35
|
+
socket: any;
|
|
36
|
+
private _req;
|
|
37
|
+
constructor(req: any);
|
|
38
|
+
text(): Promise<string>;
|
|
39
|
+
json(): Promise<any>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* ServerResponse - Ultra-optimized write operations
|
|
43
|
+
*/
|
|
44
|
+
declare class ServerResponse extends EventEmitter {
|
|
45
|
+
statusCode: number;
|
|
46
|
+
statusMessage: string;
|
|
47
|
+
headersSent: boolean;
|
|
48
|
+
private _headers;
|
|
49
|
+
private _body;
|
|
50
|
+
private _resolve?;
|
|
51
|
+
private _finished;
|
|
52
|
+
private _nodeRes?;
|
|
53
|
+
constructor(_req?: IncomingMessage, nodeRes?: any);
|
|
54
|
+
setHeader(name: string, value: string | string[] | number): this;
|
|
55
|
+
getHeader(name: string): string | string[] | number | undefined;
|
|
56
|
+
getHeaders(): OutgoingHttpHeaders;
|
|
57
|
+
getHeaderNames(): string[];
|
|
58
|
+
hasHeader(name: string): boolean;
|
|
59
|
+
removeHeader(name: string): void;
|
|
60
|
+
writeHead(statusCode: number, statusMessage?: string | OutgoingHttpHeaders, headers?: OutgoingHttpHeaders): this;
|
|
61
|
+
write(chunk: any, encoding?: BufferEncoding | (() => void), callback?: () => void): boolean;
|
|
62
|
+
end(chunk?: any, encoding?: BufferEncoding | (() => void), callback?: () => void): this;
|
|
63
|
+
_setResolver(resolve: (response: Response) => void): void;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* WebSocket module with unified API across runtimes
|
|
68
|
+
* Pure implementation without external dependencies
|
|
69
|
+
* - Node.js: uses native 'ws' module (built-in WebSocket implementation)
|
|
70
|
+
* - Bun: uses native WebSocket
|
|
71
|
+
* - Deno: uses native WebSocket
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* WebSocket ready state
|
|
76
|
+
*/
|
|
77
|
+
declare enum ReadyState {
|
|
78
|
+
CONNECTING = 0,
|
|
79
|
+
OPEN = 1,
|
|
80
|
+
CLOSING = 2,
|
|
81
|
+
CLOSED = 3
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* WebSocket data types
|
|
85
|
+
*/
|
|
86
|
+
type Data = string | Buffer | ArrayBuffer | Buffer[];
|
|
87
|
+
/**
|
|
88
|
+
* WebSocket send options
|
|
89
|
+
*/
|
|
90
|
+
interface SendOptions {
|
|
91
|
+
binary?: boolean;
|
|
92
|
+
compress?: boolean;
|
|
93
|
+
fin?: boolean;
|
|
94
|
+
mask?: boolean;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* WebSocket class - Pure implementation
|
|
98
|
+
*/
|
|
99
|
+
declare class WebSocket extends EventEmitter$1 {
|
|
100
|
+
readyState: ReadyState;
|
|
101
|
+
url: string;
|
|
102
|
+
protocol: string;
|
|
103
|
+
extensions: string;
|
|
104
|
+
binaryType: 'nodebuffer' | 'arraybuffer' | 'fragments';
|
|
105
|
+
/** @internal */
|
|
106
|
+
_socket: any;
|
|
107
|
+
constructor(address: string | URL, protocols?: string | string[], _options?: any);
|
|
108
|
+
private _setupNativeSocket;
|
|
109
|
+
/**
|
|
110
|
+
* Send data through WebSocket
|
|
111
|
+
*/
|
|
112
|
+
send(data: Data, options?: SendOptions | ((err?: Error) => void), callback?: (err?: Error) => void): void;
|
|
113
|
+
/**
|
|
114
|
+
* Close the WebSocket connection
|
|
115
|
+
*/
|
|
116
|
+
close(code?: number, reason?: string | Buffer): void;
|
|
117
|
+
/**
|
|
118
|
+
* Pause the socket (no-op for native WebSocket)
|
|
119
|
+
*/
|
|
120
|
+
pause(): void;
|
|
121
|
+
/**
|
|
122
|
+
* Resume the socket (no-op for native WebSocket)
|
|
123
|
+
*/
|
|
124
|
+
resume(): void;
|
|
125
|
+
/**
|
|
126
|
+
* Send a ping frame (no-op for native WebSocket)
|
|
127
|
+
*/
|
|
128
|
+
ping(_data?: Data, _mask?: boolean, callback?: (err?: Error) => void): void;
|
|
129
|
+
/**
|
|
130
|
+
* Send a pong frame (no-op for native WebSocket)
|
|
131
|
+
*/
|
|
132
|
+
pong(_data?: Data, _mask?: boolean, callback?: (err?: Error) => void): void;
|
|
133
|
+
/**
|
|
134
|
+
* Terminate the connection
|
|
135
|
+
*/
|
|
136
|
+
terminate(): void;
|
|
137
|
+
/**
|
|
138
|
+
* Get buffered amount
|
|
139
|
+
*/
|
|
140
|
+
get bufferedAmount(): number;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Development server with HMR support
|
|
145
|
+
* Cross-runtime transpilation support
|
|
146
|
+
* - Node.js: uses esbuild
|
|
147
|
+
* - Bun: uses Bun.Transpiler
|
|
148
|
+
* - Deno: uses Deno.emit
|
|
149
|
+
*/
|
|
150
|
+
|
|
151
|
+
interface ServerRouteContext {
|
|
152
|
+
req: IncomingMessage;
|
|
153
|
+
res: ServerResponse;
|
|
154
|
+
params: Record<string, string>;
|
|
155
|
+
query: Record<string, string>;
|
|
156
|
+
body: any;
|
|
157
|
+
headers: Record<string, string | string[] | undefined>;
|
|
158
|
+
}
|
|
159
|
+
type ServerRouteHandler = (ctx: ServerRouteContext) => void | Promise<void>;
|
|
160
|
+
type Middleware = (ctx: ServerRouteContext, next: () => Promise<void>) => void | Promise<void>;
|
|
161
|
+
declare class ServerRouter {
|
|
162
|
+
private routes;
|
|
163
|
+
private middlewares;
|
|
164
|
+
use(middleware: Middleware): this;
|
|
165
|
+
get: (path: string, handler: ServerRouteHandler) => this;
|
|
166
|
+
post: (path: string, handler: ServerRouteHandler) => this;
|
|
167
|
+
put: (path: string, handler: ServerRouteHandler) => this;
|
|
168
|
+
delete: (path: string, handler: ServerRouteHandler) => this;
|
|
169
|
+
patch: (path: string, handler: ServerRouteHandler) => this;
|
|
170
|
+
options: (path: string, handler: ServerRouteHandler) => this;
|
|
171
|
+
private addRoute;
|
|
172
|
+
private pathToRegex;
|
|
173
|
+
private parseQuery;
|
|
174
|
+
private parseBody;
|
|
175
|
+
handle(req: IncomingMessage, res: ServerResponse): Promise<boolean>;
|
|
176
|
+
}
|
|
177
|
+
type StateChangeHandler<T = any> = (value: T, oldValue: T) => void;
|
|
178
|
+
interface SharedStateOptions<T = any> {
|
|
179
|
+
initial: T;
|
|
180
|
+
persist?: boolean;
|
|
181
|
+
validate?: (value: T) => boolean;
|
|
182
|
+
}
|
|
183
|
+
declare class SharedState<T = any> {
|
|
184
|
+
readonly key: string;
|
|
185
|
+
private _value;
|
|
186
|
+
private listeners;
|
|
187
|
+
private changeHandlers;
|
|
188
|
+
private options;
|
|
189
|
+
constructor(key: string, options: SharedStateOptions<T>);
|
|
190
|
+
get value(): T;
|
|
191
|
+
set value(newValue: T);
|
|
192
|
+
update(updater: (current: T) => T): void;
|
|
193
|
+
subscribe(ws: WebSocket): void;
|
|
194
|
+
unsubscribe(ws: WebSocket): void;
|
|
195
|
+
onChange(handler: StateChangeHandler<T>): () => void;
|
|
196
|
+
private broadcast;
|
|
197
|
+
private sendTo;
|
|
198
|
+
get subscriberCount(): number;
|
|
199
|
+
clear(): void;
|
|
200
|
+
}
|
|
201
|
+
declare class StateManager$1 {
|
|
202
|
+
private states;
|
|
203
|
+
create<T>(key: string, options: SharedStateOptions<T>): SharedState<T>;
|
|
204
|
+
get<T>(key: string): SharedState<T> | undefined;
|
|
205
|
+
has(key: string): boolean;
|
|
206
|
+
delete(key: string): boolean;
|
|
207
|
+
subscribe(key: string, ws: WebSocket): void;
|
|
208
|
+
unsubscribe(key: string, ws: WebSocket): void;
|
|
209
|
+
unsubscribeAll(ws: WebSocket): void;
|
|
210
|
+
handleStateChange(key: string, value: any): void;
|
|
211
|
+
keys(): string[];
|
|
212
|
+
clear(): void;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Elit - Types and Interfaces
|
|
217
|
+
*/
|
|
218
|
+
interface VNode {
|
|
219
|
+
tagName: string;
|
|
220
|
+
props: Props;
|
|
221
|
+
children: Children;
|
|
222
|
+
}
|
|
223
|
+
type Child = VNode | string | number | boolean | null | undefined;
|
|
224
|
+
type Children = Child[];
|
|
225
|
+
interface Props {
|
|
226
|
+
[key: string]: any;
|
|
227
|
+
className?: string | string[];
|
|
228
|
+
class?: string | string[];
|
|
229
|
+
style?: Partial<CSSStyleDeclaration> | string;
|
|
230
|
+
dangerouslySetInnerHTML?: {
|
|
231
|
+
__html: string;
|
|
232
|
+
};
|
|
233
|
+
ref?: RefCallback | RefObject;
|
|
234
|
+
onClick?: (event: MouseEvent) => void;
|
|
235
|
+
onChange?: (event: Event) => void;
|
|
236
|
+
onInput?: (event: Event) => void;
|
|
237
|
+
onSubmit?: (event: Event) => void;
|
|
238
|
+
value?: string | number;
|
|
239
|
+
checked?: boolean;
|
|
240
|
+
}
|
|
241
|
+
type RefCallback = (element: HTMLElement | SVGElement) => void;
|
|
242
|
+
interface RefObject {
|
|
243
|
+
current: HTMLElement | SVGElement | null;
|
|
244
|
+
}
|
|
245
|
+
interface State<T> {
|
|
246
|
+
value: T;
|
|
247
|
+
subscribe(fn: (value: T) => void): () => void;
|
|
248
|
+
destroy(): void;
|
|
249
|
+
}
|
|
250
|
+
interface StateOptions {
|
|
251
|
+
throttle?: number;
|
|
252
|
+
deep?: boolean;
|
|
253
|
+
}
|
|
254
|
+
interface VirtualListController {
|
|
255
|
+
render: () => void;
|
|
256
|
+
destroy: () => void;
|
|
257
|
+
}
|
|
258
|
+
interface JsonNode {
|
|
259
|
+
tag: string;
|
|
260
|
+
attributes?: Record<string, any>;
|
|
261
|
+
children?: JsonNode | JsonNode[] | string | number | boolean | null;
|
|
262
|
+
}
|
|
263
|
+
type VNodeJson = {
|
|
264
|
+
tagName: string;
|
|
265
|
+
props?: Record<string, any>;
|
|
266
|
+
children?: (VNodeJson | string | number | boolean | null)[];
|
|
267
|
+
} | string | number | boolean | null;
|
|
268
|
+
type ElementFactory = {
|
|
269
|
+
(...children: Child[]): VNode;
|
|
270
|
+
(props: Props | null, ...children: Child[]): VNode;
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
type Router = ServerRouter;
|
|
274
|
+
type StateManager = StateManager$1;
|
|
275
|
+
interface ClientConfig {
|
|
276
|
+
/** Root directory to serve files from */
|
|
277
|
+
root: string;
|
|
278
|
+
/** Base path for the client application (e.g., '/app1', '/app2') */
|
|
279
|
+
basePath: string;
|
|
280
|
+
/** Custom index file path (relative to root, e.g., './public/index.html') */
|
|
281
|
+
index?: string;
|
|
282
|
+
/** SSR render function - returns HTML VNode or string */
|
|
283
|
+
ssr?: () => Child | string;
|
|
284
|
+
/** Watch patterns for file changes */
|
|
285
|
+
watch?: string[];
|
|
286
|
+
/** Ignore patterns for file watching */
|
|
287
|
+
ignore?: string[];
|
|
288
|
+
/** Proxy configuration specific to this client */
|
|
289
|
+
proxy?: ProxyConfig[];
|
|
290
|
+
/** Worker scripts specific to this client */
|
|
291
|
+
worker?: WorkerConfig[];
|
|
292
|
+
/** API router for REST endpoints specific to this client */
|
|
293
|
+
api?: Router;
|
|
294
|
+
/** Custom middleware specific to this client */
|
|
295
|
+
middleware?: ((req: any, res: any, next: () => void) => void)[];
|
|
296
|
+
/** Server mode: 'dev' uses source files, 'preview' uses built files (default: 'dev') */
|
|
297
|
+
mode?: 'dev' | 'preview';
|
|
298
|
+
}
|
|
299
|
+
interface ProxyConfig {
|
|
300
|
+
/** Path prefix to match for proxying (e.g., '/api', '/graphql') */
|
|
301
|
+
context: string;
|
|
302
|
+
/** Target URL to proxy to (e.g., 'http://localhost:8080') */
|
|
303
|
+
target: string;
|
|
304
|
+
/** Change the origin of the host header to the target URL */
|
|
305
|
+
changeOrigin?: boolean;
|
|
306
|
+
/** Rewrite path before sending to target */
|
|
307
|
+
pathRewrite?: Record<string, string>;
|
|
308
|
+
/** Additional headers to add to the proxied request */
|
|
309
|
+
headers?: Record<string, string>;
|
|
310
|
+
/** Enable WebSocket proxying */
|
|
311
|
+
ws?: boolean;
|
|
312
|
+
}
|
|
313
|
+
interface WorkerConfig {
|
|
314
|
+
/** Worker script path relative to root directory */
|
|
315
|
+
path: string;
|
|
316
|
+
/** Worker name/identifier (optional, defaults to filename) */
|
|
317
|
+
name?: string;
|
|
318
|
+
/** Worker type: 'module' (ESM) or 'classic' (default: 'module') */
|
|
319
|
+
type?: 'module' | 'classic';
|
|
320
|
+
}
|
|
321
|
+
interface DevServerOptions {
|
|
322
|
+
/** Port to run the server on (default: 3000) */
|
|
323
|
+
port?: number;
|
|
324
|
+
/** Host to bind to (default: 'localhost') */
|
|
325
|
+
host?: string;
|
|
326
|
+
/** Root directory to serve files from */
|
|
327
|
+
root?: string;
|
|
328
|
+
/** Base path for the client application (e.g., '/app1', '/app2') */
|
|
329
|
+
basePath?: string;
|
|
330
|
+
/** Custom index file path (relative to root, e.g., './public/index.html') */
|
|
331
|
+
index?: string;
|
|
332
|
+
/** Array of client configurations - allows multiple clients on same port */
|
|
333
|
+
clients?: ClientConfig[];
|
|
334
|
+
/** Enable HTTPS (default: false) */
|
|
335
|
+
https?: boolean;
|
|
336
|
+
/** Open browser automatically (default: true) */
|
|
337
|
+
open?: boolean;
|
|
338
|
+
/** Watch patterns for file changes */
|
|
339
|
+
watch?: string[];
|
|
340
|
+
/** Ignore patterns for file watcher */
|
|
341
|
+
ignore?: string[];
|
|
342
|
+
/** Global worker scripts (applies to all clients) */
|
|
343
|
+
worker?: WorkerConfig[];
|
|
344
|
+
/** Enable logging (default: true) */
|
|
345
|
+
logging?: boolean;
|
|
346
|
+
/** Custom middleware */
|
|
347
|
+
middleware?: ((req: any, res: any, next: () => void) => void)[];
|
|
348
|
+
/** API router for REST endpoints */
|
|
349
|
+
api?: Router;
|
|
350
|
+
/** SSR render function - returns HTML VNode or string */
|
|
351
|
+
ssr?: () => Child | string;
|
|
352
|
+
/** Proxy configuration for API requests */
|
|
353
|
+
proxy?: ProxyConfig[];
|
|
354
|
+
/** Server mode: 'dev' uses source files, 'preview' uses built files (default: 'dev') */
|
|
355
|
+
mode?: 'dev' | 'preview';
|
|
356
|
+
}
|
|
357
|
+
interface DevServer {
|
|
358
|
+
/** HTTP server instance */
|
|
359
|
+
server: Server;
|
|
360
|
+
/** WebSocket server for HMR */
|
|
361
|
+
wss: WebSocketServer;
|
|
362
|
+
/** Server URL */
|
|
363
|
+
url: string;
|
|
364
|
+
/** Shared state manager */
|
|
365
|
+
state: StateManager;
|
|
366
|
+
/** Close the server */
|
|
367
|
+
close: () => Promise<void>;
|
|
368
|
+
}
|
|
369
|
+
interface HMRMessage {
|
|
370
|
+
type: 'update' | 'reload' | 'error' | 'connected';
|
|
371
|
+
path?: string;
|
|
372
|
+
timestamp?: number;
|
|
373
|
+
error?: string;
|
|
374
|
+
}
|
|
375
|
+
interface BuildOptions {
|
|
376
|
+
/** Entry file to build */
|
|
377
|
+
entry: string;
|
|
378
|
+
/** Output directory */
|
|
379
|
+
outDir?: string;
|
|
380
|
+
/** Output filename */
|
|
381
|
+
outFile?: string;
|
|
382
|
+
/** Enable minification */
|
|
383
|
+
minify?: boolean;
|
|
384
|
+
/** Generate sourcemap */
|
|
385
|
+
sourcemap?: boolean;
|
|
386
|
+
/** Target environment */
|
|
387
|
+
target?: 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'es2021' | 'es2022' | 'esnext';
|
|
388
|
+
/** Output format */
|
|
389
|
+
format?: 'esm' | 'cjs' | 'iife';
|
|
390
|
+
/** Global name for IIFE format */
|
|
391
|
+
globalName?: string;
|
|
392
|
+
/** Target platform */
|
|
393
|
+
platform?: 'browser' | 'node' | 'neutral';
|
|
394
|
+
/** Base path for the application (injected into HTML) */
|
|
395
|
+
basePath?: string;
|
|
396
|
+
/** External dependencies (not bundled) */
|
|
397
|
+
external?: string[];
|
|
398
|
+
/** Enable tree shaking */
|
|
399
|
+
treeshake?: boolean;
|
|
400
|
+
/** Enable logging */
|
|
401
|
+
logging?: boolean;
|
|
402
|
+
/** Environment variables to inject (prefix with VITE_ for client access) */
|
|
403
|
+
env?: Record<string, string>;
|
|
404
|
+
/** Copy static files after build */
|
|
405
|
+
copy?: Array<{
|
|
406
|
+
from: string;
|
|
407
|
+
to: string;
|
|
408
|
+
transform?: (content: string, config: BuildOptions) => string;
|
|
409
|
+
}>;
|
|
410
|
+
/** Post-build hook */
|
|
411
|
+
onBuildEnd?: (result: BuildResult) => void | Promise<void>;
|
|
412
|
+
}
|
|
413
|
+
interface BuildResult {
|
|
414
|
+
/** Output file path */
|
|
415
|
+
outputPath: string;
|
|
416
|
+
/** Build time in milliseconds */
|
|
417
|
+
buildTime: number;
|
|
418
|
+
/** Output file size in bytes */
|
|
419
|
+
size: number;
|
|
420
|
+
}
|
|
421
|
+
interface PreviewOptions {
|
|
422
|
+
/** Port to run the preview server on (default: 4173) */
|
|
423
|
+
port?: number;
|
|
424
|
+
/** Host to bind to (default: 'localhost') */
|
|
425
|
+
host?: string;
|
|
426
|
+
/** Root directory to serve files from (default: dist or build.outDir) */
|
|
427
|
+
root?: string;
|
|
428
|
+
/** Base path for the application (e.g., '/app') */
|
|
429
|
+
basePath?: string;
|
|
430
|
+
/** Custom index file path (relative to root, e.g., './public/index.html') */
|
|
431
|
+
index?: string;
|
|
432
|
+
/** Array of client configurations - allows multiple clients on same port */
|
|
433
|
+
clients?: ClientConfig[];
|
|
434
|
+
/** Enable HTTPS (default: false) */
|
|
435
|
+
https?: boolean;
|
|
436
|
+
/** Open browser automatically (default: true) */
|
|
437
|
+
open?: boolean;
|
|
438
|
+
/** Enable logging (default: true) */
|
|
439
|
+
logging?: boolean;
|
|
440
|
+
/** Custom middleware */
|
|
441
|
+
middleware?: ((req: any, res: any, next: () => void) => void)[];
|
|
442
|
+
/** API router for REST endpoints */
|
|
443
|
+
api?: Router;
|
|
444
|
+
/** SSR render function - returns HTML VNode or string */
|
|
445
|
+
ssr?: () => Child | string;
|
|
446
|
+
/** Proxy configuration for API requests */
|
|
447
|
+
proxy?: ProxyConfig[];
|
|
448
|
+
/** Global worker scripts (applies to all clients) */
|
|
449
|
+
worker?: WorkerConfig[];
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
export type { BuildOptions, BuildResult, Child, Children, ClientConfig, DevServer, DevServerOptions, ElementFactory, HMRMessage, JsonNode, PreviewOptions, Props, ProxyConfig, RefCallback, RefObject, Router, State, StateManager, StateOptions, VNode, VNodeJson, VirtualListController, WorkerConfig };
|