elit 3.6.5 → 3.6.7

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.
Files changed (154) hide show
  1. package/Cargo.lock +1 -1
  2. package/Cargo.toml +1 -1
  3. package/README.md +6 -0
  4. package/dist/build.cjs +421 -331
  5. package/dist/build.d.ts +1 -16
  6. package/dist/build.js +420 -330
  7. package/dist/build.mjs +420 -330
  8. package/dist/chokidar.cjs +219 -182
  9. package/dist/chokidar.d.ts +25 -10
  10. package/dist/chokidar.js +217 -182
  11. package/dist/chokidar.mjs +218 -183
  12. package/dist/cli.cjs +21608 -20241
  13. package/dist/cli.d.ts +19 -37
  14. package/dist/cli.mjs +21262 -19910
  15. package/dist/config.cjs +357 -350
  16. package/dist/config.d.ts +19 -240
  17. package/dist/config.js +520 -515
  18. package/dist/config.mjs +346 -341
  19. package/dist/contracts-BeW9k0yZ.d.ts +54 -0
  20. package/dist/contracts-D7KIS-TK.d.ts +36 -0
  21. package/dist/coverage.cjs +448 -485
  22. package/dist/coverage.d.ts +13 -59
  23. package/dist/coverage.js +447 -484
  24. package/dist/coverage.mjs +447 -484
  25. package/dist/database.cjs +819 -828
  26. package/dist/database.d.ts +8 -24
  27. package/dist/database.js +818 -829
  28. package/dist/database.mjs +818 -829
  29. package/dist/desktop-auto-render.cjs +1700 -1522
  30. package/dist/desktop-auto-render.d.ts +4 -9
  31. package/dist/desktop-auto-render.js +1695 -1517
  32. package/dist/desktop-auto-render.mjs +1696 -1518
  33. package/dist/desktop.cjs +3 -1
  34. package/dist/desktop.d.ts +4 -1
  35. package/dist/desktop.js +1 -1
  36. package/dist/desktop.mjs +1 -1
  37. package/dist/dev-build.cjs +830 -0
  38. package/dist/dev-build.d.ts +53 -0
  39. package/dist/dev-build.js +3318 -0
  40. package/dist/dev-build.mjs +797 -0
  41. package/dist/dom.cjs +717 -590
  42. package/dist/dom.d.ts +2 -15
  43. package/dist/dom.js +714 -587
  44. package/dist/dom.mjs +716 -589
  45. package/dist/el.cjs +62 -52
  46. package/dist/el.d.ts +5 -10
  47. package/dist/el.js +60 -52
  48. package/dist/el.mjs +60 -52
  49. package/dist/fs.cjs +72 -63
  50. package/dist/fs.d.ts +22 -19
  51. package/dist/fs.js +71 -62
  52. package/dist/fs.mjs +71 -62
  53. package/dist/hmr.cjs +40 -14
  54. package/dist/hmr.d.ts +11 -23
  55. package/dist/hmr.js +38 -14
  56. package/dist/hmr.mjs +38 -14
  57. package/dist/http.cjs +251 -99
  58. package/dist/http.d.ts +38 -104
  59. package/dist/http.js +249 -99
  60. package/dist/http.mjs +249 -99
  61. package/dist/https.cjs +524 -228
  62. package/dist/https.d.ts +44 -36
  63. package/dist/https.js +520 -226
  64. package/dist/https.mjs +522 -228
  65. package/dist/index.cjs +7502 -7690
  66. package/dist/index.d.ts +8 -3
  67. package/dist/index.js +7486 -7676
  68. package/dist/index.mjs +7497 -7686
  69. package/dist/mime-types.cjs +10 -4
  70. package/dist/mime-types.d.ts +8 -11
  71. package/dist/mime-types.js +9 -3
  72. package/dist/mime-types.mjs +9 -3
  73. package/dist/native.cjs +8616 -8869
  74. package/dist/native.d.ts +7 -8
  75. package/dist/native.js +8682 -8935
  76. package/dist/native.mjs +8615 -8868
  77. package/dist/path.cjs +83 -77
  78. package/dist/path.d.ts +29 -29
  79. package/dist/path.js +82 -76
  80. package/dist/path.mjs +82 -76
  81. package/dist/pm.cjs +3300 -0
  82. package/dist/pm.d.ts +256 -0
  83. package/dist/pm.js +5638 -0
  84. package/dist/pm.mjs +3196 -0
  85. package/dist/preview-build.cjs +712 -0
  86. package/dist/preview-build.d.ts +59 -0
  87. package/dist/preview-build.js +3194 -0
  88. package/dist/preview-build.mjs +676 -0
  89. package/dist/render-context.cjs +13 -2
  90. package/dist/render-context.d.ts +9 -31
  91. package/dist/render-context.js +11 -2
  92. package/dist/render-context.mjs +11 -2
  93. package/dist/router.cjs +787 -645
  94. package/dist/router.d.ts +8 -12
  95. package/dist/router.js +786 -644
  96. package/dist/router.mjs +786 -644
  97. package/dist/runtime.cjs +1 -1
  98. package/dist/runtime.js +1 -1
  99. package/dist/runtime.mjs +1 -1
  100. package/dist/server.cjs +3315 -2603
  101. package/dist/server.d.ts +49 -4
  102. package/dist/server.js +7611 -2834
  103. package/dist/server.mjs +3317 -2607
  104. package/dist/smtp-server.cjs +128 -0
  105. package/dist/smtp-server.d.ts +27 -0
  106. package/dist/smtp-server.js +4199 -0
  107. package/dist/smtp-server.mjs +100 -0
  108. package/dist/state-DvEkDehk.d.ts +195 -0
  109. package/dist/state.cjs +768 -658
  110. package/dist/state.d.ts +11 -69
  111. package/dist/state.js +760 -650
  112. package/dist/state.mjs +767 -657
  113. package/dist/style.cjs +1011 -968
  114. package/dist/style.d.ts +13 -127
  115. package/dist/style.js +1009 -970
  116. package/dist/style.mjs +1011 -971
  117. package/dist/test-reporter.cjs +332 -316
  118. package/dist/test-reporter.d.ts +28 -33
  119. package/dist/test-reporter.js +328 -312
  120. package/dist/test-reporter.mjs +328 -312
  121. package/dist/test-runtime.cjs +927 -968
  122. package/dist/test-runtime.d.ts +24 -99
  123. package/dist/test-runtime.js +922 -965
  124. package/dist/test-runtime.mjs +922 -965
  125. package/dist/test.cjs +4428 -4273
  126. package/dist/test.d.ts +2 -8
  127. package/dist/test.js +4307 -4154
  128. package/dist/test.mjs +4419 -4267
  129. package/dist/types-BONVzPtp.d.ts +59 -0
  130. package/dist/types-BR4wMiVx.d.ts +32 -0
  131. package/dist/types-C4gKykuG.d.ts +23 -0
  132. package/dist/types-CIhpN1-K.d.ts +64 -0
  133. package/dist/types-Ckj8md_j.d.ts +84 -0
  134. package/dist/types-CpjQTAkX.d.ts +24 -0
  135. package/dist/types-D0LjrYjS.d.ts +14 -0
  136. package/dist/types-DAisuVr5.d.ts +75 -0
  137. package/dist/types-tJn88E1N.d.ts +242 -0
  138. package/dist/types.d.ts +71 -226
  139. package/dist/universal.cjs +1 -1
  140. package/dist/universal.d.ts +1 -5
  141. package/dist/universal.js +1 -1
  142. package/dist/universal.mjs +1 -1
  143. package/dist/websocket-XfyK23zD.d.ts +119 -0
  144. package/dist/ws.cjs +129 -108
  145. package/dist/ws.d.ts +21 -131
  146. package/dist/ws.js +128 -109
  147. package/dist/ws.mjs +128 -109
  148. package/dist/wss.cjs +757 -479
  149. package/dist/wss.d.ts +31 -28
  150. package/dist/wss.js +755 -479
  151. package/dist/wss.mjs +758 -482
  152. package/package.json +16 -1
  153. package/vendor/epaint-0.31.1/src/image.rs +418 -0
  154. package/dist/server-CcBFc2F5.d.ts +0 -449
