elit 3.6.7 → 3.6.9

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 (42) hide show
  1. package/Cargo.lock +1 -1
  2. package/Cargo.toml +1 -1
  3. package/README.md +20 -1
  4. package/dist/cli.cjs +2777 -321
  5. package/dist/cli.mjs +2764 -308
  6. package/dist/config.d.ts +6 -6
  7. package/dist/{contracts-BeW9k0yZ.d.ts → contracts-_0p1-15U.d.ts} +1 -1
  8. package/dist/coverage.d.ts +1 -1
  9. package/dist/dev-build.d.ts +3 -3
  10. package/dist/http.cjs +160 -41
  11. package/dist/http.d.ts +5 -11
  12. package/dist/http.js +160 -41
  13. package/dist/http.mjs +160 -41
  14. package/dist/https.cjs +194 -46
  15. package/dist/https.d.ts +3 -6
  16. package/dist/https.js +194 -46
  17. package/dist/https.mjs +194 -46
  18. package/dist/pm-node-shared-listener-bootstrap.cjs +75 -0
  19. package/dist/pm.cjs +2390 -160
  20. package/dist/pm.d.ts +83 -8
  21. package/dist/pm.js +2388 -188
  22. package/dist/pm.mjs +2380 -165
  23. package/dist/preview-build.d.ts +3 -3
  24. package/dist/server.cjs +417 -168
  25. package/dist/server.d.ts +4 -4
  26. package/dist/server.js +453 -179
  27. package/dist/server.mjs +417 -168
  28. package/dist/smtp-server.js +37 -12
  29. package/dist/test-reporter.d.ts +1 -1
  30. package/dist/test-runtime.d.ts +1 -1
  31. package/dist/{types-tJn88E1N.d.ts → types-BayMVo_k.d.ts} +39 -3
  32. package/dist/{types-CIhpN1-K.d.ts → types-C70T-42Z.d.ts} +1 -1
  33. package/dist/{types-DAisuVr5.d.ts → types-DPOgoGs-.d.ts} +7 -1
  34. package/dist/{state-DvEkDehk.d.ts → types-fiLday0L.d.ts} +96 -92
  35. package/dist/types.d.ts +4 -0
  36. package/dist/{websocket-XfyK23zD.d.ts → websocket-BLBEAnhp.d.ts} +1 -1
  37. package/dist/ws.d.ts +3 -3
  38. package/dist/wss.cjs +194 -46
  39. package/dist/wss.d.ts +3 -3
  40. package/dist/wss.js +194 -46
  41. package/dist/wss.mjs +194 -46
  42. package/package.json +11 -6
