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.
- package/dist/build.d.mts +20 -0
- package/dist/chokidar.d.mts +134 -0
- package/dist/cli.js +15 -1
- package/dist/dom.d.mts +87 -0
- package/dist/el.d.mts +207 -0
- package/dist/fs.d.mts +255 -0
- package/dist/hmr.d.mts +38 -0
- package/dist/http.d.mts +163 -0
- package/dist/https.d.mts +108 -0
- package/dist/index.d.mts +11 -0
- package/dist/mime-types.d.mts +48 -0
- package/dist/path.d.mts +163 -0
- package/dist/router.d.mts +47 -0
- package/dist/runtime.d.mts +97 -0
- package/dist/server-BgWmjg9q.d.mts +282 -0
- package/dist/server-CcEBQ7L6.d.ts +282 -0
- package/dist/server.d.mts +7 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +47 -5
- package/dist/server.mjs +47 -5
- package/dist/state.d.mts +111 -0
- package/dist/style.d.mts +159 -0
- package/dist/types.d.mts +446 -0
- package/dist/ws.d.mts +195 -0
- package/dist/wss.d.mts +108 -0
- package/package.json +1 -1
- package/src/server.ts +82 -8
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { IncomingMessage, ServerResponse } from './http.js';
|
|
2
|
+
import { WebSocket } from './ws.js';
|
|
3
|
+
import { Server } from 'http';
|
|
4
|
+
import { WebSocketServer } from 'ws';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Elit - Types and Interfaces
|
|
8
|
+
*/
|
|
9
|
+
interface VNode {
|
|
10
|
+
tagName: string;
|
|
11
|
+
props: Props;
|
|
12
|
+
children: Children;
|
|
13
|
+
}
|
|
14
|
+
type Child = VNode | string | number | boolean | null | undefined;
|
|
15
|
+
type Children = Child[];
|
|
16
|
+
interface Props {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
className?: string | string[];
|
|
19
|
+
class?: string | string[];
|
|
20
|
+
style?: Partial<CSSStyleDeclaration> | string;
|
|
21
|
+
dangerouslySetInnerHTML?: {
|
|
22
|
+
__html: string;
|
|
23
|
+
};
|
|
24
|
+
ref?: RefCallback | RefObject;
|
|
25
|
+
onClick?: (event: MouseEvent) => void;
|
|
26
|
+
onChange?: (event: Event) => void;
|
|
27
|
+
onInput?: (event: Event) => void;
|
|
28
|
+
onSubmit?: (event: Event) => void;
|
|
29
|
+
value?: string | number;
|
|
30
|
+
checked?: boolean;
|
|
31
|
+
}
|
|
32
|
+
type RefCallback = (element: HTMLElement | SVGElement) => void;
|
|
33
|
+
interface RefObject {
|
|
34
|
+
current: HTMLElement | SVGElement | null;
|
|
35
|
+
}
|
|
36
|
+
type Router = ServerRouter;
|
|
37
|
+
type StateManager$1 = StateManager;
|
|
38
|
+
interface ClientConfig {
|
|
39
|
+
/** Root directory to serve files from */
|
|
40
|
+
root: string;
|
|
41
|
+
/** Base path for the client application (e.g., '/app1', '/app2') */
|
|
42
|
+
basePath: string;
|
|
43
|
+
/** Custom index file path (relative to root, e.g., './public/index.html') */
|
|
44
|
+
index?: string;
|
|
45
|
+
/** SSR render function - returns HTML VNode or string */
|
|
46
|
+
ssr?: () => Child | string;
|
|
47
|
+
/** Watch patterns for file changes */
|
|
48
|
+
watch?: string[];
|
|
49
|
+
/** Ignore patterns for file watching */
|
|
50
|
+
ignore?: string[];
|
|
51
|
+
/** Proxy configuration specific to this client */
|
|
52
|
+
proxy?: ProxyConfig[];
|
|
53
|
+
/** Worker scripts specific to this client */
|
|
54
|
+
worker?: WorkerConfig[];
|
|
55
|
+
/** API router for REST endpoints specific to this client */
|
|
56
|
+
api?: Router;
|
|
57
|
+
/** Server mode: 'dev' uses source files, 'preview' uses built files (default: 'dev') */
|
|
58
|
+
mode?: 'dev' | 'preview';
|
|
59
|
+
}
|
|
60
|
+
interface ProxyConfig {
|
|
61
|
+
/** Path prefix to match for proxying (e.g., '/api', '/graphql') */
|
|
62
|
+
context: string;
|
|
63
|
+
/** Target URL to proxy to (e.g., 'http://localhost:8080') */
|
|
64
|
+
target: string;
|
|
65
|
+
/** Change the origin of the host header to the target URL */
|
|
66
|
+
changeOrigin?: boolean;
|
|
67
|
+
/** Rewrite path before sending to target */
|
|
68
|
+
pathRewrite?: Record<string, string>;
|
|
69
|
+
/** Additional headers to add to the proxied request */
|
|
70
|
+
headers?: Record<string, string>;
|
|
71
|
+
/** Enable WebSocket proxying */
|
|
72
|
+
ws?: boolean;
|
|
73
|
+
}
|
|
74
|
+
interface WorkerConfig {
|
|
75
|
+
/** Worker script path relative to root directory */
|
|
76
|
+
path: string;
|
|
77
|
+
/** Worker name/identifier (optional, defaults to filename) */
|
|
78
|
+
name?: string;
|
|
79
|
+
/** Worker type: 'module' (ESM) or 'classic' (default: 'module') */
|
|
80
|
+
type?: 'module' | 'classic';
|
|
81
|
+
}
|
|
82
|
+
interface DevServerOptions {
|
|
83
|
+
/** Port to run the server on (default: 3000) */
|
|
84
|
+
port?: number;
|
|
85
|
+
/** Host to bind to (default: 'localhost') */
|
|
86
|
+
host?: string;
|
|
87
|
+
/** Root directory to serve files from */
|
|
88
|
+
root?: string;
|
|
89
|
+
/** Base path for the client application (e.g., '/app1', '/app2') */
|
|
90
|
+
basePath?: string;
|
|
91
|
+
/** Custom index file path (relative to root, e.g., './public/index.html') */
|
|
92
|
+
index?: string;
|
|
93
|
+
/** Array of client configurations - allows multiple clients on same port */
|
|
94
|
+
clients?: ClientConfig[];
|
|
95
|
+
/** Enable HTTPS (default: false) */
|
|
96
|
+
https?: boolean;
|
|
97
|
+
/** Open browser automatically (default: true) */
|
|
98
|
+
open?: boolean;
|
|
99
|
+
/** Watch patterns for file changes */
|
|
100
|
+
watch?: string[];
|
|
101
|
+
/** Ignore patterns for file watcher */
|
|
102
|
+
ignore?: string[];
|
|
103
|
+
/** Global worker scripts (applies to all clients) */
|
|
104
|
+
worker?: WorkerConfig[];
|
|
105
|
+
/** Enable logging (default: true) */
|
|
106
|
+
logging?: boolean;
|
|
107
|
+
/** API router for REST endpoints */
|
|
108
|
+
api?: Router;
|
|
109
|
+
/** SSR render function - returns HTML VNode or string */
|
|
110
|
+
ssr?: () => Child | string;
|
|
111
|
+
/** Proxy configuration for API requests */
|
|
112
|
+
proxy?: ProxyConfig[];
|
|
113
|
+
/** Server mode: 'dev' uses source files, 'preview' uses built files (default: 'dev') */
|
|
114
|
+
mode?: 'dev' | 'preview';
|
|
115
|
+
}
|
|
116
|
+
interface DevServer {
|
|
117
|
+
/** HTTP server instance */
|
|
118
|
+
server: Server;
|
|
119
|
+
/** WebSocket server for HMR */
|
|
120
|
+
wss: WebSocketServer;
|
|
121
|
+
/** Server URL */
|
|
122
|
+
url: string;
|
|
123
|
+
/** Shared state manager */
|
|
124
|
+
state: StateManager$1;
|
|
125
|
+
/** Close the server */
|
|
126
|
+
close: () => Promise<void>;
|
|
127
|
+
}
|
|
128
|
+
interface BuildOptions {
|
|
129
|
+
/** Entry file to build */
|
|
130
|
+
entry: string;
|
|
131
|
+
/** Output directory */
|
|
132
|
+
outDir?: string;
|
|
133
|
+
/** Output filename */
|
|
134
|
+
outFile?: string;
|
|
135
|
+
/** Enable minification */
|
|
136
|
+
minify?: boolean;
|
|
137
|
+
/** Generate sourcemap */
|
|
138
|
+
sourcemap?: boolean;
|
|
139
|
+
/** Target environment */
|
|
140
|
+
target?: 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'es2021' | 'es2022' | 'esnext';
|
|
141
|
+
/** Output format */
|
|
142
|
+
format?: 'esm' | 'cjs' | 'iife';
|
|
143
|
+
/** Global name for IIFE format */
|
|
144
|
+
globalName?: string;
|
|
145
|
+
/** Target platform */
|
|
146
|
+
platform?: 'browser' | 'node' | 'neutral';
|
|
147
|
+
/** Base path for the application (injected into HTML) */
|
|
148
|
+
basePath?: string;
|
|
149
|
+
/** External dependencies (not bundled) */
|
|
150
|
+
external?: string[];
|
|
151
|
+
/** Enable tree shaking */
|
|
152
|
+
treeshake?: boolean;
|
|
153
|
+
/** Enable logging */
|
|
154
|
+
logging?: boolean;
|
|
155
|
+
/** Environment variables to inject (prefix with VITE_ for client access) */
|
|
156
|
+
env?: Record<string, string>;
|
|
157
|
+
/** Copy static files after build */
|
|
158
|
+
copy?: Array<{
|
|
159
|
+
from: string;
|
|
160
|
+
to: string;
|
|
161
|
+
transform?: (content: string, config: BuildOptions) => string;
|
|
162
|
+
}>;
|
|
163
|
+
/** Post-build hook */
|
|
164
|
+
onBuildEnd?: (result: BuildResult) => void | Promise<void>;
|
|
165
|
+
}
|
|
166
|
+
interface BuildResult {
|
|
167
|
+
/** Output file path */
|
|
168
|
+
outputPath: string;
|
|
169
|
+
/** Build time in milliseconds */
|
|
170
|
+
buildTime: number;
|
|
171
|
+
/** Output file size in bytes */
|
|
172
|
+
size: number;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Development server with HMR support
|
|
177
|
+
* Cross-runtime transpilation support
|
|
178
|
+
* - Node.js: uses esbuild
|
|
179
|
+
* - Bun: uses Bun.Transpiler
|
|
180
|
+
* - Deno: uses Deno.emit
|
|
181
|
+
*/
|
|
182
|
+
|
|
183
|
+
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS' | 'HEAD';
|
|
184
|
+
interface ServerRouteContext {
|
|
185
|
+
req: IncomingMessage;
|
|
186
|
+
res: ServerResponse;
|
|
187
|
+
params: Record<string, string>;
|
|
188
|
+
query: Record<string, string>;
|
|
189
|
+
body: any;
|
|
190
|
+
headers: Record<string, string | string[] | undefined>;
|
|
191
|
+
}
|
|
192
|
+
type ServerRouteHandler = (ctx: ServerRouteContext) => void | Promise<void>;
|
|
193
|
+
type Middleware = (ctx: ServerRouteContext, next: () => Promise<void>) => void | Promise<void>;
|
|
194
|
+
declare class ServerRouter {
|
|
195
|
+
private routes;
|
|
196
|
+
private middlewares;
|
|
197
|
+
use(middleware: Middleware): this;
|
|
198
|
+
get: (path: string, handler: ServerRouteHandler) => this;
|
|
199
|
+
post: (path: string, handler: ServerRouteHandler) => this;
|
|
200
|
+
put: (path: string, handler: ServerRouteHandler) => this;
|
|
201
|
+
delete: (path: string, handler: ServerRouteHandler) => this;
|
|
202
|
+
patch: (path: string, handler: ServerRouteHandler) => this;
|
|
203
|
+
options: (path: string, handler: ServerRouteHandler) => this;
|
|
204
|
+
private addRoute;
|
|
205
|
+
private pathToRegex;
|
|
206
|
+
private parseQuery;
|
|
207
|
+
private parseBody;
|
|
208
|
+
handle(req: IncomingMessage, res: ServerResponse): Promise<boolean>;
|
|
209
|
+
}
|
|
210
|
+
declare const json: (res: ServerResponse, data: any, status?: number) => ServerResponse;
|
|
211
|
+
declare const text: (res: ServerResponse, data: string, status?: number) => ServerResponse;
|
|
212
|
+
declare const html: (res: ServerResponse, data: string, status?: number) => ServerResponse;
|
|
213
|
+
declare const status: (res: ServerResponse, code: number, message?: string) => ServerResponse;
|
|
214
|
+
/**
|
|
215
|
+
* Clear import map cache (useful when packages are added/removed)
|
|
216
|
+
*/
|
|
217
|
+
declare function clearImportMapCache(): void;
|
|
218
|
+
declare function cors(options?: {
|
|
219
|
+
origin?: string | string[];
|
|
220
|
+
methods?: string[];
|
|
221
|
+
credentials?: boolean;
|
|
222
|
+
maxAge?: number;
|
|
223
|
+
}): Middleware;
|
|
224
|
+
declare function logger(options?: {
|
|
225
|
+
format?: 'simple' | 'detailed';
|
|
226
|
+
}): Middleware;
|
|
227
|
+
declare function errorHandler(): Middleware;
|
|
228
|
+
declare function rateLimit(options?: {
|
|
229
|
+
windowMs?: number;
|
|
230
|
+
max?: number;
|
|
231
|
+
message?: string;
|
|
232
|
+
}): Middleware;
|
|
233
|
+
declare function bodyLimit(options?: {
|
|
234
|
+
limit?: number;
|
|
235
|
+
}): Middleware;
|
|
236
|
+
declare function cacheControl(options?: {
|
|
237
|
+
maxAge?: number;
|
|
238
|
+
public?: boolean;
|
|
239
|
+
}): Middleware;
|
|
240
|
+
declare function compress(): Middleware;
|
|
241
|
+
declare function security(): Middleware;
|
|
242
|
+
declare function createProxyHandler(proxyConfigs: ProxyConfig[]): (req: IncomingMessage, res: ServerResponse) => Promise<boolean>;
|
|
243
|
+
type StateChangeHandler<T = any> = (value: T, oldValue: T) => void;
|
|
244
|
+
interface SharedStateOptions<T = any> {
|
|
245
|
+
initial: T;
|
|
246
|
+
persist?: boolean;
|
|
247
|
+
validate?: (value: T) => boolean;
|
|
248
|
+
}
|
|
249
|
+
declare class SharedState<T = any> {
|
|
250
|
+
readonly key: string;
|
|
251
|
+
private _value;
|
|
252
|
+
private listeners;
|
|
253
|
+
private changeHandlers;
|
|
254
|
+
private options;
|
|
255
|
+
constructor(key: string, options: SharedStateOptions<T>);
|
|
256
|
+
get value(): T;
|
|
257
|
+
set value(newValue: T);
|
|
258
|
+
update(updater: (current: T) => T): void;
|
|
259
|
+
subscribe(ws: WebSocket): void;
|
|
260
|
+
unsubscribe(ws: WebSocket): void;
|
|
261
|
+
onChange(handler: StateChangeHandler<T>): () => void;
|
|
262
|
+
private broadcast;
|
|
263
|
+
private sendTo;
|
|
264
|
+
get subscriberCount(): number;
|
|
265
|
+
clear(): void;
|
|
266
|
+
}
|
|
267
|
+
declare class StateManager {
|
|
268
|
+
private states;
|
|
269
|
+
create<T>(key: string, options: SharedStateOptions<T>): SharedState<T>;
|
|
270
|
+
get<T>(key: string): SharedState<T> | undefined;
|
|
271
|
+
has(key: string): boolean;
|
|
272
|
+
delete(key: string): boolean;
|
|
273
|
+
subscribe(key: string, ws: WebSocket): void;
|
|
274
|
+
unsubscribe(key: string, ws: WebSocket): void;
|
|
275
|
+
unsubscribeAll(ws: WebSocket): void;
|
|
276
|
+
handleStateChange(key: string, value: any): void;
|
|
277
|
+
keys(): string[];
|
|
278
|
+
clear(): void;
|
|
279
|
+
}
|
|
280
|
+
declare function createDevServer(options: DevServerOptions): DevServer;
|
|
281
|
+
|
|
282
|
+
export { type BuildOptions as B, type HttpMethod as H, type Middleware as M, type ServerRouteContext as S, type BuildResult as a, type ServerRouteHandler as b, ServerRouter as c, clearImportMapCache as d, cors as e, errorHandler as f, bodyLimit as g, html as h, cacheControl as i, json as j, compress as k, logger as l, security as m, createProxyHandler as n, type StateChangeHandler as o, type SharedStateOptions as p, SharedState as q, rateLimit as r, status as s, text as t, StateManager as u, createDevServer as v };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import './http.mjs';
|
|
2
|
+
import './ws.mjs';
|
|
3
|
+
export { H as HttpMethod, M as Middleware, S as ServerRouteContext, b as ServerRouteHandler, c as ServerRouter, q as SharedState, p as SharedStateOptions, o as StateChangeHandler, u as StateManager, g as bodyLimit, i as cacheControl, d as clearImportMapCache, k as compress, e as cors, v as createDevServer, n as createProxyHandler, f as errorHandler, h as html, j as json, l as logger, r as rateLimit, m as security, s as status, t as text } from './server-BgWmjg9q.mjs';
|
|
4
|
+
import 'node:events';
|
|
5
|
+
import 'events';
|
|
6
|
+
import 'http';
|
|
7
|
+
import 'ws';
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAgB,eAAe,EAAE,cAAc,EAA0B,MAAM,QAAQ,CAAC;AAE/F,OAAO,EAAmB,SAAS,EAAc,MAAM,MAAM,CAAC;AAM9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAA4B,WAAW,EAAE,MAAM,SAAS,CAAC;AAKlG,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAE1F,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,eAAe,CAAC;IACrB,GAAG,EAAE,cAAc,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAA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AAC,EAAE,EAAE,SAAS,GAAG,IAAI;IAK9B,WAAW,CAAC,EAAE,EAAE,SAAS,GAAG,IAAI;IAIhC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI;IAKpD,OAAO,CAAC,SAAS;IAKjB,OAAO,CAAC,MAAM;IAMd,IAAI,eAAe,IAAI,MAAM,CAE5B;IAED,KAAK,IAAI,IAAI;CAId;AAED,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAuC;IAErD,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC;IAOtE,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS;IAI/C,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIzB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAS5B,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,GAAG,IAAI;IAI3C,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,GAAG,IAAI;IAI7C,cAAc,CAAC,EAAE,EAAE,SAAS,GAAG,IAAI;IAInC,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;IAKhD,IAAI,IAAI,MAAM,EAAE;IAIhB,KAAK,IAAI,IAAI;CAId;AA0BD,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,SAAS,CAyuBpE"}
|
package/dist/server.js
CHANGED
|
@@ -2691,11 +2691,42 @@ var ServerRouter = class {
|
|
|
2691
2691
|
});
|
|
2692
2692
|
return query;
|
|
2693
2693
|
}
|
|
2694
|
-
parseBody(req) {
|
|
2694
|
+
async parseBody(req) {
|
|
2695
|
+
if (typeof req.text === "function") {
|
|
2696
|
+
try {
|
|
2697
|
+
const text2 = await req.text();
|
|
2698
|
+
if (!text2) return {};
|
|
2699
|
+
const contentType = req.headers["content-type"];
|
|
2700
|
+
const ct = (Array.isArray(contentType) ? contentType[0] : contentType || "").toLowerCase();
|
|
2701
|
+
if (ct.includes("application/json") || ct.includes("json") || text2.trim().startsWith("{") || text2.trim().startsWith("[")) {
|
|
2702
|
+
try {
|
|
2703
|
+
return JSON.parse(text2);
|
|
2704
|
+
} catch {
|
|
2705
|
+
return text2;
|
|
2706
|
+
}
|
|
2707
|
+
}
|
|
2708
|
+
if (ct.includes("application/x-www-form-urlencoded") || ct.includes("urlencoded")) {
|
|
2709
|
+
return Object.fromEntries(new URLSearchParams(text2));
|
|
2710
|
+
}
|
|
2711
|
+
return text2;
|
|
2712
|
+
} catch (e) {
|
|
2713
|
+
console.log("[ServerRouter] Bun body parse error:", e);
|
|
2714
|
+
return {};
|
|
2715
|
+
}
|
|
2716
|
+
}
|
|
2695
2717
|
return new Promise((resolve2, reject) => {
|
|
2696
|
-
|
|
2697
|
-
|
|
2718
|
+
const contentLengthHeader = req.headers["content-length"];
|
|
2719
|
+
const contentLength = parseInt(Array.isArray(contentLengthHeader) ? contentLengthHeader[0] : contentLengthHeader || "0", 10);
|
|
2720
|
+
if (contentLength === 0) {
|
|
2721
|
+
resolve2({});
|
|
2722
|
+
return;
|
|
2723
|
+
}
|
|
2724
|
+
const chunks = [];
|
|
2725
|
+
req.on("data", (chunk) => {
|
|
2726
|
+
chunks.push(Buffer.from(chunk));
|
|
2727
|
+
});
|
|
2698
2728
|
req.on("end", () => {
|
|
2729
|
+
const body = Buffer.concat(chunks).toString();
|
|
2699
2730
|
try {
|
|
2700
2731
|
const ct = req.headers["content-type"] || "";
|
|
2701
2732
|
resolve2(ct.includes("json") ? body ? JSON.parse(body) : {} : ct.includes("urlencoded") ? Object.fromEntries(new URLSearchParams(body)) : body);
|
|
@@ -2716,7 +2747,7 @@ var ServerRouter = class {
|
|
|
2716
2747
|
if (["POST", "PUT", "PATCH"].includes(method)) {
|
|
2717
2748
|
try {
|
|
2718
2749
|
body = await this.parseBody(req);
|
|
2719
|
-
} catch {
|
|
2750
|
+
} catch (e) {
|
|
2720
2751
|
res.writeHead(400, { "Content-Type": "application/json" });
|
|
2721
2752
|
res.end('{"error":"Invalid request body"}');
|
|
2722
2753
|
return true;
|
|
@@ -2729,7 +2760,7 @@ var ServerRouter = class {
|
|
|
2729
2760
|
await next();
|
|
2730
2761
|
await route.handler(ctx);
|
|
2731
2762
|
} catch (e) {
|
|
2732
|
-
console.error("Route error:", e);
|
|
2763
|
+
console.error("[ServerRouter] Route error:", e);
|
|
2733
2764
|
!res.headersSent && (res.writeHead(500, { "Content-Type": "application/json" }), res.end(JSON.stringify({ error: "Internal Server Error", message: e instanceof Error ? e.message : "Unknown" })));
|
|
2734
2765
|
}
|
|
2735
2766
|
return true;
|
|
@@ -3310,6 +3341,9 @@ function createDevServer(options) {
|
|
|
3310
3341
|
const config = { ...defaultOptions, ...options };
|
|
3311
3342
|
const wsClients = /* @__PURE__ */ new Set();
|
|
3312
3343
|
const stateManager = new StateManager();
|
|
3344
|
+
if (config.mode === "dev") {
|
|
3345
|
+
clearImportMapCache();
|
|
3346
|
+
}
|
|
3313
3347
|
const clientsToNormalize = config.clients?.length ? config.clients : config.root ? [{ root: config.root, basePath: config.basePath || "", index: config.index, ssr: config.ssr, api: config.api, proxy: config.proxy, mode: config.mode }] : null;
|
|
3314
3348
|
if (!clientsToNormalize) throw new Error('DevServerOptions must include either "clients" array or "root" directory');
|
|
3315
3349
|
const normalizedClients = clientsToNormalize.map((client) => {
|
|
@@ -3372,6 +3406,14 @@ function createDevServer(options) {
|
|
|
3372
3406
|
const handled = await config.api.handle(req, res);
|
|
3373
3407
|
if (handled) return;
|
|
3374
3408
|
}
|
|
3409
|
+
if (url.startsWith("/api") && ["POST", "PUT", "PATCH", "DELETE"].includes(req.method || "")) {
|
|
3410
|
+
if (!res.headersSent) {
|
|
3411
|
+
if (config.logging) console.log(`[405] ${req.method} ${url} - Method not allowed`);
|
|
3412
|
+
res.writeHead(405, { "Content-Type": "application/json" });
|
|
3413
|
+
res.end(JSON.stringify({ error: "Method Not Allowed", message: "No API route found for this request" }));
|
|
3414
|
+
}
|
|
3415
|
+
return;
|
|
3416
|
+
}
|
|
3375
3417
|
let filePath;
|
|
3376
3418
|
if (url === "/" && matchedClient.ssr && !matchedClient.index) {
|
|
3377
3419
|
return await serveSSR(res, matchedClient);
|
package/dist/server.mjs
CHANGED
|
@@ -2665,11 +2665,42 @@ var ServerRouter = class {
|
|
|
2665
2665
|
});
|
|
2666
2666
|
return query;
|
|
2667
2667
|
}
|
|
2668
|
-
parseBody(req) {
|
|
2668
|
+
async parseBody(req) {
|
|
2669
|
+
if (typeof req.text === "function") {
|
|
2670
|
+
try {
|
|
2671
|
+
const text2 = await req.text();
|
|
2672
|
+
if (!text2) return {};
|
|
2673
|
+
const contentType = req.headers["content-type"];
|
|
2674
|
+
const ct = (Array.isArray(contentType) ? contentType[0] : contentType || "").toLowerCase();
|
|
2675
|
+
if (ct.includes("application/json") || ct.includes("json") || text2.trim().startsWith("{") || text2.trim().startsWith("[")) {
|
|
2676
|
+
try {
|
|
2677
|
+
return JSON.parse(text2);
|
|
2678
|
+
} catch {
|
|
2679
|
+
return text2;
|
|
2680
|
+
}
|
|
2681
|
+
}
|
|
2682
|
+
if (ct.includes("application/x-www-form-urlencoded") || ct.includes("urlencoded")) {
|
|
2683
|
+
return Object.fromEntries(new URLSearchParams(text2));
|
|
2684
|
+
}
|
|
2685
|
+
return text2;
|
|
2686
|
+
} catch (e) {
|
|
2687
|
+
console.log("[ServerRouter] Bun body parse error:", e);
|
|
2688
|
+
return {};
|
|
2689
|
+
}
|
|
2690
|
+
}
|
|
2669
2691
|
return new Promise((resolve2, reject) => {
|
|
2670
|
-
|
|
2671
|
-
|
|
2692
|
+
const contentLengthHeader = req.headers["content-length"];
|
|
2693
|
+
const contentLength = parseInt(Array.isArray(contentLengthHeader) ? contentLengthHeader[0] : contentLengthHeader || "0", 10);
|
|
2694
|
+
if (contentLength === 0) {
|
|
2695
|
+
resolve2({});
|
|
2696
|
+
return;
|
|
2697
|
+
}
|
|
2698
|
+
const chunks = [];
|
|
2699
|
+
req.on("data", (chunk) => {
|
|
2700
|
+
chunks.push(Buffer.from(chunk));
|
|
2701
|
+
});
|
|
2672
2702
|
req.on("end", () => {
|
|
2703
|
+
const body = Buffer.concat(chunks).toString();
|
|
2673
2704
|
try {
|
|
2674
2705
|
const ct = req.headers["content-type"] || "";
|
|
2675
2706
|
resolve2(ct.includes("json") ? body ? JSON.parse(body) : {} : ct.includes("urlencoded") ? Object.fromEntries(new URLSearchParams(body)) : body);
|
|
@@ -2690,7 +2721,7 @@ var ServerRouter = class {
|
|
|
2690
2721
|
if (["POST", "PUT", "PATCH"].includes(method)) {
|
|
2691
2722
|
try {
|
|
2692
2723
|
body = await this.parseBody(req);
|
|
2693
|
-
} catch {
|
|
2724
|
+
} catch (e) {
|
|
2694
2725
|
res.writeHead(400, { "Content-Type": "application/json" });
|
|
2695
2726
|
res.end('{"error":"Invalid request body"}');
|
|
2696
2727
|
return true;
|
|
@@ -2703,7 +2734,7 @@ var ServerRouter = class {
|
|
|
2703
2734
|
await next();
|
|
2704
2735
|
await route.handler(ctx);
|
|
2705
2736
|
} catch (e) {
|
|
2706
|
-
console.error("Route error:", e);
|
|
2737
|
+
console.error("[ServerRouter] Route error:", e);
|
|
2707
2738
|
!res.headersSent && (res.writeHead(500, { "Content-Type": "application/json" }), res.end(JSON.stringify({ error: "Internal Server Error", message: e instanceof Error ? e.message : "Unknown" })));
|
|
2708
2739
|
}
|
|
2709
2740
|
return true;
|
|
@@ -3284,6 +3315,9 @@ function createDevServer(options) {
|
|
|
3284
3315
|
const config = { ...defaultOptions, ...options };
|
|
3285
3316
|
const wsClients = /* @__PURE__ */ new Set();
|
|
3286
3317
|
const stateManager = new StateManager();
|
|
3318
|
+
if (config.mode === "dev") {
|
|
3319
|
+
clearImportMapCache();
|
|
3320
|
+
}
|
|
3287
3321
|
const clientsToNormalize = config.clients?.length ? config.clients : config.root ? [{ root: config.root, basePath: config.basePath || "", index: config.index, ssr: config.ssr, api: config.api, proxy: config.proxy, mode: config.mode }] : null;
|
|
3288
3322
|
if (!clientsToNormalize) throw new Error('DevServerOptions must include either "clients" array or "root" directory');
|
|
3289
3323
|
const normalizedClients = clientsToNormalize.map((client) => {
|
|
@@ -3346,6 +3380,14 @@ function createDevServer(options) {
|
|
|
3346
3380
|
const handled = await config.api.handle(req, res);
|
|
3347
3381
|
if (handled) return;
|
|
3348
3382
|
}
|
|
3383
|
+
if (url.startsWith("/api") && ["POST", "PUT", "PATCH", "DELETE"].includes(req.method || "")) {
|
|
3384
|
+
if (!res.headersSent) {
|
|
3385
|
+
if (config.logging) console.log(`[405] ${req.method} ${url} - Method not allowed`);
|
|
3386
|
+
res.writeHead(405, { "Content-Type": "application/json" });
|
|
3387
|
+
res.end(JSON.stringify({ error: "Method Not Allowed", message: "No API route found for this request" }));
|
|
3388
|
+
}
|
|
3389
|
+
return;
|
|
3390
|
+
}
|
|
3349
3391
|
let filePath;
|
|
3350
3392
|
if (url === "/" && matchedClient.ssr && !matchedClient.index) {
|
|
3351
3393
|
return await serveSSR(res, matchedClient);
|
package/dist/state.d.mts
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { StateOptions, State, VNode, VirtualListController, Child, Props } from './types.mjs';
|
|
2
|
+
import 'node:events';
|
|
3
|
+
import 'events';
|
|
4
|
+
import 'http';
|
|
5
|
+
import 'ws';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Elit - State Management
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
declare const createState: <T>(initial: T, options?: StateOptions) => State<T>;
|
|
12
|
+
declare const computed: <T extends any[], R>(states: { [K in keyof T]: State<T[K]>; }, fn: (...values: T) => R) => State<R>;
|
|
13
|
+
declare const effect: (fn: () => void) => void;
|
|
14
|
+
declare const batchRender: (container: string | HTMLElement, vNodes: VNode[]) => HTMLElement;
|
|
15
|
+
declare const renderChunked: (container: string | HTMLElement, vNodes: VNode[], chunkSize?: number, onProgress?: (current: number, total: number) => void) => HTMLElement;
|
|
16
|
+
declare const createVirtualList: <T>(container: HTMLElement, items: T[], renderItem: (item: T, index: number) => VNode, itemHeight?: number, bufferSize?: number) => VirtualListController;
|
|
17
|
+
declare const lazy: <T extends any[], R>(loadFn: () => Promise<(...args: T) => R>) => (...args: T) => Promise<VNode | R>;
|
|
18
|
+
declare const cleanupUnused: (root: HTMLElement) => number;
|
|
19
|
+
declare const throttle: <T extends any[]>(fn: (...args: T) => void, delay: number) => (...args: T) => void;
|
|
20
|
+
declare const debounce: <T extends any[]>(fn: (...args: T) => void, delay: number) => (...args: T) => void;
|
|
21
|
+
type StateChangeCallback<T = any> = (value: T, oldValue: T) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Shared State - syncs with elit-server
|
|
24
|
+
*/
|
|
25
|
+
declare class SharedState<T = any> {
|
|
26
|
+
readonly key: string;
|
|
27
|
+
private wsUrl?;
|
|
28
|
+
private localState;
|
|
29
|
+
private ws;
|
|
30
|
+
private pendingUpdates;
|
|
31
|
+
private previousValue;
|
|
32
|
+
constructor(key: string, defaultValue: T, wsUrl?: string | undefined);
|
|
33
|
+
/**
|
|
34
|
+
* Get current value
|
|
35
|
+
*/
|
|
36
|
+
get value(): T;
|
|
37
|
+
/**
|
|
38
|
+
* Set new value and sync to server
|
|
39
|
+
*/
|
|
40
|
+
set value(newValue: T);
|
|
41
|
+
/**
|
|
42
|
+
* Get the underlying Elit State (for reactive binding)
|
|
43
|
+
*/
|
|
44
|
+
get state(): State<T>;
|
|
45
|
+
/**
|
|
46
|
+
* Subscribe to changes (returns Elit State for reactive)
|
|
47
|
+
*/
|
|
48
|
+
onChange(callback: StateChangeCallback<T>): () => void;
|
|
49
|
+
/**
|
|
50
|
+
* Update value using a function
|
|
51
|
+
*/
|
|
52
|
+
update(updater: (current: T) => T): void;
|
|
53
|
+
/**
|
|
54
|
+
* Connect to WebSocket
|
|
55
|
+
*/
|
|
56
|
+
private connect;
|
|
57
|
+
/**
|
|
58
|
+
* Subscribe to server state
|
|
59
|
+
*/
|
|
60
|
+
private subscribe;
|
|
61
|
+
/**
|
|
62
|
+
* Handle message from server
|
|
63
|
+
*/
|
|
64
|
+
private handleMessage;
|
|
65
|
+
/**
|
|
66
|
+
* Send value to server
|
|
67
|
+
*/
|
|
68
|
+
private sendToServer;
|
|
69
|
+
/**
|
|
70
|
+
* Disconnect
|
|
71
|
+
*/
|
|
72
|
+
disconnect(): void;
|
|
73
|
+
/**
|
|
74
|
+
* Destroy state and cleanup
|
|
75
|
+
*/
|
|
76
|
+
destroy(): void;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Create a shared state that syncs with elit-server
|
|
80
|
+
*/
|
|
81
|
+
declare function createSharedState<T>(key: string, defaultValue: T, wsUrl?: string): SharedState<T>;
|
|
82
|
+
/**
|
|
83
|
+
* Shared State Manager for managing multiple shared states
|
|
84
|
+
*/
|
|
85
|
+
declare class SharedStateManager {
|
|
86
|
+
private states;
|
|
87
|
+
/**
|
|
88
|
+
* Create or get a shared state
|
|
89
|
+
*/
|
|
90
|
+
create<T>(key: string, defaultValue: T, wsUrl?: string): SharedState<T>;
|
|
91
|
+
/**
|
|
92
|
+
* Get existing state
|
|
93
|
+
*/
|
|
94
|
+
get<T>(key: string): SharedState<T> | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* Delete a state
|
|
97
|
+
*/
|
|
98
|
+
delete(key: string): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Clear all states
|
|
101
|
+
*/
|
|
102
|
+
clear(): void;
|
|
103
|
+
}
|
|
104
|
+
declare const sharedStateManager: SharedStateManager;
|
|
105
|
+
declare const reactive: <T>(state: State<T>, renderFn: (value: T) => VNode | Child) => VNode;
|
|
106
|
+
declare const reactiveAs: <T>(tagName: string, state: State<T>, renderFn: (value: T) => VNode | Child, props?: Props) => VNode;
|
|
107
|
+
declare const text: (state: State<any> | any) => VNode | string;
|
|
108
|
+
declare const bindValue: <T extends string | number>(state: State<T>) => Props;
|
|
109
|
+
declare const bindChecked: (state: State<boolean>) => Props;
|
|
110
|
+
|
|
111
|
+
export { SharedState, batchRender, bindChecked, bindValue, cleanupUnused, computed, createSharedState, createState, createVirtualList, debounce, effect, lazy, reactive, reactiveAs, renderChunked, sharedStateManager, text, throttle };
|