package/dist/types.d.ts CHANGED
@@ -1,26 +1,12 @@
1
+ import { C as Child } from './types-BONVzPtp.js';
2
+ export { a as Children, E as ElementFactory, J as JsonNode, P as Props, R as RefCallback, b as RefObject, S as State, c as StateOptions, V as VNode, d as VNodeJson, e as VirtualListController } from './types-BONVzPtp.js';
1
3
  import { EventEmitter } from 'node:events';
2
4
  import { EventEmitter as EventEmitter$1 } from 'events';
3
- import { Server } from 'http';
5
+ import { Server as Server$1 } from 'http';
4
6
  import { WebSocketServer } from 'ws';
7
+ import { Server, AddressInfo } from 'net';
8
+ import { SMTPServerOptions, SMTPServer } from 'smtp-server';
5
9
 
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
10
  /**
25
11
  * IncomingMessage - Ultra-optimized for zero-copy operations
26
12
  */
@@ -34,10 +20,11 @@ declare class IncomingMessage extends EventEmitter {
34
20
  rawHeaders: string[];
35
21
  socket: any;
36
22
  private _req;
37
- constructor(req: any);
23
+ constructor(req: any, requestMethod?: string);
38
24
  text(): Promise<string>;
39
25
  json(): Promise<any>;
40
26
  }
