elit 3.0.9 → 3.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.
@@ -0,0 +1,159 @@
1
+ /**
2
+ * Elit - CreateStyle CSS Generation System
3
+ */
4
+ interface CSSVariable {
5
+ name: string;
6
+ value: string;
7
+ toString(): string;
8
+ }
9
+ interface CSSRule {
10
+ selector: string;
11
+ styles: Record<string, string | number>;
12
+ nested?: CSSRule[];
13
+ type: 'tag' | 'class' | 'id' | 'pseudo-class' | 'pseudo-element' | 'name' | 'custom' | 'media' | 'attribute';
14
+ }
15
+ interface MediaRule {
16
+ type: string;
17
+ condition: string;
18
+ rules: CSSRule[];
19
+ }
20
+ interface KeyframeStep {
21
+ step: string | number;
22
+ styles: Record<string, string | number>;
23
+ }
24
+ interface Keyframes {
25
+ name: string;
26
+ steps: KeyframeStep[];
27
+ }
28
+ interface FontFace {
29
+ fontFamily: string;
30
+ src: string;
31
+ fontWeight?: string | number;
32
+ fontStyle?: string;
33
+ fontDisplay?: string;
34
+ unicodeRange?: string;
35
+ }
36
+ interface ContainerRule {
37
+ name?: string;
38
+ condition: string;
39
+ rules: CSSRule[];
40
+ }
41
+ interface SupportsRule {
42
+ condition: string;
43
+ rules: CSSRule[];
44
+ }
45
+ interface LayerRule {
46
+ name: string;
47
+ rules: CSSRule[];
48
+ }
49
+ declare class CreateStyle {
50
+ private variables;
51
+ private rules;
52
+ private mediaRules;
53
+ private keyframes;
54
+ private fontFaces;
55
+ private imports;
56
+ private containerRules;
57
+ private supportsRules;
58
+ private layerRules;
59
+ private _layerOrder;
60
+ addVar(name: string, value: string): CSSVariable;
61
+ var(variable: CSSVariable | string, fallback?: string): string;
62
+ addTag(tag: string, styles: Record<string, string | number>): CSSRule;
63
+ addClass(name: string, styles: Record<string, string | number>): CSSRule;
64
+ addId(name: string, styles: Record<string, string | number>): CSSRule;
65
+ addPseudoClass(pseudo: string, styles: Record<string, string | number>, baseSelector?: string): CSSRule;
66
+ addPseudoElement(pseudo: string, styles: Record<string, string | number>, baseSelector?: string): CSSRule;
67
+ addAttribute(attr: string, styles: Record<string, string | number>, baseSelector?: string): CSSRule;
68
+ attrEquals(attr: string, value: string, styles: Record<string, string | number>, baseSelector?: string): CSSRule;
69
+ attrContainsWord(attr: string, value: string, styles: Record<string, string | number>, baseSelector?: string): CSSRule;
70
+ attrStartsWith(attr: string, value: string, styles: Record<string, string | number>, baseSelector?: string): CSSRule;
71
+ attrEndsWith(attr: string, value: string, styles: Record<string, string | number>, baseSelector?: string): CSSRule;
72
+ attrContains(attr: string, value: string, styles: Record<string, string | number>, baseSelector?: string): CSSRule;
73
+ descendant(ancestor: string, descendant: string, styles: Record<string, string | number>): CSSRule;
74
+ child(parent: string, childSel: string, styles: Record<string, string | number>): CSSRule;
75
+ adjacentSibling(element: string, sibling: string, styles: Record<string, string | number>): CSSRule;
76
+ generalSibling(element: string, sibling: string, styles: Record<string, string | number>): CSSRule;
77
+ multiple(selectors: string[], styles: Record<string, string | number>): CSSRule;
78
+ addName(name: string, styles: Record<string, string | number>): CSSRule;
79
+ nesting(parentRule: CSSRule, ...childRules: CSSRule[]): CSSRule;
80
+ keyframe(name: string, steps: Record<string | number, Record<string, string | number>>): Keyframes;
81
+ keyframeFromTo(name: string, from: Record<string, string | number>, to: Record<string, string | number>): Keyframes;
82
+ fontFace(options: FontFace): FontFace;
83
+ import(url: string, mediaQuery?: string): string;
84
+ media(type: string, condition: string, rules: Record<string, Record<string, string | number>>): MediaRule;
85
+ mediaScreen(condition: string, rules: Record<string, Record<string, string | number>>): MediaRule;
86
+ mediaPrint(rules: Record<string, Record<string, string | number>>): MediaRule;
87
+ mediaMinWidth(minWidth: string, rules: Record<string, Record<string, string | number>>): MediaRule;
88
+ mediaMaxWidth(maxWidth: string, rules: Record<string, Record<string, string | number>>): MediaRule;
89
+ mediaDark(rules: Record<string, Record<string, string | number>>): MediaRule;
90
+ mediaLight(rules: Record<string, Record<string, string | number>>): MediaRule;
91
+ mediaReducedMotion(rules: Record<string, Record<string, string | number>>): MediaRule;
92
+ container(condition: string, rules: Record<string, Record<string, string | number>>, name?: string): ContainerRule;
93
+ addContainer(name: string, styles: Record<string, string | number>): CSSRule;
94
+ supports(condition: string, rules: Record<string, Record<string, string | number>>): SupportsRule;
95
+ layerOrder(...layers: string[]): void;
96
+ layer(name: string, rules: Record<string, Record<string, string | number>>): LayerRule;
97
+ add(rules: Record<string, Record<string, string | number>>): CSSRule[];
98
+ important(value: string | number): string;
99
+ private toKebabCase;
100
+ private createAndAddRule;
101
+ private rulesToCSSRules;
102
+ private renderRulesWithIndent;
103
+ private stylesToString;
104
+ private renderRule;
105
+ private renderMediaRule;
106
+ private renderKeyframes;
107
+ private renderFontFace;
108
+ private renderContainerRule;
109
+ private renderSupportsRule;
110
+ private renderLayerRule;
111
+ render(...additionalRules: (CSSRule | CSSRule[] | MediaRule | Keyframes | ContainerRule | SupportsRule | LayerRule | undefined | null)[]): string;
112
+ inject(styleId?: string): HTMLStyleElement;
113
+ clear(): void;
114
+ }
115
+ declare const styles: CreateStyle;
116
+ declare const addVar: (name: string, value: string) => CSSVariable;
117
+ declare const getVar: (variable: CSSVariable | string, fallback?: string) => string;
118
+ declare const addTag: (tag: string, styles: Record<string, string | number>) => CSSRule;
119
+ declare const addClass: (name: string, styles: Record<string, string | number>) => CSSRule;
120
+ declare const addId: (name: string, styles: Record<string, string | number>) => CSSRule;
121
+ declare const addPseudoClass: (pseudo: string, styles: Record<string, string | number>, baseSelector?: string) => CSSRule;
122
+ declare const addPseudoElement: (pseudo: string, styles: Record<string, string | number>, baseSelector?: string) => CSSRule;
123
+ declare const addAttribute: (attr: string, styles: Record<string, string | number>, baseSelector?: string) => CSSRule;
124
+ declare const attrEquals: (attr: string, value: string, styles: Record<string, string | number>, baseSelector?: string) => CSSRule;
125
+ declare const attrContainsWord: (attr: string, value: string, styles: Record<string, string | number>, baseSelector?: string) => CSSRule;
126
+ declare const attrStartsWith: (attr: string, value: string, styles: Record<string, string | number>, baseSelector?: string) => CSSRule;
127
+ declare const attrEndsWith: (attr: string, value: string, styles: Record<string, string | number>, baseSelector?: string) => CSSRule;
128
+ declare const attrContains: (attr: string, value: string, styles: Record<string, string | number>, baseSelector?: string) => CSSRule;
129
+ declare const descendant: (ancestor: string, descendant: string, styles: Record<string, string | number>) => CSSRule;
130
+ declare const childStyle: (parent: string, childSel: string, styles: Record<string, string | number>) => CSSRule;
131
+ declare const adjacentSibling: (element: string, sibling: string, styles: Record<string, string | number>) => CSSRule;
132
+ declare const generalSibling: (element: string, sibling: string, styles: Record<string, string | number>) => CSSRule;
133
+ declare const multipleStyle: (selectors: string[], styles: Record<string, string | number>) => CSSRule;
134
+ declare const addName: (name: string, styles: Record<string, string | number>) => CSSRule;
135
+ declare const nesting: (parentRule: CSSRule, ...childRules: CSSRule[]) => CSSRule;
136
+ declare const keyframe: (name: string, steps: Record<string | number, Record<string, string | number>>) => Keyframes;
137
+ declare const keyframeFromTo: (name: string, from: Record<string, string | number>, to: Record<string, string | number>) => Keyframes;
138
+ declare const fontFace: (options: FontFace) => FontFace;
139
+ declare const importStyle: (url: string, mediaQuery?: string) => string;
140
+ declare const mediaStyle: (type: string, condition: string, rules: Record<string, Record<string, string | number>>) => MediaRule;
141
+ declare const mediaScreen: (condition: string, rules: Record<string, Record<string, string | number>>) => MediaRule;
142
+ declare const mediaPrint: (rules: Record<string, Record<string, string | number>>) => MediaRule;
143
+ declare const mediaMinWidth: (minWidth: string, rules: Record<string, Record<string, string | number>>) => MediaRule;
144
+ declare const mediaMaxWidth: (maxWidth: string, rules: Record<string, Record<string, string | number>>) => MediaRule;
145
+ declare const mediaDark: (rules: Record<string, Record<string, string | number>>) => MediaRule;
146
+ declare const mediaLight: (rules: Record<string, Record<string, string | number>>) => MediaRule;
147
+ declare const mediaReducedMotion: (rules: Record<string, Record<string, string | number>>) => MediaRule;
148
+ declare const container: (condition: string, rules: Record<string, Record<string, string | number>>, name?: string) => ContainerRule;
149
+ declare const addContainer: (name: string, styles: Record<string, string | number>) => CSSRule;
150
+ declare const supportsStyle: (condition: string, rules: Record<string, Record<string, string | number>>) => SupportsRule;
151
+ declare const layerOrder: (...layers: string[]) => void;
152
+ declare const layer: (name: string, rules: Record<string, Record<string, string | number>>) => LayerRule;
153
+ declare const addStyle: (rules: Record<string, Record<string, string | number>>) => CSSRule[];
154
+ declare const important: (value: string | number) => string;
155
+ declare const renderStyle: (...additionalRules: (CSSRule | CSSRule[] | MediaRule | Keyframes | ContainerRule | SupportsRule | LayerRule | undefined | null)[]) => string;
156
+ declare const injectStyle: (styleId?: string) => HTMLStyleElement;
157
+ declare const clearStyle: () => void;
158
+
159
+ export { type CSSRule, type CSSVariable, type ContainerRule, CreateStyle, type FontFace, type KeyframeStep, type Keyframes, type LayerRule, type MediaRule, type SupportsRule, addAttribute, addClass, addContainer, addId, addName, addPseudoClass, addPseudoElement, addStyle, addTag, addVar, adjacentSibling, attrContains, attrContainsWord, attrEndsWith, attrEquals, attrStartsWith, childStyle, clearStyle, container, styles as default, descendant, fontFace, generalSibling, getVar, importStyle, important, injectStyle, keyframe, keyframeFromTo, layer, layerOrder, mediaDark, mediaLight, mediaMaxWidth, mediaMinWidth, mediaPrint, mediaReducedMotion, mediaScreen, mediaStyle, multipleStyle, nesting, renderStyle, styles, supportsStyle };
@@ -0,0 +1,446 @@
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
+ /** Server mode: 'dev' uses source files, 'preview' uses built files (default: 'dev') */
295
+ mode?: 'dev' | 'preview';
296
+ }
297
+ interface ProxyConfig {
298
+ /** Path prefix to match for proxying (e.g., '/api', '/graphql') */
299
+ context: string;
300
+ /** Target URL to proxy to (e.g., 'http://localhost:8080') */
301
+ target: string;
302
+ /** Change the origin of the host header to the target URL */
303
+ changeOrigin?: boolean;
304
+ /** Rewrite path before sending to target */
305
+ pathRewrite?: Record<string, string>;
306
+ /** Additional headers to add to the proxied request */
307
+ headers?: Record<string, string>;
308
+ /** Enable WebSocket proxying */
309
+ ws?: boolean;
310
+ }
311
+ interface WorkerConfig {
312
+ /** Worker script path relative to root directory */
313
+ path: string;
314
+ /** Worker name/identifier (optional, defaults to filename) */
315
+ name?: string;
316
+ /** Worker type: 'module' (ESM) or 'classic' (default: 'module') */
317
+ type?: 'module' | 'classic';
318
+ }
319
+ interface DevServerOptions {
320
+ /** Port to run the server on (default: 3000) */
321
+ port?: number;
322
+ /** Host to bind to (default: 'localhost') */
323
+ host?: string;
324
+ /** Root directory to serve files from */
325
+ root?: string;
326
+ /** Base path for the client application (e.g., '/app1', '/app2') */
327
+ basePath?: string;
328
+ /** Custom index file path (relative to root, e.g., './public/index.html') */
329
+ index?: string;
330
+ /** Array of client configurations - allows multiple clients on same port */
331
+ clients?: ClientConfig[];
332
+ /** Enable HTTPS (default: false) */
333
+ https?: boolean;
334
+ /** Open browser automatically (default: true) */
335
+ open?: boolean;
336
+ /** Watch patterns for file changes */
337
+ watch?: string[];
338
+ /** Ignore patterns for file watcher */
339
+ ignore?: string[];
340
+ /** Global worker scripts (applies to all clients) */
341
+ worker?: WorkerConfig[];
342
+ /** Enable logging (default: true) */
343
+ logging?: boolean;
344
+ /** API router for REST endpoints */
345
+ api?: Router;
346
+ /** SSR render function - returns HTML VNode or string */
347
+ ssr?: () => Child | string;
348
+ /** Proxy configuration for API requests */
349
+ proxy?: ProxyConfig[];
350
+ /** Server mode: 'dev' uses source files, 'preview' uses built files (default: 'dev') */
351
+ mode?: 'dev' | 'preview';
352
+ }
353
+ interface DevServer {
354
+ /** HTTP server instance */
355
+ server: Server;
356
+ /** WebSocket server for HMR */
357
+ wss: WebSocketServer;
358
+ /** Server URL */
359
+ url: string;
360
+ /** Shared state manager */
361
+ state: StateManager;
362
+ /** Close the server */
363
+ close: () => Promise<void>;
364
+ }
365
+ interface HMRMessage {
366
+ type: 'update' | 'reload' | 'error' | 'connected';
367
+ path?: string;
368
+ timestamp?: number;
369
+ error?: string;
370
+ }
371
+ interface BuildOptions {
372
+ /** Entry file to build */
373
+ entry: string;
374
+ /** Output directory */
375
+ outDir?: string;
376
+ /** Output filename */
377
+ outFile?: string;
378
+ /** Enable minification */
379
+ minify?: boolean;
380
+ /** Generate sourcemap */
381
+ sourcemap?: boolean;
382
+ /** Target environment */
383
+ target?: 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'es2021' | 'es2022' | 'esnext';
384
+ /** Output format */
385
+ format?: 'esm' | 'cjs' | 'iife';
386
+ /** Global name for IIFE format */
387
+ globalName?: string;
388
+ /** Target platform */
389
+ platform?: 'browser' | 'node' | 'neutral';
390
+ /** Base path for the application (injected into HTML) */
391
+ basePath?: string;
392
+ /** External dependencies (not bundled) */
393
+ external?: string[];
394
+ /** Enable tree shaking */
395
+ treeshake?: boolean;
396
+ /** Enable logging */
397
+ logging?: boolean;
398
+ /** Environment variables to inject (prefix with VITE_ for client access) */
399
+ env?: Record<string, string>;
400
+ /** Copy static files after build */
401
+ copy?: Array<{
402
+ from: string;
403
+ to: string;
404
+ transform?: (content: string, config: BuildOptions) => string;
405
+ }>;
406
+ /** Post-build hook */
407
+ onBuildEnd?: (result: BuildResult) => void | Promise<void>;
408
+ }
409
+ interface BuildResult {
410
+ /** Output file path */
411
+ outputPath: string;
412
+ /** Build time in milliseconds */
413
+ buildTime: number;
414
+ /** Output file size in bytes */
415
+ size: number;
416
+ }
417
+ interface PreviewOptions {
418
+ /** Port to run the preview server on (default: 4173) */
419
+ port?: number;
420
+ /** Host to bind to (default: 'localhost') */
421
+ host?: string;
422
+ /** Root directory to serve files from (default: dist or build.outDir) */
423
+ root?: string;
424
+ /** Base path for the application (e.g., '/app') */
425
+ basePath?: string;
426
+ /** Custom index file path (relative to root, e.g., './public/index.html') */
427
+ index?: string;
428
+ /** Array of client configurations - allows multiple clients on same port */
429
+ clients?: ClientConfig[];
430
+ /** Enable HTTPS (default: false) */
431
+ https?: boolean;
432
+ /** Open browser automatically (default: true) */
433
+ open?: boolean;
434
+ /** Enable logging (default: true) */
435
+ logging?: boolean;
436
+ /** API router for REST endpoints */
437
+ api?: Router;
438
+ /** SSR render function - returns HTML VNode or string */
439
+ ssr?: () => Child | string;
440
+ /** Proxy configuration for API requests */
441
+ proxy?: ProxyConfig[];
442
+ /** Global worker scripts (applies to all clients) */
443
+ worker?: WorkerConfig[];
444
+ }
445
+
446
+ 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 };