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