27
+
41
28
  /**
42
29
  * ServerResponse - Ultra-optimized write operations
43
30
  */
@@ -67,12 +54,10 @@ declare class ServerResponse extends EventEmitter {
67
54
  }
68
55
 
69
56
  /**
70
- * WebSocket module with unified API across runtimes
71
- * Pure implementation without external dependencies
72
- * - Node.js: uses native 'ws' module (built-in WebSocket implementation)
73
- * - Bun: uses native WebSocket
74
- * - Deno: uses native WebSocket
57
+ * HTTP Headers type
75
58
  */
59
+ type IncomingHttpHeaders = Record<string, string | string[] | undefined>;
60
+ type OutgoingHttpHeaders = Record<string, string | string[] | number>;
76
61
 
77
62
  /**
78
63
  * WebSocket ready state
@@ -83,6 +68,7 @@ declare enum ReadyState {
83
68
  CLOSING = 2,
84
69
  CLOSED = 3
85
70
  }
71
+
86
72
  /**
87
73
  * WebSocket data types
88
74
  */
@@ -96,8 +82,9 @@ interface SendOptions {
96
82
  fin?: boolean;
97
83
  mask?: boolean;
98
84
  }
85
+
99
86
  /**
100
- * WebSocket class - Pure implementation
87
+ * WebSocket class.
101
88
  */