@@ -2805,12 +2805,12 @@
2805
2805
  "node_modules/nodemailer/package.json"(exports, module) {
2806
2806
  module.exports = {
2807
2807
  name: "nodemailer",
2808
- version: "8.0.5",
2808
+ version: "8.0.10",
2809
2809
  description: "Easy as cake e-mail sending from your Node.js applications",
2810
2810
  main: "lib/nodemailer.js",
2811
2811
  scripts: {
2812
- test: "node --test --test-concurrency=1 test/**/*.test.js test/**/*-test.js",
2813
- "test:coverage": "c8 node --test --test-concurrency=1 test/**/*.test.js test/**/*-test.js",
2812
+ test: "node --test --test-concurrency=1 $(find test \\( -name '*-test.js' -o -name '*.test.js' \\))",
2813
+ "test:coverage": "c8 node --test --test-concurrency=1 $(find test \\( -name '*-test.js' -o -name '*.test.js' \\))",
2814
2814
  format: 'prettier --write "**/*.{js,json,md}"',
2815
2815
  "format:check": 'prettier --check "**/*.{js,json,md}"',
2816
2816
  lint: "eslint .",
@@ -2832,20 +2832,19 @@
2832
2832
  },
2833
2833
  homepage: "https://nodemailer.com/",
2834
2834
  devDependencies: {
2835
- "@aws-sdk/client-sesv2": "3.1025.0",
2835
+ "@aws-sdk/client-sesv2": "3.1037.0",
2836
2836
  bunyan: "1.8.15",
2837
2837
  c8: "11.0.0",
2838
- eslint: "10.2.0",
2838
+ eslint: "10.2.1",
2839
2839
  "eslint-config-prettier": "10.1.8",
2840
- globals: "17.4.0",
2840
+ globals: "17.5.0",
2841
2841
  libbase64: "1.3.0",
2842
- libmime: "5.3.7",
2842
+ libmime: "5.3.8",
2843
2843
  libqp: "2.1.1",
2844
- "nodemailer-ntlm-auth": "1.0.4",
2845
- prettier: "3.8.1",
2844
+ prettier: "3.8.3",
2846
2845
  proxy: "1.0.2",
2847
2846
  "proxy-test-server": "1.0.0",
2848
- "smtp-server": "3.18.3"
2847
+ "smtp-server": "3.18.4"
2849
2848
  },
2850
2849
  engines: {
2851
2850
  node: ">=6.0.0"
@@ -3140,6 +3139,7 @@
3140
3139
  var util = __require("util");
3141
3140
  var fs = __require("fs");
3142
3141
  var nmfetch = require_fetch();
3142
+ var errors2 = require_errors();
3143
3143
  var dns = __require("dns");
3144
3144
  var net = __require("net");
3145
3145
  var os = __require("os");
@@ -3420,7 +3420,13 @@
3420
3420
  module.exports._logFunc = (logger, level, defaults, data, message, ...args) => {
3421
3421
  const entry = Object.assign({}, defaults || {}, data || {});
3422
3422
  delete entry.level;
3423
- logger[level](entry, message, ...args);
3423
+ let logLevel = level;
3424
+ if (typeof logger[logLevel] !== "function") {
3425
+ logLevel = ["info", "debug", "log", "trace", "warn", "error"].find((name) => typeof logger[name] === "function");
3426
+ }
3427
+ if (logLevel) {
3428
+ logger[logLevel](entry, message, ...args);
3429
+ }
3424
3430
  };
3425
3431
  module.exports.getLogger = (options, defaults) => {
3426
3432
  options = options || {};
@@ -3505,7 +3511,12 @@
3505
3511
  params
3506
3512
  };
3507
3513
  };
3508
- module.exports.resolveContent = (data, key, callback) => {
3514
+ module.exports.resolveContent = (data, key, options, callback) => {
3515
+ if (!callback && typeof options === "function") {
3516
+ callback = options;
3517
+ options = false;
3518
+ }
3519
+ options = options || {};
3509
3520
  let promise;
3510
3521
  if (!callback) {
3511
3522
  promise = new Promise((resolve2, reject) => {
@@ -3531,6 +3542,13 @@
3531
3542
  callback(null, value);
3532
3543
  });
3533
3544
  } else if (/^https?:\/\//i.test(content.path || content.href)) {
3545
+ if (options.disableUrlAccess) {
3546
+ return setImmediate(() => {
3547
+ const err = new Error("Url access rejected for " + (content.path || content.href));
3548
+ err.code = errors2.EURLACCESS;
3549
+ callback(err);
3550
+ });
3551
+ }
3534
3552
  return resolveStream(nmfetch(content.path || content.href), callback);
3535
3553
  } else if (/^data:/i.test(content.path || content.href)) {
3536
3554
  const parsedDataUri = module.exports.parseDataURI(content.path || content.href);
@@ -3539,6 +3557,13 @@
3539
3557
  }
3540
3558
  return callback(null, parsedDataUri.data);
3541
3559
  } else if (content.path) {
3560
+ if (options.disableFileAccess) {
3561
+ return setImmediate(() => {
3562
+ const err = new Error("File access rejected for " + content.path);
3563
+ err.code = errors2.EFILEACCESS;
3564
+ callback(err);
3565
+ });
3566
+ }
3542
3567
  return resolveStream(fs.createReadStream(content.path), callback);
3543
3568
  }
3544
3569
  }
@@ -1,4 +1,4 @@
1
- import { b as TestResult } from './types-CIhpN1-K.js';
1
+ import { T as TestResult } from './types-C70T-42Z.js';
2
2
 
3
3
  interface TestReporterOptions {
4
4
  verbose?: boolean;
@@ -1,4 +1,4 @@
1
- import { T as TestMatchers, D as DescribeFunction, a as TestFunction, H as HookFunction, M as MockFunction, b as TestResult } from './types-CIhpN1-K.js';
1
+ import { a as TestMatchers, D as DescribeFunction, b as TestFunction, H as HookFunction, M as MockFunction, T as TestResult } from './types-C70T-42Z.js';
2
2
  import { RawSourceMap } from 'source-map';
3
3
 
4
4
  declare function expect(actual: any): TestMatchers<any>;
@@ -1,6 +1,6 @@
1
- import { D as DevServerOptions, i as PreviewOptions } from './state-DvEkDehk.js';
1
+ import { D as DevServerOptions, P as PreviewOptions } from './types-fiLday0L.js';
2
2
  import { B as BuildOptions } from './contracts-D7KIS-TK.js';
3
- import { a as TestOptions } from './contracts-BeW9k0yZ.js';
3
+ import { T as TestOptions } from './contracts-_0p1-15U.js';
4
4
 
5
5
  interface ElitConfig {
6
6
  /** Development server configuration */
@@ -24,6 +24,20 @@ type MobileMode = 'native' | 'hybrid';
24
24
  type DesktopMode = 'native' | 'hybrid';
25
25
  type PmRuntimeName = 'node' | 'bun' | 'deno';
26
26
  type PmRestartPolicy = 'always' | 'on-failure' | 'never';
27
+ type PmMemoryAction = 'restart' | 'stop';
28
+ type PmProxyStrategy = 'proxy' | 'inherit';
29
+ interface PmProxyConfig {
30
+ /** Public port owned by the PM proxy process */
31
+ port: number;
32
+ /** Public socket handoff mode: proxy forwards traffic, inherit shares the listener directly on Node */
33
+ strategy?: PmProxyStrategy;
34
+ /** Public host bound by the PM proxy process */
35
+ host?: string;
36
+ /** Internal host used for upstream child traffic */
37
+ targetHost?: string;
38
+ /** Environment variable populated with the child private port */
39
+ envVar?: string;
40
+ }
27
41
  interface PmHealthCheckConfig {
28
42
  /** HTTP endpoint polled while the process is online */
29
43
  url?: string;
@@ -51,10 +65,16 @@ interface PmAppConfig {
51
65
  cwd?: string;
52
66
  /** Extra environment variables injected into the process */
53
67
  env?: Record<string, string | number | boolean>;
68
+ /** Number of managed instances to start for this app */
69
+ instances?: number;
54
70
  /** Disable automatic restart when the process exits */
55
71
  autorestart?: boolean;
56
72
  /** Delay between restart attempts in milliseconds */
57
73
  restartDelay?: number;
74
+ /** Enable a PM-managed public HTTP proxy for single-instance zero-downtime reloads */
75
+ proxy?: PmProxyConfig;
76
+ /** Grace period before a stop or restart escalates to forceful termination */
77
+ killTimeout?: number;
58
78
  /** Maximum restart attempts before marking the process as errored */
59
79
  maxRestarts?: number;
60
80
  /** Password forwarded to elit wapk run for locked archives */
@@ -63,6 +83,22 @@ interface PmAppConfig {
63
83
  wapkRun?: WapkRunConfig;
64
84
  /** Restart strategy used after the child process exits */
65
85
  restartPolicy?: PmRestartPolicy;
86
+ /** Restart the process when it uses more than this many bytes, or a size string like 256M */
87
+ maxMemory?: number | string;
88
+ /** Action taken when maxMemory is exceeded */
89
+ memoryAction?: PmMemoryAction;
90
+ /** Restart schedule using a cron expression or @every <duration> */
91
+ cronRestart?: string;
92
+ /** Exponential restart backoff base delay in milliseconds for unstable restarts */
93
+ expBackoffRestartDelay?: number;
94
+ /** Maximum exponential restart backoff delay in milliseconds */
95
+ expBackoffRestartMaxDelay?: number;
96
+ /** Rolling window used when counting restart attempts against maxRestarts */
97
+ restartWindow?: number;
98
+ /** Wait for the health check to succeed before marking the process online */
99
+ waitReady?: boolean;
100
+ /** Maximum startup wait time in milliseconds when waitReady is enabled */
101
+ listenTimeout?: number;
66
102
  /** Minimum healthy uptime before restart attempt counters reset */
67
103
  minUptime?: number;
68
104
  /** Restart the process when watched files change */
@@ -239,4 +275,4 @@ interface WapkConfig {
239
275
  */
240
276
  declare function defineConfig(config: ElitConfig): ElitConfig;
241
277
 
242
- export { type DesktopConfig as D, type ElitConfig as E, type MobileAndroidConfig as M, type PmAppConfig as P, type WapkConfig as W, type DesktopMode as a, type DesktopNativeConfig as b, type MobileConfig as c, type MobileIosConfig as d, type MobileMode as e, type MobileNativeAndroidConfig as f, type MobileNativeConfig as g, type MobileNativeIosConfig as h, type PmConfig as i, type PmHealthCheckConfig as j, type PmRestartPolicy as k, type PmRuntimeName as l, type WapkGoogleDriveConfig as m, type WapkLiveSyncConfig as n, type WapkLockConfig as o, type WapkRunConfig as p, defineConfig as q };
278
+ export { type DesktopConfig as D, type ElitConfig as E, type MobileAndroidConfig as M, type PmRuntimeName as P, type WapkRunConfig as W, type PmProxyStrategy as a, type PmProxyConfig as b, type PmRestartPolicy as c, type PmMemoryAction as d, type WapkGoogleDriveConfig as e, type PmConfig as f, type PmAppConfig as g, type DesktopMode as h, type DesktopNativeConfig as i, type MobileConfig as j, type MobileIosConfig as k, type MobileMode as l, type MobileNativeAndroidConfig as m, type MobileNativeConfig as n, type MobileNativeIosConfig as o, type PmHealthCheckConfig as p, type WapkConfig as q, type WapkLiveSyncConfig as r, type WapkLockConfig as s, defineConfig as t };
@@ -61,4 +61,4 @@ interface TestResult {
61
61
  }
62
62
  type HookFunction = () => void | Promise<void>;
63
63
 
64
- export type { DescribeFunction as D, HookFunction as H, MockFunction as M, TestMatchers as T, TestFunction as a, TestResult as b };
64
+ export type { DescribeFunction as D, HookFunction as H, MockFunction as M, TestResult as T, TestMatchers as a, TestFunction as b };
@@ -64,6 +64,12 @@ interface RequestOptions {
64
64
  timeout?: number;
65
65
  signal?: AbortSignal;
66
66
  }
67
+ interface ServerListenOptions {
68
+ port?: number;
69
+ hostname?: string;
70
+ backlog?: number;
71
+ fd?: number;
72
+ }
67
73
  /**
68
74
  * Server options
69
75
  */
@@ -72,4 +78,4 @@ interface ServerOptions {
72
78
  ServerResponse?: typeof ServerResponse;
73
79
  }
74
80
 
75
- export { IncomingMessage as I, type OutgoingHttpHeaders as O, type RequestOptions as R, ServerResponse as S, type RequestListener as a, type ServerOptions as b, type IncomingHttpHeaders as c };
81
+ export { IncomingMessage as I, type OutgoingHttpHeaders as O, type RequestOptions as R, type ServerListenOptions as S, type RequestListener as a, type ServerOptions as b, ServerResponse as c, type IncomingHttpHeaders as d };
@@ -1,12 +1,99 @@
1
- import { I as IncomingMessage, S as ServerResponse } from './types-DAisuVr5.js';
2
- import { W as WebSocket } from './websocket-XfyK23zD.js';
1
+ import { I as IncomingMessage, c as ServerResponse } from './types-DPOgoGs-.js';
2
+ import { W as WebSocket } from './websocket-BLBEAnhp.js';
3
3
  import { Server } from 'http';
4
4
  import { WebSocketServer } from 'ws';
5
5
  import { C as Child } from './types-BR4wMiVx.js';
6
6
  import { E as ElitSMTPServerConfig, a as ElitSMTPServerHandle } from './types-C4gKykuG.js';
7
7
 
8
+ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS' | 'HEAD' | 'ALL';
9
+ interface ElitRequest extends IncomingMessage {
10
+ body?: any;
11
+ query?: Record<string, string>;
12
+ params?: Record<string, string>;
13
+ }
14
+ interface ElitResponse extends ServerResponse {
15
+ json(data: any, statusCode?: number): this;
16
+ send(data: any): this;
17
+ status(code: number): this;
18
+ }
19
+ interface ServerRouteContext {
20
+ req: ElitRequest;
21
+ res: ElitResponse;
22
+ params: Record<string, string>;
23
+ query: Record<string, string>;
24
+ body: any;
25
+ headers: Record<string, string | string[] | undefined>;
26
+ user?: any;
27
+ }
28
+ type ServerRouteHandler = (ctx: ServerRouteContext, next?: () => Promise<void>) => void | Promise<void>;
29
+ type Middleware = (ctx: ServerRouteContext, next: () => Promise<void>) => void | Promise<void>;
30
+ type StateChangeHandler<T = any> = (value: T, oldValue: T) => void;
31
+ interface SharedStateOptions<T = any> {
32
+ initial: T;
33
+ persist?: boolean;
34
+ validate?: (value: T) => boolean;
35
+ }
36
+
37
+ declare class ServerRouter {
38
+ private routes;
39
+ private middlewares;
40
+ use(...args: Array<any>): this;
41
+ all: (path: string, ...handlers: Array<Middleware | ServerRouteHandler | ((req: ElitRequest, res: ServerResponse, next?: () => void) => any)>) => this;
42
+ get: (path: string, ...handlers: Array<Middleware | ServerRouteHandler | ((req: ElitRequest, res: ServerResponse, next?: () => void) => any)>) => this;
43
+ post: (path: string, ...handlers: Array<Middleware | ServerRouteHandler | ((req: ElitRequest, res: ServerResponse, next?: () => void) => any)>) => this;
44
+ put: (path: string, ...handlers: Array<Middleware | ServerRouteHandler | ((req: ElitRequest, res: ServerResponse, next?: () => void) => any)>) => this;
45
+ delete: (path: string, ...handlers: Array<Middleware | ServerRouteHandler | ((req: ElitRequest, res: ServerResponse, next?: () => void) => any)>) => this;
46
+ patch: (path: string, ...handlers: Array<Middleware | ServerRouteHandler | ((req: ElitRequest, res: ServerResponse, next?: () => void) => any)>) => this;
47
+ options: (path: string, ...handlers: Array<Middleware | ServerRouteHandler | ((req: ElitRequest, res: ServerResponse, next?: () => void) => any)>) => this;
48
+ head: (path: string, ...handlers: Array<Middleware | ServerRouteHandler | ((req: ElitRequest, res: ServerResponse, next?: () => void) => any)>) => this;
49
+ private toMiddleware;
50
+ private addRoute;
51
+ private pathToRegex;
52
+ private parseQuery;
53
+ listRoutes(): Array<{
54
+ method: string;
55
+ pattern: string;
56
+ paramNames: string[];
57
+ handler: string;
58
+ }>;
59
+ private parseBody;
60
+ handle(req: IncomingMessage, res: ServerResponse): Promise<boolean>;
61
+ }
62
+
63
+ declare class SharedState<T = any> {
64
+ readonly key: string;
65
+ private _value;
66
+ private listeners;
67
+ private changeHandlers;
68
+ private options;
69
+ constructor(key: string, options: SharedStateOptions<T>);
70
+ get value(): T;
71
+ set value(newValue: T);
72
+ update(updater: (current: T) => T): void;
73
+ subscribe(ws: WebSocket): void;
74
+ unsubscribe(ws: WebSocket): void;
75
+ onChange(handler: StateChangeHandler<T>): () => void;
76
+ private broadcast;
77
+ private sendTo;
78
+ get subscriberCount(): number;
79
+ clear(): void;
80
+ }
81
+ declare class StateManager$1 {
82
+ private states;
83
+ create<T>(key: string, options: SharedStateOptions<T>): SharedState<T>;
84
+ get<T>(key: string): SharedState<T> | undefined;
85
+ has(key: string): boolean;
86
+ delete(key: string): boolean;
87
+ subscribe(key: string, ws: WebSocket): void;
88
+ unsubscribe(key: string, ws: WebSocket): void;
89
+ unsubscribeAll(ws: WebSocket): void;
90
+ handleStateChange(key: string, value: any): void;
91
+ keys(): string[];
92
+ clear(): void;
93
+ }
94
+
8
95
  type Router = ServerRouter;
9
- type StateManager$1 = StateManager;
96
+ type StateManager = StateManager$1;
10
97
  type WebSocketConnection = WebSocket;
11
98
  type WebSocketRequest = IncomingMessage;
12
99
  interface WebSocketEndpointContext {
@@ -64,6 +151,8 @@ interface DevServerOptions {
64
151
  ignore?: string[];
65
152
  worker?: WorkerConfig[];
66
153
  logging?: boolean;
154
+ /** Glob patterns for files that must never be served (e.g. ".env", ".env.*", "*.key"). Default blocks .env, .env.*, .git/**, and common secret files. */
155
+ blockFiles?: string[];
67
156
  api?: Router;
68
157
  ws?: WebSocketEndpointConfig[];
69
158
  smtp?: ElitSMTPServerConfig | ElitSMTPServerConfig[];
@@ -80,7 +169,7 @@ interface DevServer {
80
169
  wss: WebSocketServer;
81
170
  smtpServers: ElitSMTPServerHandle[];
82
171
  url: string;
83
- state: StateManager$1;
172
+ state: StateManager;
84
173
  close: () => Promise<void>;
85
174
  }
86
175
  interface PreviewOptions {
@@ -94,6 +183,8 @@ interface PreviewOptions {
94
183
  https?: boolean;
95
184
  open?: boolean;
96
185
  logging?: boolean;
186
+ /** Glob patterns for files that must never be served (e.g. ".env", ".env.*", "*.key"). Default blocks .env, .env.*, .git/**, and common secret files. */
187
+ blockFiles?: string[];
97
188
  api?: Router;
98
189
  ws?: WebSocketEndpointConfig[];
99
190
  smtp?: ElitSMTPServerConfig | ElitSMTPServerConfig[];
@@ -105,91 +196,4 @@ interface PreviewOptions {
105
196
  outFile?: string;
106
197
  }
107
198
 
108
- type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS' | 'HEAD' | 'ALL';
109
- interface ElitRequest extends IncomingMessage {
110
- body?: any;
111
- query?: Record<string, string>;
112
- params?: Record<string, string>;
113
- }
114
- interface ElitResponse extends ServerResponse {
115
- json(data: any, statusCode?: number): this;
116
- send(data: any): this;
117
- status(code: number): this;
118
- }
119
- interface ServerRouteContext {
120
- req: ElitRequest;
121
- res: ElitResponse;
122
- params: Record<string, string>;
123
- query: Record<string, string>;
124
- body: any;
125
- headers: Record<string, string | string[] | undefined>;
126
- user?: any;
127
- }
128
- type ServerRouteHandler = (ctx: ServerRouteContext, next?: () => Promise<void>) => void | Promise<void>;
129
- type Middleware = (ctx: ServerRouteContext, next: () => Promise<void>) => void | Promise<void>;
130
- type StateChangeHandler<T = any> = (value: T, oldValue: T) => void;
131
- interface SharedStateOptions<T = any> {
132
- initial: T;
133
- persist?: boolean;
134
- validate?: (value: T) => boolean;
135
- }
136
-
137
- declare class ServerRouter {
138
- private routes;
139
- private middlewares;
140
- use(...args: Array<any>): this;
141
- all: (path: string, ...handlers: Array<Middleware | ServerRouteHandler | ((req: ElitRequest, res: ServerResponse, next?: () => void) => any)>) => this;
142
- get: (path: string, ...handlers: Array<Middleware | ServerRouteHandler | ((req: ElitRequest, res: ServerResponse, next?: () => void) => any)>) => this;
143
- post: (path: string, ...handlers: Array<Middleware | ServerRouteHandler | ((req: ElitRequest, res: ServerResponse, next?: () => void) => any)>) => this;
144
- put: (path: string, ...handlers: Array<Middleware | ServerRouteHandler | ((req: ElitRequest, res: ServerResponse, next?: () => void) => any)>) => this;
145
- delete: (path: string, ...handlers: Array<Middleware | ServerRouteHandler | ((req: ElitRequest, res: ServerResponse, next?: () => void) => any)>) => this;
146
- patch: (path: string, ...handlers: Array<Middleware | ServerRouteHandler | ((req: ElitRequest, res: ServerResponse, next?: () => void) => any)>) => this;
147
- options: (path: string, ...handlers: Array<Middleware | ServerRouteHandler | ((req: ElitRequest, res: ServerResponse, next?: () => void) => any)>) => this;
148
- head: (path: string, ...handlers: Array<Middleware | ServerRouteHandler | ((req: ElitRequest, res: ServerResponse, next?: () => void) => any)>) => this;
149
- private toMiddleware;
150
- private addRoute;
151
- private pathToRegex;
152
- private parseQuery;
153
- listRoutes(): Array<{
154
- method: string;
155
- pattern: string;
156
- paramNames: string[];
157
- handler: string;
158
- }>;
159
- private parseBody;
160
- handle(req: IncomingMessage, res: ServerResponse): Promise<boolean>;
161
- }
162
-
163
- declare class SharedState<T = any> {
164
- readonly key: string;
165
- private _value;
166
- private listeners;
167
- private changeHandlers;
168
- private options;
169
- constructor(key: string, options: SharedStateOptions<T>);
170
- get value(): T;
171
- set value(newValue: T);
172
- update(updater: (current: T) => T): void;
173
- subscribe(ws: WebSocket): void;
174
- unsubscribe(ws: WebSocket): void;
175
- onChange(handler: StateChangeHandler<T>): () => void;
176
- private broadcast;
177
- private sendTo;
178
- get subscriberCount(): number;
179
- clear(): void;
180
- }
181
- declare class StateManager {
182
- private states;
183
- create<T>(key: string, options: SharedStateOptions<T>): SharedState<T>;
184
- get<T>(key: string): SharedState<T> | undefined;
185
- has(key: string): boolean;
186
- delete(key: string): boolean;
187
- subscribe(key: string, ws: WebSocket): void;
188
- unsubscribe(key: string, ws: WebSocket): void;
189
- unsubscribeAll(ws: WebSocket): void;
190
- handleStateChange(key: string, value: any): void;
191
- keys(): string[];
192
- clear(): void;
193
- }
194
-
195
- export { type DevServerOptions as D, type ElitRequest as E, type HttpMethod as H, type Middleware as M, type ProxyConfig as P, type ServerRouteContext as S, type DevServer as a, type ElitResponse as b, type ServerRouteHandler as c, ServerRouter as d, SharedState as e, type SharedStateOptions as f, type StateChangeHandler as g, StateManager as h, type PreviewOptions as i };
199
+ export { type DevServerOptions as D, type ElitRequest as E, type HttpMethod as H, type Middleware as M, type PreviewOptions as P, type ServerRouteContext as S, type DevServer as a, type ProxyConfig as b, type ElitResponse as c, type ServerRouteHandler as d, ServerRouter as e, SharedState as f, type SharedStateOptions as g, type StateChangeHandler as h, StateManager$1 as i };
package/dist/types.d.ts CHANGED
@@ -293,6 +293,8 @@ interface DevServerOptions {
293
293
  ignore?: string[];
294
294
  worker?: WorkerConfig[];
295
295
  logging?: boolean;
296
+ /** Glob patterns for files that must never be served (e.g. ".env", ".env.*", "*.key"). Default blocks .env, .env.*, .git/**, and common secret files. */
297
+ blockFiles?: string[];
296
298
  api?: Router;
297
299
  ws?: WebSocketEndpointConfig[];
298
300
  smtp?: ElitSMTPServerConfig | ElitSMTPServerConfig[];
@@ -329,6 +331,8 @@ interface PreviewOptions {
329
331
  https?: boolean;
330
332
  open?: boolean;
331
333
  logging?: boolean;
334
+ /** Glob patterns for files that must never be served (e.g. ".env", ".env.*", "*.key"). Default blocks .env, .env.*, .git/**, and common secret files. */
335
+ blockFiles?: string[];
332
336
  api?: Router;
333
337
  ws?: WebSocketEndpointConfig[];
334
338
  smtp?: ElitSMTPServerConfig | ElitSMTPServerConfig[];
@@ -1,5 +1,5 @@
1
1
  import { EventEmitter } from 'events';
2
- import { I as IncomingMessage } from './types-DAisuVr5.js';
2
+ import { I as IncomingMessage } from './types-DPOgoGs-.js';
3
3
 
4
4
  /**
5
5
  * WebSocket ready state
package/dist/ws.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { W as WebSocket, S as ServerOptions, R as ReadyState } from './websocket-XfyK23zD.js';
2
- export { C as CLOSE_CODES, D as Data, a as SendOptions, V as VerifyClientCallback } from './websocket-XfyK23zD.js';
1
+ import { W as WebSocket, S as ServerOptions, R as ReadyState } from './websocket-BLBEAnhp.js';
2
+ export { C as CLOSE_CODES, D as Data, a as SendOptions, V as VerifyClientCallback } from './websocket-BLBEAnhp.js';
3
3
  import { EventEmitter } from 'events';
4
- import { I as IncomingMessage } from './types-DAisuVr5.js';
4
+ import { I as IncomingMessage } from './types-DPOgoGs-.js';
5
5
  import 'node:events';
6
6
 
7
7
  /**