elit 3.0.0 → 3.0.2
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.ts +4 -12
- package/dist/build.d.ts.map +1 -0
- package/dist/chokidar.d.ts +7 -9
- package/dist/chokidar.d.ts.map +1 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +17 -4
- package/dist/config.d.ts +29 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/dom.d.ts +7 -14
- package/dist/dom.d.ts.map +1 -0
- package/dist/el.d.ts +19 -191
- package/dist/el.d.ts.map +1 -0
- package/dist/fs.d.ts +35 -35
- package/dist/fs.d.ts.map +1 -0
- package/dist/hmr.d.ts +3 -3
- package/dist/hmr.d.ts.map +1 -0
- package/dist/http.d.ts +20 -22
- package/dist/http.d.ts.map +1 -0
- package/dist/https.d.ts +12 -15
- package/dist/https.d.ts.map +1 -0
- package/dist/index.d.ts +10 -629
- package/dist/index.d.ts.map +1 -0
- package/dist/mime-types.d.ts +9 -9
- package/dist/mime-types.d.ts.map +1 -0
- package/dist/path.d.ts +22 -19
- package/dist/path.d.ts.map +1 -0
- package/dist/router.d.ts +10 -17
- package/dist/router.d.ts.map +1 -0
- package/dist/runtime.d.ts +5 -6
- package/dist/runtime.d.ts.map +1 -0
- package/dist/server.d.ts +105 -7
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +14 -2
- package/dist/server.mjs +14 -2
- package/dist/state.d.ts +21 -27
- package/dist/state.d.ts.map +1 -0
- package/dist/style.d.ts +14 -55
- package/dist/style.d.ts.map +1 -0
- package/dist/types.d.ts +26 -240
- package/dist/types.d.ts.map +1 -0
- package/dist/ws.d.ts +14 -17
- package/dist/ws.d.ts.map +1 -0
- package/dist/wss.d.ts +16 -16
- package/dist/wss.d.ts.map +1 -0
- package/package.json +3 -2
- package/src/build.ts +337 -0
- package/src/chokidar.ts +401 -0
- package/src/cli.ts +638 -0
- package/src/config.ts +205 -0
- package/src/dom.ts +817 -0
- package/src/el.ts +164 -0
- package/src/fs.ts +727 -0
- package/src/hmr.ts +137 -0
- package/src/http.ts +775 -0
- package/src/https.ts +411 -0
- package/src/index.ts +14 -0
- package/src/mime-types.ts +222 -0
- package/src/path.ts +493 -0
- package/src/router.ts +237 -0
- package/src/runtime.ts +97 -0
- package/src/server.ts +1290 -0
- package/src/state.ts +468 -0
- package/src/style.ts +524 -0
- package/{dist/types-Du6kfwTm.d.ts → src/types.ts} +58 -141
- package/src/ws.ts +506 -0
- package/src/wss.ts +241 -0
- package/dist/build.d.mts +0 -20
- package/dist/chokidar.d.mts +0 -134
- package/dist/dom.d.mts +0 -87
- package/dist/el.d.mts +0 -207
- package/dist/fs.d.mts +0 -255
- package/dist/hmr.d.mts +0 -38
- package/dist/http.d.mts +0 -163
- package/dist/https.d.mts +0 -108
- package/dist/index.d.mts +0 -629
- package/dist/mime-types.d.mts +0 -48
- package/dist/path.d.mts +0 -163
- package/dist/router.d.mts +0 -47
- package/dist/runtime.d.mts +0 -97
- package/dist/server.d.mts +0 -7
- package/dist/state.d.mts +0 -111
- package/dist/style.d.mts +0 -159
- package/dist/types-C0nGi6MX.d.mts +0 -346
- package/dist/types.d.mts +0 -452
- package/dist/ws.d.mts +0 -195
- package/dist/wss.d.mts +0 -108
package/dist/fs.d.mts
DELETED
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File System module with unified API across runtimes
|
|
3
|
-
* Compatible with Node.js 'fs' module API
|
|
4
|
-
* - Node.js: uses 'fs' module
|
|
5
|
-
* - Bun: uses Bun.file() and native APIs
|
|
6
|
-
* - Deno: uses Deno.readFile(), etc.
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* File encoding types
|
|
10
|
-
*/
|
|
11
|
-
type BufferEncoding = 'ascii' | 'utf8' | 'utf-8' | 'utf16le' | 'ucs2' | 'ucs-2' | 'base64' | 'base64url' | 'latin1' | 'binary' | 'hex';
|
|
12
|
-
/**
|
|
13
|
-
* Read file options
|
|
14
|
-
*/
|
|
15
|
-
interface ReadFileOptions {
|
|
16
|
-
encoding?: BufferEncoding | null;
|
|
17
|
-
flag?: string;
|
|
18
|
-
signal?: AbortSignal;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Write file options
|
|
22
|
-
*/
|
|
23
|
-
interface WriteFileOptions {
|
|
24
|
-
encoding?: BufferEncoding | null;
|
|
25
|
-
mode?: number;
|
|
26
|
-
flag?: string;
|
|
27
|
-
signal?: AbortSignal;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Mkdir options
|
|
31
|
-
*/
|
|
32
|
-
interface MkdirOptions {
|
|
33
|
-
recursive?: boolean;
|
|
34
|
-
mode?: number;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Readdir options
|
|
38
|
-
*/
|
|
39
|
-
interface ReaddirOptions {
|
|
40
|
-
encoding?: BufferEncoding | null;
|
|
41
|
-
withFileTypes?: boolean;
|
|
42
|
-
recursive?: boolean;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* File stats
|
|
46
|
-
*/
|
|
47
|
-
interface Stats {
|
|
48
|
-
isFile(): boolean;
|
|
49
|
-
isDirectory(): boolean;
|
|
50
|
-
isBlockDevice(): boolean;
|
|
51
|
-
isCharacterDevice(): boolean;
|
|
52
|
-
isSymbolicLink(): boolean;
|
|
53
|
-
isFIFO(): boolean;
|
|
54
|
-
isSocket(): boolean;
|
|
55
|
-
dev: number;
|
|
56
|
-
ino: number;
|
|
57
|
-
mode: number;
|
|
58
|
-
nlink: number;
|
|
59
|
-
uid: number;
|
|
60
|
-
gid: number;
|
|
61
|
-
rdev: number;
|
|
62
|
-
size: number;
|
|
63
|
-
blksize: number;
|
|
64
|
-
blocks: number;
|
|
65
|
-
atimeMs: number;
|
|
66
|
-
mtimeMs: number;
|
|
67
|
-
ctimeMs: number;
|
|
68
|
-
birthtimeMs: number;
|
|
69
|
-
atime: Date;
|
|
70
|
-
mtime: Date;
|
|
71
|
-
ctime: Date;
|
|
72
|
-
birthtime: Date;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Directory entry
|
|
76
|
-
*/
|
|
77
|
-
interface Dirent {
|
|
78
|
-
name: string;
|
|
79
|
-
isFile(): boolean;
|
|
80
|
-
isDirectory(): boolean;
|
|
81
|
-
isBlockDevice(): boolean;
|
|
82
|
-
isCharacterDevice(): boolean;
|
|
83
|
-
isSymbolicLink(): boolean;
|
|
84
|
-
isFIFO(): boolean;
|
|
85
|
-
isSocket(): boolean;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Read file (async)
|
|
89
|
-
*/
|
|
90
|
-
declare function readFile(path: string, options?: ReadFileOptions | BufferEncoding): Promise<string | Buffer>;
|
|
91
|
-
/**
|
|
92
|
-
* Read file (sync)
|
|
93
|
-
*/
|
|
94
|
-
declare function readFileSync(path: string, options?: ReadFileOptions | BufferEncoding): string | Buffer;
|
|
95
|
-
/**
|
|
96
|
-
* Write file (async)
|
|
97
|
-
*/
|
|
98
|
-
declare function writeFile(path: string, data: string | Buffer | Uint8Array, options?: WriteFileOptions | BufferEncoding): Promise<void>;
|
|
99
|
-
/**
|
|
100
|
-
* Write file (sync)
|
|
101
|
-
*/
|
|
102
|
-
declare function writeFileSync(path: string, data: string | Buffer | Uint8Array, options?: WriteFileOptions | BufferEncoding): void;
|
|
103
|
-
/**
|
|
104
|
-
* Append file (async)
|
|
105
|
-
*/
|
|
106
|
-
declare function appendFile(path: string, data: string | Buffer, options?: WriteFileOptions | BufferEncoding): Promise<void>;
|
|
107
|
-
/**
|
|
108
|
-
* Append file (sync)
|
|
109
|
-
*/
|
|
110
|
-
declare function appendFileSync(path: string, data: string | Buffer, options?: WriteFileOptions | BufferEncoding): void;
|
|
111
|
-
/**
|
|
112
|
-
* Check if file/directory exists (async)
|
|
113
|
-
*/
|
|
114
|
-
declare function exists(path: string): Promise<boolean>;
|
|
115
|
-
/**
|
|
116
|
-
* Check if file/directory exists (sync)
|
|
117
|
-
*/
|
|
118
|
-
declare function existsSync(path: string): boolean;
|
|
119
|
-
/**
|
|
120
|
-
* Get file stats (async)
|
|
121
|
-
*/
|
|
122
|
-
declare function stat(path: string): Promise<Stats>;
|
|
123
|
-
/**
|
|
124
|
-
* Get file stats (sync)
|
|
125
|
-
*/
|
|
126
|
-
declare function statSync(path: string): Stats;
|
|
127
|
-
/**
|
|
128
|
-
* Create directory (async)
|
|
129
|
-
*/
|
|
130
|
-
declare function mkdir(path: string, options?: MkdirOptions | number): Promise<void>;
|
|
131
|
-
/**
|
|
132
|
-
* Create directory (sync)
|
|
133
|
-
*/
|
|
134
|
-
declare function mkdirSync(path: string, options?: MkdirOptions | number): void;
|
|
135
|
-
/**
|
|
136
|
-
* Read directory (async)
|
|
137
|
-
*/
|
|
138
|
-
declare function readdir(path: string, options?: ReaddirOptions | BufferEncoding): Promise<string[] | Dirent[]>;
|
|
139
|
-
/**
|
|
140
|
-
* Read directory (sync)
|
|
141
|
-
*/
|
|
142
|
-
declare function readdirSync(path: string, options?: ReaddirOptions | BufferEncoding): string[] | Dirent[];
|
|
143
|
-
/**
|
|
144
|
-
* Remove file (async)
|
|
145
|
-
*/
|
|
146
|
-
declare function unlink(path: string): Promise<void>;
|
|
147
|
-
/**
|
|
148
|
-
* Remove file (sync)
|
|
149
|
-
*/
|
|
150
|
-
declare function unlinkSync(path: string): void;
|
|
151
|
-
/**
|
|
152
|
-
* Remove directory (async)
|
|
153
|
-
*/
|
|
154
|
-
declare function rmdir(path: string, options?: {
|
|
155
|
-
recursive?: boolean;
|
|
156
|
-
}): Promise<void>;
|
|
157
|
-
/**
|
|
158
|
-
* Remove directory (sync)
|
|
159
|
-
*/
|
|
160
|
-
declare function rmdirSync(path: string, options?: {
|
|
161
|
-
recursive?: boolean;
|
|
162
|
-
}): void;
|
|
163
|
-
/**
|
|
164
|
-
* Rename/move file (async)
|
|
165
|
-
*/
|
|
166
|
-
declare function rename(oldPath: string, newPath: string): Promise<void>;
|
|
167
|
-
/**
|
|
168
|
-
* Rename/move file (sync)
|
|
169
|
-
*/
|
|
170
|
-
declare function renameSync(oldPath: string, newPath: string): void;
|
|
171
|
-
/**
|
|
172
|
-
* Copy file (async)
|
|
173
|
-
*/
|
|
174
|
-
declare function copyFile(src: string, dest: string, flags?: number): Promise<void>;
|
|
175
|
-
/**
|
|
176
|
-
* Copy file (sync)
|
|
177
|
-
*/
|
|
178
|
-
declare function copyFileSync(src: string, dest: string, flags?: number): void;
|
|
179
|
-
/**
|
|
180
|
-
* Resolve pathname to absolute path (async)
|
|
181
|
-
*/
|
|
182
|
-
declare function realpath(path: string, options?: {
|
|
183
|
-
encoding?: BufferEncoding;
|
|
184
|
-
}): Promise<string>;
|
|
185
|
-
/**
|
|
186
|
-
* Resolve pathname to absolute path (sync)
|
|
187
|
-
*/
|
|
188
|
-
declare function realpathSync(path: string, options?: {
|
|
189
|
-
encoding?: BufferEncoding;
|
|
190
|
-
}): string;
|
|
191
|
-
/**
|
|
192
|
-
* Get current runtime
|
|
193
|
-
*/
|
|
194
|
-
declare function getRuntime(): 'node' | 'bun' | 'deno';
|
|
195
|
-
/**
|
|
196
|
-
* Promises API (re-export for compatibility)
|
|
197
|
-
*/
|
|
198
|
-
declare const promises: {
|
|
199
|
-
readFile: typeof readFile;
|
|
200
|
-
writeFile: typeof writeFile;
|
|
201
|
-
appendFile: typeof appendFile;
|
|
202
|
-
stat: typeof stat;
|
|
203
|
-
mkdir: typeof mkdir;
|
|
204
|
-
readdir: typeof readdir;
|
|
205
|
-
unlink: typeof unlink;
|
|
206
|
-
rmdir: typeof rmdir;
|
|
207
|
-
rename: typeof rename;
|
|
208
|
-
copyFile: typeof copyFile;
|
|
209
|
-
realpath: typeof realpath;
|
|
210
|
-
};
|
|
211
|
-
/**
|
|
212
|
-
* Default export
|
|
213
|
-
*/
|
|
214
|
-
declare const _default: {
|
|
215
|
-
readFile: typeof readFile;
|
|
216
|
-
readFileSync: typeof readFileSync;
|
|
217
|
-
writeFile: typeof writeFile;
|
|
218
|
-
writeFileSync: typeof writeFileSync;
|
|
219
|
-
appendFile: typeof appendFile;
|
|
220
|
-
appendFileSync: typeof appendFileSync;
|
|
221
|
-
exists: typeof exists;
|
|
222
|
-
existsSync: typeof existsSync;
|
|
223
|
-
stat: typeof stat;
|
|
224
|
-
statSync: typeof statSync;
|
|
225
|
-
mkdir: typeof mkdir;
|
|
226
|
-
mkdirSync: typeof mkdirSync;
|
|
227
|
-
readdir: typeof readdir;
|
|
228
|
-
readdirSync: typeof readdirSync;
|
|
229
|
-
unlink: typeof unlink;
|
|
230
|
-
unlinkSync: typeof unlinkSync;
|
|
231
|
-
rmdir: typeof rmdir;
|
|
232
|
-
rmdirSync: typeof rmdirSync;
|
|
233
|
-
rename: typeof rename;
|
|
234
|
-
renameSync: typeof renameSync;
|
|
235
|
-
copyFile: typeof copyFile;
|
|
236
|
-
copyFileSync: typeof copyFileSync;
|
|
237
|
-
realpath: typeof realpath;
|
|
238
|
-
realpathSync: typeof realpathSync;
|
|
239
|
-
promises: {
|
|
240
|
-
readFile: typeof readFile;
|
|
241
|
-
writeFile: typeof writeFile;
|
|
242
|
-
appendFile: typeof appendFile;
|
|
243
|
-
stat: typeof stat;
|
|
244
|
-
mkdir: typeof mkdir;
|
|
245
|
-
readdir: typeof readdir;
|
|
246
|
-
unlink: typeof unlink;
|
|
247
|
-
rmdir: typeof rmdir;
|
|
248
|
-
rename: typeof rename;
|
|
249
|
-
copyFile: typeof copyFile;
|
|
250
|
-
realpath: typeof realpath;
|
|
251
|
-
};
|
|
252
|
-
getRuntime: typeof getRuntime;
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
export { type BufferEncoding, type Dirent, type MkdirOptions, type ReadFileOptions, type ReaddirOptions, type Stats, type WriteFileOptions, appendFile, appendFileSync, copyFile, copyFileSync, _default as default, exists, existsSync, getRuntime, mkdir, mkdirSync, promises, readFile, readFileSync, readdir, readdirSync, realpath, realpathSync, rename, renameSync, rmdir, rmdirSync, stat, statSync, unlink, unlinkSync, writeFile, writeFileSync };
|
package/dist/hmr.d.mts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Client-side HMR runtime for Elit
|
|
3
|
-
* Import this in your app to enable hot module replacement
|
|
4
|
-
*/
|
|
5
|
-
interface HMRClient {
|
|
6
|
-
/** Check if HMR is enabled */
|
|
7
|
-
enabled: boolean;
|
|
8
|
-
/** Manually reload the page */
|
|
9
|
-
reload: () => void;
|
|
10
|
-
/** Accept HMR updates for current module */
|
|
11
|
-
accept: (callback?: () => void) => void;
|
|
12
|
-
/** Decline HMR updates (forces full reload) */
|
|
13
|
-
decline: () => void;
|
|
14
|
-
/** Dispose callback before module is replaced */
|
|
15
|
-
dispose: (callback: () => void) => void;
|
|
16
|
-
}
|
|
17
|
-
declare global {
|
|
18
|
-
interface Window {
|
|
19
|
-
__ELIT_HMR__: HMRClient;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
declare class ElitHMR implements HMRClient {
|
|
23
|
-
enabled: boolean;
|
|
24
|
-
private ws;
|
|
25
|
-
private acceptCallbacks;
|
|
26
|
-
private disposeCallbacks;
|
|
27
|
-
private declined;
|
|
28
|
-
constructor();
|
|
29
|
-
private connect;
|
|
30
|
-
private handleMessage;
|
|
31
|
-
reload(): void;
|
|
32
|
-
accept(callback?: () => void): void;
|
|
33
|
-
decline(): void;
|
|
34
|
-
dispose(callback: () => void): void;
|
|
35
|
-
}
|
|
36
|
-
declare const hmr: ElitHMR;
|
|
37
|
-
|
|
38
|
-
export { type HMRClient, hmr as default };
|
package/dist/http.d.mts
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'node:events';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* HTTP module with unified API across runtimes
|
|
5
|
-
* Ultra-optimized for maximum performance across Node.js, Bun, and Deno
|
|
6
|
-
*
|
|
7
|
-
* Performance optimizations:
|
|
8
|
-
* - Bun fast path: Zero class instantiation (object literals only)
|
|
9
|
-
* - Eliminated EventEmitter overhead for Bun/Deno
|
|
10
|
-
* - Zero-copy headers conversion
|
|
11
|
-
* - Inline response creation
|
|
12
|
-
* - Reduced object allocations
|
|
13
|
-
* - Direct closure capture (no resolver indirection)
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* HTTP Methods
|
|
18
|
-
*/
|
|
19
|
-
declare const METHODS: readonly ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE"];
|
|
20
|
-
/**
|
|
21
|
-
* HTTP Status Codes (compact object)
|
|
22
|
-
*/
|
|
23
|
-
declare const STATUS_CODES: Record<number, string>;
|
|
24
|
-
/**
|
|
25
|
-
* HTTP Headers type
|
|
26
|
-
*/
|
|
27
|
-
type IncomingHttpHeaders = Record<string, string | string[] | undefined>;
|
|
28
|
-
type OutgoingHttpHeaders = Record<string, string | string[] | number>;
|
|
29
|
-
/**
|
|
30
|
-
* IncomingMessage - Ultra-optimized for zero-copy operations
|
|
31
|
-
*/
|
|
32
|
-
declare class IncomingMessage extends EventEmitter {
|
|
33
|
-
method: string;
|
|
34
|
-
url: string;
|
|
35
|
-
headers: IncomingHttpHeaders;
|
|
36
|
-
statusCode?: number;
|
|
37
|
-
statusMessage?: string;
|
|
38
|
-
httpVersion: string;
|
|
39
|
-
rawHeaders: string[];
|
|
40
|
-
socket: any;
|
|
41
|
-
private _req;
|
|
42
|
-
constructor(req: any);
|
|
43
|
-
text(): Promise<string>;
|
|
44
|
-
json(): Promise<any>;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* ServerResponse - Ultra-optimized write operations
|
|
48
|
-
*/
|
|
49
|
-
declare class ServerResponse extends EventEmitter {
|
|
50
|
-
statusCode: number;
|
|
51
|
-
statusMessage: string;
|
|
52
|
-
headersSent: boolean;
|
|
53
|
-
private _headers;
|
|
54
|
-
private _body;
|
|
55
|
-
private _resolve?;
|
|
56
|
-
private _finished;
|
|
57
|
-
private _nodeRes?;
|
|
58
|
-
constructor(_req?: IncomingMessage, nodeRes?: any);
|
|
59
|
-
setHeader(name: string, value: string | string[] | number): this;
|
|
60
|
-
getHeader(name: string): string | string[] | number | undefined;
|
|
61
|
-
getHeaders(): OutgoingHttpHeaders;
|
|
62
|
-
getHeaderNames(): string[];
|
|
63
|
-
hasHeader(name: string): boolean;
|
|
64
|
-
removeHeader(name: string): void;
|
|
65
|
-
writeHead(statusCode: number, statusMessage?: string | OutgoingHttpHeaders, headers?: OutgoingHttpHeaders): this;
|
|
66
|
-
write(chunk: any, encoding?: BufferEncoding | (() => void), callback?: () => void): boolean;
|
|
67
|
-
end(chunk?: any, encoding?: BufferEncoding | (() => void), callback?: () => void): this;
|
|
68
|
-
_setResolver(resolve: (response: Response) => void): void;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Server - Optimized for each runtime
|
|
72
|
-
*/
|
|
73
|
-
declare class Server extends EventEmitter {
|
|
74
|
-
private nativeServer?;
|
|
75
|
-
private requestListener?;
|
|
76
|
-
_listening: boolean;
|
|
77
|
-
constructor(requestListener?: RequestListener);
|
|
78
|
-
listen(port?: number, hostname?: string, backlog?: number, listeningListener?: () => void): this;
|
|
79
|
-
listen(port?: number, hostname?: string, listeningListener?: () => void): this;
|
|
80
|
-
listen(port?: number, listeningListener?: () => void): this;
|
|
81
|
-
listen(options?: {
|
|
82
|
-
port?: number;
|
|
83
|
-
hostname?: string;
|
|
84
|
-
backlog?: number;
|
|
85
|
-
}, listeningListener?: () => void): this;
|
|
86
|
-
close(callback?: (err?: Error) => void): this;
|
|
87
|
-
address(): {
|
|
88
|
-
port: number;
|
|
89
|
-
family: string;
|
|
90
|
-
address: string;
|
|
91
|
-
} | null;
|
|
92
|
-
get listening(): boolean;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Request listener type
|
|
96
|
-
*/
|
|
97
|
-
type RequestListener = (req: IncomingMessage, res: ServerResponse) => void;
|
|
98
|
-
/**
|
|
99
|
-
* Request options
|
|
100
|
-
*/
|
|
101
|
-
interface RequestOptions {
|
|
102
|
-
method?: string;
|
|
103
|
-
headers?: OutgoingHttpHeaders;
|
|
104
|
-
timeout?: number;
|
|
105
|
-
signal?: AbortSignal;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Server options
|
|
109
|
-
*/
|
|
110
|
-
interface ServerOptions {
|
|
111
|
-
IncomingMessage?: typeof IncomingMessage;
|
|
112
|
-
ServerResponse?: typeof ServerResponse;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Client request - lightweight wrapper
|
|
116
|
-
*/
|
|
117
|
-
declare class ClientRequest extends EventEmitter {
|
|
118
|
-
constructor(_url: string | URL, _options?: RequestOptions);
|
|
119
|
-
write(_chunk: any): boolean;
|
|
120
|
-
end(callback?: () => void): void;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* HTTP Agent
|
|
124
|
-
*/
|
|
125
|
-
declare class Agent {
|
|
126
|
-
options?: any | undefined;
|
|
127
|
-
constructor(options?: any | undefined);
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Create HTTP server
|
|
131
|
-
*/
|
|
132
|
-
declare function createServer(requestListener?: RequestListener): Server;
|
|
133
|
-
declare function createServer(options: ServerOptions, requestListener?: RequestListener): Server;
|
|
134
|
-
/**
|
|
135
|
-
* Make HTTP request - optimized per runtime
|
|
136
|
-
*/
|
|
137
|
-
declare function request(url: string | URL, options?: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest;
|
|
138
|
-
/**
|
|
139
|
-
* Make HTTP GET request
|
|
140
|
-
*/
|
|
141
|
-
declare function get(url: string | URL, options?: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest;
|
|
142
|
-
/**
|
|
143
|
-
* Get current runtime
|
|
144
|
-
*/
|
|
145
|
-
declare function getRuntime(): 'node' | 'bun' | 'deno';
|
|
146
|
-
/**
|
|
147
|
-
* Default export
|
|
148
|
-
*/
|
|
149
|
-
declare const _default: {
|
|
150
|
-
createServer: typeof createServer;
|
|
151
|
-
request: typeof request;
|
|
152
|
-
get: typeof get;
|
|
153
|
-
Server: typeof Server;
|
|
154
|
-
IncomingMessage: typeof IncomingMessage;
|
|
155
|
-
ServerResponse: typeof ServerResponse;
|
|
156
|
-
Agent: typeof Agent;
|
|
157
|
-
ClientRequest: typeof ClientRequest;
|
|
158
|
-
METHODS: readonly ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE"];
|
|
159
|
-
STATUS_CODES: Record<number, string>;
|
|
160
|
-
getRuntime: typeof getRuntime;
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
export { Agent, ClientRequest, type IncomingHttpHeaders, IncomingMessage, METHODS, type OutgoingHttpHeaders, type RequestListener, type RequestOptions, STATUS_CODES, Server, type ServerOptions, ServerResponse, createServer, _default as default, get, getRuntime, request };
|
package/dist/https.d.mts
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'events';
|
|
2
|
-
import { IncomingMessage, ServerResponse, RequestListener, RequestOptions } from './http.mjs';
|
|
3
|
-
import 'node:events';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* HTTPS module with unified API across runtimes
|
|
7
|
-
* Optimized for maximum performance across Node.js, Bun, and Deno
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* HTTPS Server options
|
|
12
|
-
*/
|
|
13
|
-
interface ServerOptions {
|
|
14
|
-
IncomingMessage?: typeof IncomingMessage;
|
|
15
|
-
ServerResponse?: typeof ServerResponse;
|
|
16
|
-
key?: string | Buffer | Array<string | Buffer>;
|
|
17
|
-
cert?: string | Buffer | Array<string | Buffer>;
|
|
18
|
-
ca?: string | Buffer | Array<string | Buffer>;
|
|
19
|
-
passphrase?: string;
|
|
20
|
-
pfx?: string | Buffer | Array<string | Buffer>;
|
|
21
|
-
dhparam?: string | Buffer;
|
|
22
|
-
ecdhCurve?: string;
|
|
23
|
-
honorCipherOrder?: boolean;
|
|
24
|
-
requestCert?: boolean;
|
|
25
|
-
rejectUnauthorized?: boolean;
|
|
26
|
-
NPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array;
|
|
27
|
-
ALPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array;
|
|
28
|
-
SNICallback?: (servername: string, cb: (err: Error | null, ctx?: any) => void) => void;
|
|
29
|
-
sessionTimeout?: number;
|
|
30
|
-
ticketKeys?: Buffer;
|
|
31
|
-
tls?: {
|
|
32
|
-
key?: string | Buffer;
|
|
33
|
-
cert?: string | Buffer;
|
|
34
|
-
ca?: string | Buffer;
|
|
35
|
-
passphrase?: string;
|
|
36
|
-
dhParamsFile?: string;
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* HTTPS Server - Optimized for each runtime
|
|
41
|
-
*/
|
|
42
|
-
declare class Server extends EventEmitter {
|
|
43
|
-
private nativeServer?;
|
|
44
|
-
private requestListener?;
|
|
45
|
-
_listening: boolean;
|
|
46
|
-
private options;
|
|
47
|
-
constructor(options: ServerOptions, requestListener?: RequestListener);
|
|
48
|
-
listen(port?: number, hostname?: string, backlog?: number, listeningListener?: () => void): this;
|
|
49
|
-
listen(port?: number, hostname?: string, listeningListener?: () => void): this;
|
|
50
|
-
listen(port?: number, listeningListener?: () => void): this;
|
|
51
|
-
listen(options?: {
|
|
52
|
-
port?: number;
|
|
53
|
-
hostname?: string;
|
|
54
|
-
backlog?: number;
|
|
55
|
-
}, listeningListener?: () => void): this;
|
|
56
|
-
close(callback?: (err?: Error) => void): this;
|
|
57
|
-
address(): {
|
|
58
|
-
port: number;
|
|
59
|
-
family: string;
|
|
60
|
-
address: string;
|
|
61
|
-
} | null;
|
|
62
|
-
get listening(): boolean;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Client request
|
|
66
|
-
*/
|
|
67
|
-
declare class ClientRequest extends EventEmitter {
|
|
68
|
-
constructor(_url: string | URL, _options?: RequestOptions);
|
|
69
|
-
write(_chunk: any): boolean;
|
|
70
|
-
end(callback?: () => void): void;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* HTTPS Agent
|
|
74
|
-
*/
|
|
75
|
-
declare class Agent {
|
|
76
|
-
options?: any | undefined;
|
|
77
|
-
constructor(options?: any | undefined);
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Create HTTPS server
|
|
81
|
-
*/
|
|
82
|
-
declare function createServer(options: ServerOptions, requestListener?: RequestListener): Server;
|
|
83
|
-
/**
|
|
84
|
-
* Make HTTPS request - optimized per runtime
|
|
85
|
-
*/
|
|
86
|
-
declare function request(url: string | URL, options?: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest;
|
|
87
|
-
/**
|
|
88
|
-
* Make HTTPS GET request
|
|
89
|
-
*/
|
|
90
|
-
declare function get(url: string | URL, options?: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest;
|
|
91
|
-
/**
|
|
92
|
-
* Get current runtime
|
|
93
|
-
*/
|
|
94
|
-
declare function getRuntime(): 'node' | 'bun' | 'deno';
|
|
95
|
-
/**
|
|
96
|
-
* Default export
|
|
97
|
-
*/
|
|
98
|
-
declare const _default: {
|
|
99
|
-
createServer: typeof createServer;
|
|
100
|
-
request: typeof request;
|
|
101
|
-
get: typeof get;
|
|
102
|
-
Server: typeof Server;
|
|
103
|
-
Agent: typeof Agent;
|
|
104
|
-
ClientRequest: typeof ClientRequest;
|
|
105
|
-
getRuntime: typeof getRuntime;
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
export { Agent, ClientRequest, Server, type ServerOptions, createServer, _default as default, get, getRuntime, request };
|