102
89
  declare class WebSocket extends EventEmitter$1 {
103
90
  readyState: ReadyState;
@@ -110,47 +97,39 @@ declare class WebSocket extends EventEmitter$1 {
110
97
  constructor(address: string | URL, protocols?: string | string[], _options?: any);
111
98
  private _setupNativeSocket;
112
99
  /**
113
- * Send data through WebSocket
100
+ * Send data through WebSocket.
114
101
  */
115
102
  send(data: Data, options?: SendOptions | ((err?: Error) => void), callback?: (err?: Error) => void): void;
116
103
  /**
117
- * Close the WebSocket connection
104
+ * Close the WebSocket connection.
118
105
  */
119
106
  close(code?: number, reason?: string | Buffer): void;
120
107
  /**
121
- * Pause the socket (no-op for native WebSocket)
108
+ * Pause the socket (no-op for native WebSocket).
122
109
  */
123
110
  pause(): void;
124
111
  /**
125
- * Resume the socket (no-op for native WebSocket)
112
+ * Resume the socket (no-op for native WebSocket).
126
113
  */
127
114
  resume(): void;
128
115
  /**
129
- * Send a ping frame (no-op for native WebSocket)
116
+ * Send a ping frame (no-op for native WebSocket).
130
117
  */
131
118
  ping(_data?: Data, _mask?: boolean, callback?: (err?: Error) => void): void;
132
119
  /**
133
- * Send a pong frame (no-op for native WebSocket)
120
+ * Send a pong frame (no-op for native WebSocket).
134
121
  */
135
122
  pong(_data?: Data, _mask?: boolean, callback?: (err?: Error) => void): void;
136
123
  /**
137
- * Terminate the connection
124
+ * Terminate the connection.
138
125
  */
139
126
  terminate(): void;
140
127
  /**
141
- * Get buffered amount
128
+ * Get buffered amount.
142
129
  */
143
130
  get bufferedAmount(): number;
144
131
  }
145
132
 
146
- /**
147
- * Development server with HMR support
148
- * Cross-runtime transpilation support
149
- * - Node.js: uses stripTypeScriptTypes with esbuild fallback
150
- * - Bun: uses Bun.Transpiler
151
- * - Deno: uses Deno.emit
152
- */
153
-
154
133
  interface ElitRequest extends IncomingMessage {
155
134
  body?: any;
156
135
  query?: Record<string, string>;
@@ -172,6 +151,13 @@ interface ServerRouteContext {
172
151
  }
173
152
  type ServerRouteHandler = (ctx: ServerRouteContext, next?: () => Promise<void>) => void | Promise<void>;
174
153
  type Middleware = (ctx: ServerRouteContext, next: () => Promise<void>) => void | Promise<void>;
154
+ type StateChangeHandler<T = any> = (value: T, oldValue: T) => void;
155
+ interface SharedStateOptions<T = any> {
156
+ initial: T;
157
+ persist?: boolean;
158
+ validate?: (value: T) => boolean;
159
+ }
160
+
175
161
  declare class ServerRouter {
176
162
  private routes;
177
163
  private middlewares;
@@ -188,9 +174,6 @@ declare class ServerRouter {
188
174
  private addRoute;
189
175
  private pathToRegex;
190
176
  private parseQuery;
191
- /**
192
- * List all registered routes for debugging
193
- */
194
177
  listRoutes(): Array<{
195
178
  method: string;
196
179
  pattern: string;
@@ -200,12 +183,7 @@ declare class ServerRouter {
200
183
  private parseBody;
201
184
  handle(req: IncomingMessage, res: ServerResponse): Promise<boolean>;
202
185
  }
203
- type StateChangeHandler<T = any> = (value: T, oldValue: T) => void;
204
- interface SharedStateOptions<T = any> {
205
- initial: T;
206
- persist?: boolean;
207
- validate?: (value: T) => boolean;
208
- }
186
+
209
187
  declare class SharedState<T = any> {
210
188
  readonly key: string;
211
189
  private _value;
@@ -238,193 +216,100 @@ declare class StateManager$1 {
238
216
  clear(): void;
239
217
  }
240
218
 
241
- /**
242
- * Elit - Types and Interfaces
243
- */
244
- interface VNode {
245
- tagName: string;
246
- props: Props;
247
- children: Children;
248
- }
249
- type Child = VNode | string | number | boolean | null | undefined | Child[];
250
- type Children = Child[];
251
- interface Props {
252
- [key: string]: any;
253
- className?: string | string[];
254
- class?: string | string[];
255
- style?: Partial<CSSStyleDeclaration> | string;
256
- dangerouslySetInnerHTML?: {
257
- __html: string;
258
- };
259
- ref?: RefCallback | RefObject;
260
- onClick?: (event: MouseEvent) => void;
261
- onChange?: (event: Event) => void;
262
- onInput?: (event: Event) => void;
263
- onSubmit?: (event: Event) => void;
264
- value?: string | number | string[];
265
- checked?: boolean;
266
- }
267
- type RefCallback = (element: HTMLElement | SVGElement) => void;
268
- interface RefObject {
269
- current: HTMLElement | SVGElement | null;
270
- }
271
- interface State<T> {
272
- value: T;
273
- subscribe(fn: (value: T) => void): () => void;
274
- destroy(): void;
275
- }
276
- interface StateOptions {
277
- throttle?: number;
278
- deep?: boolean;
219
+ interface ElitSMTPServerConfig extends SMTPServerOptions {
220
+ port?: number;
221
+ host?: string;
222
+ label?: string;
279
223
  }
280
- interface VirtualListController {
281
- render: () => void;
282
- destroy: () => void;
224
+ interface ResolvedElitSMTPServerConfig extends SMTPServerOptions {
225
+ port: number;
226
+ host: string;
227
+ label?: string;
283
228
  }
284
- interface JsonNode {
285
- tag: string;
286
- attributes?: Record<string, any>;
287
- children?: JsonNode | JsonNode[] | string | number | boolean | null;
229
+ interface ElitSMTPServerHandle {
230
+ server: SMTPServer;
231
+ config: ResolvedElitSMTPServerConfig;
232
+ listen(callback?: () => void): Server;
233
+ address(): AddressInfo | string | null;
234
+ close(): Promise<void>;
288
235
  }
289
- type VNodeJson = {
290
- tagName: string;
291
- props?: Record<string, any>;
292
- children?: (VNodeJson | string | number | boolean | null)[];
293
- } | string | number | boolean | null;
294
- type ElementFactory = {
295
- (...children: Child[]): VNode;
296
- (props: Props | null, ...children: Child[]): VNode;
297
- };
298
236
 
299
237
  type Router = ServerRouter;
300
238
  type StateManager = StateManager$1;
301
239
  type WebSocketConnection = WebSocket;
302
240
  type WebSocketRequest = IncomingMessage;
303
241
  interface WebSocketEndpointContext {
304
- /** Accepted WebSocket connection */
305
242
  ws: WebSocketConnection;
306
- /** Upgrade request metadata */
307
243
  req: WebSocketRequest;
308
- /** Matched request path without query string */
309
244
  path: string;
310
- /** Parsed query string values */
311
245
  query: Record<string, string>;
312
- /** Request headers */
313
246
  headers: Record<string, string | string[] | undefined>;
314
247
  }
315
248
  type WebSocketEndpointHandler = (ctx: WebSocketEndpointContext) => void | Promise<void>;
316
249
  interface WebSocketEndpointConfig {
317
- /** Path to listen for WebSocket upgrades (e.g., '/ws', '/chat') */
318
250
  path: string;
319
- /** Connection handler invoked after a successful WebSocket upgrade */
320
251
  handler: WebSocketEndpointHandler;
321
252
  }
322
253
  interface ClientConfig {
323
- /** Root directory to serve files from */
324
254
  root: string;
325
- /** Optional fallback root used when the primary root is unavailable in packaged standalone runs */
326
255
  fallbackRoot?: string;
327
- /** Base path for the client application (e.g., '/app1', '/app2') */
328
256
  basePath: string;
329
- /** Custom index file path (relative to root, e.g., './public/index.html') */
330
257
  index?: string;
331
- /** SSR render function - returns HTML VNode or string */
332
258
  ssr?: () => Child | string;
333
- /** Watch patterns for file changes */
334
259
  watch?: string[];
335
- /** Ignore patterns for file watching */
336
260
  ignore?: string[];
337
- /** Proxy configuration specific to this client */
338
261
  proxy?: ProxyConfig[];
339
- /** Worker scripts specific to this client */
340
262
  worker?: WorkerConfig[];
341
- /** API router for REST endpoints specific to this client */
342
263
  api?: Router;
343
- /** WebSocket endpoints specific to this client */
344
264
  ws?: WebSocketEndpointConfig[];
345
- /** Server mode: 'dev' uses source files, 'preview' uses built files (default: 'dev') */
265
+ smtp?: ElitSMTPServerConfig | ElitSMTPServerConfig[];
346
266
  mode?: 'dev' | 'preview';
347
267
  }
348
268
  interface ProxyConfig {
349
- /** Path prefix to match for proxying (e.g., '/api', '/graphql') */
350
269
  context: string;
351
- /** Target URL to proxy to (e.g., 'http://localhost:8080') */
352
270
  target: string;
353
- /** Change the origin of the host header to the target URL */
354
271
  changeOrigin?: boolean;
355
- /** Rewrite path before sending to target */
356
272
  pathRewrite?: Record<string, string>;
357
- /** Additional headers to add to the proxied request */
358
273
  headers?: Record<string, string>;
359
- /** Enable WebSocket proxying */
360
274
  ws?: boolean;
361
275
  }
362
276
  interface WorkerConfig {
363
- /** Worker script path relative to root directory */
364
277
  path: string;
365
- /** Worker name/identifier (optional, defaults to filename) */
366
278
  name?: string;
367
- /** Worker type: 'module' (ESM) or 'classic' (default: 'module') */
368
279
  type?: 'module' | 'classic';
369
280
  }
370
281
  interface DevServerOptions {
371
- /** Port to run the server on (default: 3000) */
372
282
  port?: number;
373
- /** Host to bind to (default: 'localhost') */
374
283
  host?: string;
375
- /** Domain to map (e.g., 'idevcoder.com') - redirects domain traffic to this server's port */
376
284
  domain?: string;
377
- /** Root directory to serve files from */
378
285
  root?: string;
379
- /** Optional fallback root used when the primary root is unavailable in packaged standalone runs */
380
286
  fallbackRoot?: string;
381
- /** Base path for the client application (e.g., '/app1', '/app2') */
382
287
  basePath?: string;
383
- /** Custom index file path (relative to root, e.g., './public/index.html') */
384
288
  index?: string;
385
- /** Array of client configurations - allows multiple clients on same port */
386
289
  clients?: ClientConfig[];
387
- /** Enable HTTPS (default: false) */
388
290
  https?: boolean;
389
- /** Open browser automatically (default: true) */
390
291
  open?: boolean;
391
- /** Watch patterns for file changes */
392
292
  watch?: string[];
393
- /** Ignore patterns for file watcher */
394
293
  ignore?: string[];
395
- /** Global worker scripts (applies to all clients) */
396
294
  worker?: WorkerConfig[];
397
- /** Enable logging (default: true) */
398
295
  logging?: boolean;
399
- /** API router for REST endpoints */
400
296
  api?: Router;
401
- /** WebSocket endpoints */
402
297
  ws?: WebSocketEndpointConfig[];
403
- /** SSR render function - returns HTML VNode or string */
298
+ smtp?: ElitSMTPServerConfig | ElitSMTPServerConfig[];
404
299
  ssr?: () => Child | string;
405
- /** Proxy configuration for API requests */
406
300
  proxy?: ProxyConfig[];
407
- /** Server mode: 'dev' uses source files, 'preview' uses built files (default: 'dev') */
408
301
  mode?: 'dev' | 'preview';
409
- /** Environment variables to inject (prefix with VITE_ for client access) */
410
302
  env?: Record<string, string>;
411
- /** Emit a bundled development server during elit build */
412
303
  standalone?: boolean;
413
- /** Output directory for a bundled standalone development server (default: dev-dist) */
414
304
  outDir?: string;
415
- /** Output filename for a bundled standalone development server (default: index.js) */
416
305
  outFile?: string;
417
306
  }
418
307
  interface DevServer {
419
- /** HTTP server instance */
420
- server: Server;
421
- /** WebSocket server for HMR */
308
+ server: Server$1;
422
309
  wss: WebSocketServer;
423
- /** Server URL */
310
+ smtpServers: ElitSMTPServerHandle[];
424
311
  url: string;
425
- /** Shared state manager */
426
312
  state: StateManager;
427
- /** Close the server */
428
313
  close: () => Promise<void>;
429
314
  }
430
315
  interface HMRMessage {
@@ -433,103 +318,63 @@ interface HMRMessage {
433
318
  timestamp?: number;
434
319
  error?: string;
435
320
  }
321
+ interface PreviewOptions {
322
+ port?: number;
323
+ host?: string;
324
+ domain?: string;
325
+ root?: string;
326
+ basePath?: string;
327
+ index?: string;
328
+ clients?: ClientConfig[];
329
+ https?: boolean;
330
+ open?: boolean;
331
+ logging?: boolean;
332
+ api?: Router;
333
+ ws?: WebSocketEndpointConfig[];
334
+ smtp?: ElitSMTPServerConfig | ElitSMTPServerConfig[];
335
+ ssr?: () => Child | string;
336
+ proxy?: ProxyConfig[];
337
+ worker?: WorkerConfig[];
338
+ env?: Record<string, string>;
339
+ standalone?: boolean;
340
+ outFile?: string;
341
+ }
342
+
436
343
  interface BuildOptions {
437
- /** Entry file to build */
438
344
  entry: string;
439
- /** Output directory */
440
345
  outDir?: string;
441
- /** Output filename */
442
346
  outFile?: string;
443
- /** Enable minification */
444
347
  minify?: boolean;
445
- /** Generate sourcemap */
446
348
  sourcemap?: boolean;
447
- /** Target environment */
448
349
  target?: 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'es2021' | 'es2022' | 'esnext';
449
- /** Output format */
450
350
  format?: 'esm' | 'cjs' | 'iife';
451
- /** Global name for IIFE format */
452
351
  globalName?: string;
453
- /** Target platform */
454
352
  platform?: 'browser' | 'node' | 'neutral';
455
- /** Base path for the application (injected into HTML) */
456
353
  basePath?: string;
457
- /** External dependencies (not bundled) */
458
354
  external?: string[];
459
- /** Module resolution options */
460
355
  resolve?: {
461
- /** Alias imports to other paths or modules */
462
356
  alias?: Record<string, string>;
463
357
  };
464
- /** Enable tree shaking */
465
358
  treeshake?: boolean;
466
- /** Enable logging */
467
359
  logging?: boolean;
468
- /** Environment variables to inject (prefix with VITE_ for client access) */
469
360
  env?: Record<string, string>;
470
- /** Copy static files after build */
471
361
  copy?: Array<{
472
362
  from: string;
473
363
  to: string;
474
364
  transform?: (content: string, config: BuildOptions) => string;
475
365
  }>;
476
- /** Post-build hook */
477
366
  onBuildEnd?: (result: BuildResult) => void | Promise<void>;
478
- /** Emit a standalone preview server bundle after the client build */
479
367
  standalonePreview?: boolean;
480
- /** Emit a standalone development server bundle after the client build */
481
368
  standaloneDev?: boolean;
482
- /** Output filename for the standalone development server bundle (default: index.js) */
483
369
  standaloneDevOutFile?: string;
484
- /** Output filename for the standalone preview server bundle (default: index.js) */
485
370
  standalonePreviewOutFile?: string;
486
371
  }
487
372
  interface BuildResult {
488
- /** Output file path */
489
373
  outputPath: string;
490
- /** Build time in milliseconds */
491
374
  buildTime: number;
492
- /** Output file size in bytes */
493
375
  size: number;
494
376
  }
495
- interface PreviewOptions {
496
- /** Port to run the preview server on (default: 4173) */
497
- port?: number;
498
- /** Host to bind to (default: 'localhost') */
499
- host?: string;
500
- /** Domain to map (e.g., 'idevcoder.com') - redirects domain traffic to this server's port */
501
- domain?: string;
502
- /** Root directory to serve files from (default: dist or build.outDir) */
503
- root?: string;
504
- /** Base path for the application (e.g., '/app') */
505
- basePath?: string;
506
- /** Custom index file path (relative to root, e.g., './public/index.html') */
507
- index?: string;
508
- /** Array of client configurations - allows multiple clients on same port */
509
- clients?: ClientConfig[];
510
- /** Enable HTTPS (default: false) */
511
- https?: boolean;
512
- /** Open browser automatically (default: true) */
513
- open?: boolean;
514
- /** Enable logging (default: true) */
515
- logging?: boolean;
516
- /** API router for REST endpoints */
517
- api?: Router;
518
- /** WebSocket endpoints */
519
- ws?: WebSocketEndpointConfig[];
520
- /** SSR render function - returns HTML VNode or string */
521
- ssr?: () => Child | string;
522
- /** Proxy configuration for API requests */
523
- proxy?: ProxyConfig[];
524
- /** Global worker scripts (applies to all clients) */
525
- worker?: WorkerConfig[];
526
- /** Environment variables to inject (prefix with VITE_ for client access) */
527
- env?: Record<string, string>;
528
- /** Emit a bundled preview server during elit build */
529
- standalone?: boolean;
530
- /** Output filename for the standalone preview server bundle (default: index.js) */
531
- outFile?: string;
532
- }
377
+
533
378
  type TestEnvironment = 'node' | 'jsdom' | 'happy-dom' | 'edge-runtime';
534
379
  type TestCoverageProvider = 'v8' | 'istanbul';
535
380
  type TestCoverageReporter = 'text' | 'json' | 'html' | 'lcov' | 'lcovonly' | 'coverage-final.json' | 'clover';
@@ -583,4 +428,4 @@ interface TestOptions {
583
428
  env?: Record<string, string>;
584
429
  }
585
430
 
586
- export type { BuildOptions, BuildResult, Child, Children, ClientConfig, DevServer, DevServerOptions, ElementFactory, HMRMessage, JsonNode, PreviewOptions, Props, ProxyConfig, RefCallback, RefObject, Router, State, StateManager, StateOptions, TestCoverageOptions, TestCoverageProvider, TestCoverageReporter, TestEnvironment, TestOptions, VNode, VNodeJson, VirtualListController, WebSocketConnection, WebSocketEndpointConfig, WebSocketEndpointContext, WebSocketEndpointHandler, WebSocketRequest, WorkerConfig };
431
+ export { type BuildOptions, type BuildResult, Child, type ClientConfig, type DevServer, type DevServerOptions, type HMRMessage, type PreviewOptions, type ProxyConfig, type Router, type StateManager, type TestCoverageOptions, type TestCoverageProvider, type TestCoverageReporter, type TestEnvironment, type TestOptions, type WebSocketConnection, type WebSocketEndpointConfig, type WebSocketEndpointContext, type WebSocketEndpointHandler, type WebSocketRequest, type WorkerConfig };
@@ -17,7 +17,7 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // src/universal.ts
20
+ // src/shares/universal.ts
21
21
  var universal_exports = {};
22
22
  __export(universal_exports, {
23
23
  createUniversalBridgeProps: () => createUniversalBridgeProps,
@@ -1,8 +1,4 @@
1
- import { Props } from './types.js';
2
- import 'node:events';
3
- import 'events';
4
- import 'http';
5
- import 'ws';
1
+ import { P as Props } from './types-BONVzPtp.js';
6
2
 
7
3
  type UniversalPayload = string | number | boolean | null | UniversalPayload[] | {
8
4
  [key: string]: UniversalPayload;
package/dist/universal.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  (() => {
3
- // src/universal.ts
3
+ // src/shares/universal.ts
4
4
  function serializePayload(payload) {
5
5
  if (payload === void 0) return void 0;
6
6
  return JSON.stringify(payload);
@@ -1,4 +1,4 @@
1
- // src/universal.ts
1
+ // src/shares/universal.ts
2
2
  function serializePayload(payload) {
3
3
  if (payload === void 0) return void 0;
4
4
  return JSON.stringify(payload);
@@ -0,0 +1,119 @@
1
+ import { EventEmitter } from 'events';
2
+ import { I as IncomingMessage } from './types-DAisuVr5.js';
3
+
4
+ /**
5
+ * WebSocket ready state
6
+ */
7
+ declare enum ReadyState {
8
+ CONNECTING = 0,
9
+ OPEN = 1,
10
+ CLOSING = 2,
11
+ CLOSED = 3
12
+ }
13
+ /**
14
+ * WebSocket close codes
15
+ */
16
+ declare const CLOSE_CODES: {
17
+ readonly NORMAL: 1000;
18
+ readonly GOING_AWAY: 1001;
19
+ readonly PROTOCOL_ERROR: 1002;
20
+ readonly UNSUPPORTED_DATA: 1003;
21
+ readonly NO_STATUS: 1005;
22
+ readonly ABNORMAL: 1006;
23
+ readonly INVALID_DATA: 1007;
24
+ readonly POLICY_VIOLATION: 1008;
25
+ readonly MESSAGE_TOO_BIG: 1009;
26
+ readonly EXTENSION_REQUIRED: 1010;
27
+ readonly INTERNAL_ERROR: 1011;
28
+ readonly SERVICE_RESTART: 1012;
29
+ readonly TRY_AGAIN_LATER: 1013;
30
+ readonly BAD_GATEWAY: 1014;
31
+ readonly TLS_HANDSHAKE_FAIL: 1015;
32
+ };
33
+
34
+ /**
35
+ * WebSocket data types
36
+ */
37
+ type Data = string | Buffer | ArrayBuffer | Buffer[];
38
+ /**
39
+ * WebSocket send options
40
+ */
41
+ interface SendOptions {
42
+ binary?: boolean;
43
+ compress?: boolean;
44
+ fin?: boolean;
45
+ mask?: boolean;
46
+ }
47
+ /**
48
+ * Verify client callback
49
+ */
50
+ type VerifyClientCallback = (info: {
51
+ origin: string;
52
+ secure: boolean;
53
+ req: IncomingMessage;
54
+ }, callback?: (result: boolean, code?: number, message?: string) => void) => boolean | void;
55
+ /**
56
+ * WebSocket server options
57
+ */
58
+ interface ServerOptions {
59
+ host?: string;
60
+ port?: number;
61
+ backlog?: number;
62
+ server?: any;
63
+ verifyClient?: VerifyClientCallback;
64
+ handleProtocols?: (protocols: Set<string>, request: IncomingMessage) => string | false;
65
+ path?: string;
66
+ noServer?: boolean;
67
+ clientTracking?: boolean;
68
+ perMessageDeflate?: boolean | object;
69
+ maxPayload?: number;
70
+ }
71
+
72
+ /**
73
+ * WebSocket class.
74
+ */
75
+ declare class WebSocket extends EventEmitter {
76
+ readyState: ReadyState;
77
+ url: string;
78
+ protocol: string;
79
+ extensions: string;
80
+ binaryType: 'nodebuffer' | 'arraybuffer' | 'fragments';
81
+ /** @internal */
82
+ _socket: any;
83
+ constructor(address: string | URL, protocols?: string | string[], _options?: any);
84
+ private _setupNativeSocket;
85
+ /**
86
+ * Send data through WebSocket.
87
+ */
88
+ send(data: Data, options?: SendOptions | ((err?: Error) => void), callback?: (err?: Error) => void): void;
89
+ /**
90
+ * Close the WebSocket connection.
91
+ */
92
+ close(code?: number, reason?: string | Buffer): void;
93
+ /**
94
+ * Pause the socket (no-op for native WebSocket).
95
+ */
96
+ pause(): void;
97
+ /**
98
+ * Resume the socket (no-op for native WebSocket).
99
+ */
100
+ resume(): void;
101
+ /**
102
+ * Send a ping frame (no-op for native WebSocket).
103
+ */
104
+ ping(_data?: Data, _mask?: boolean, callback?: (err?: Error) => void): void;
105
+ /**
106
+ * Send a pong frame (no-op for native WebSocket).
107
+ */
108
+ pong(_data?: Data, _mask?: boolean, callback?: (err?: Error) => void): void;
109
+ /**
110
+ * Terminate the connection.
111
+ */
112
+ terminate(): void;
113
+ /**
114
+ * Get buffered amount.
115
+ */
116
+ get bufferedAmount(): number;
117
+ }
118
+
119
+ export { CLOSE_CODES as C, type Data as D, ReadyState as R, type ServerOptions as S, type VerifyClientCallback as V, WebSocket as W, type SendOptions as a };