quickwin 2026.5.2-3.145209
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/README.md +6 -0
- package/examples/pdf_preview.js +440 -0
- package/examples/pdf_preview.ts +470 -0
- package/examples/preact_demo.js +35 -0
- package/examples/preact_demo.tsx +49 -0
- package/examples/tray_demo.js +75 -0
- package/examples/tray_demo.tsx +79 -0
- package/lib/fetch.js +746 -0
- package/lib/fetch.ts +811 -0
- package/lib/polyfill.js +500 -0
- package/lib/polyfill.ts +454 -0
- package/lib/preact/hooks.js +287 -0
- package/lib/preact/hooks.ts +330 -0
- package/lib/preact/jsx-runtime.js +1 -0
- package/lib/preact/jsx-runtime.ts +2 -0
- package/lib/preact/jsx.d.ts +36 -0
- package/lib/preact/layout.js +153 -0
- package/lib/preact/layout.ts +183 -0
- package/lib/preact/preact.js +54 -0
- package/lib/preact/preact.ts +133 -0
- package/lib/preact/props.js +99 -0
- package/lib/preact/props.ts +119 -0
- package/lib/preact/render.js +320 -0
- package/lib/preact/render.ts +353 -0
- package/lib/websocket.js +540 -0
- package/lib/websocket.ts +574 -0
- package/package.json +32 -0
- package/quickwin.d.ts +657 -0
- package/test/add.wasm +0 -0
- package/test/complex.wasm +0 -0
- package/test/complex_imports.wasm +0 -0
- package/test/global_imports.wasm +0 -0
- package/test/import_func.wasm +0 -0
- package/test/imports.wasm +0 -0
- package/test/run.js +86 -0
- package/test/run.ts +90 -0
- package/test/sjlj.wasm +0 -0
- package/test/test_basic.js +7 -0
- package/test/test_basic.ts +9 -0
- package/test/test_brotli.js +48 -0
- package/test/test_brotli.ts +52 -0
- package/test/test_fetch_cache.js +131 -0
- package/test/test_fetch_cache.ts +141 -0
- package/test/test_ffi.js +157 -0
- package/test/test_ffi.ts +174 -0
- package/test/test_frame_encoding.js +128 -0
- package/test/test_frame_encoding.ts +132 -0
- package/test/test_helper.js +84 -0
- package/test/test_helper.ts +80 -0
- package/test/test_http_import.js +78 -0
- package/test/test_http_import.ts +74 -0
- package/test/test_mupdf_render.js +69 -0
- package/test/test_mupdf_render.ts +74 -0
- package/test/test_mupdf_twice.js +77 -0
- package/test/test_mupdf_twice.ts +81 -0
- package/test/test_mupdf_wasm.js +33 -0
- package/test/test_mupdf_wasm.ts +30 -0
- package/test/test_net_event.js +63 -0
- package/test/test_net_event.ts +59 -0
- package/test/test_net_fetch.js +153 -0
- package/test/test_net_fetch.ts +131 -0
- package/test/test_net_websocket.js +158 -0
- package/test/test_net_websocket.ts +144 -0
- package/test/test_polyfill.js +58 -0
- package/test/test_polyfill.ts +60 -0
- package/test/test_url.js +173 -0
- package/test/test_url.ts +183 -0
- package/test/test_wasm_basic.js +82 -0
- package/test/test_wasm_basic.ts +70 -0
- package/test/test_wasm_import_global.js +41 -0
- package/test/test_wasm_import_global.ts +39 -0
- package/test/test_wasm_sjlj.js +153 -0
- package/test/test_wasm_sjlj.ts +134 -0
- package/test/test_wasm_types.js +96 -0
- package/test/test_wasm_types.ts +108 -0
- package/test/types.wasm +0 -0
- package/tsconfig.json +18 -0
- package/vendor/mupdf-wasm/mupdf-wasm.d.ts +571 -0
- package/vendor/mupdf-wasm/mupdf-wasm.js +2749 -0
- package/vendor/mupdf-wasm/mupdf-wasm.wasm +0 -0
- package/vendor/mupdf-wasm/mupdf.d.ts +939 -0
- package/vendor/mupdf-wasm/mupdf.js +3317 -0
- package/win-mingw64.exe +0 -0
package/quickwin.d.ts
ADDED
|
@@ -0,0 +1,657 @@
|
|
|
1
|
+
interface ImportMeta {
|
|
2
|
+
url: string
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
declare const console: Console
|
|
6
|
+
|
|
7
|
+
interface Console {
|
|
8
|
+
log: (...args: any) => void
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface HeadersInit {
|
|
12
|
+
[name: string]: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface RequestInit {
|
|
16
|
+
method?: string;
|
|
17
|
+
headers?: HeadersInit;
|
|
18
|
+
body?: string;
|
|
19
|
+
timeout?: number;
|
|
20
|
+
redirect?: 'follow' | 'manual' | 'error';
|
|
21
|
+
maxRedirects?: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare namespace WebAssembly {
|
|
25
|
+
interface Module { }
|
|
26
|
+
interface Instance {
|
|
27
|
+
exports: { [key: string]: any }
|
|
28
|
+
}
|
|
29
|
+
interface Global {
|
|
30
|
+
value: any
|
|
31
|
+
valueOf(): any
|
|
32
|
+
}
|
|
33
|
+
interface GlobalDescriptor {
|
|
34
|
+
value: 'i32' | 'i64' | 'f32' | 'f64'
|
|
35
|
+
mutable?: boolean
|
|
36
|
+
}
|
|
37
|
+
interface Memory {
|
|
38
|
+
readonly buffer: ArrayBuffer
|
|
39
|
+
grow(delta: number): number
|
|
40
|
+
}
|
|
41
|
+
interface MemoryDescriptor {
|
|
42
|
+
initial: number
|
|
43
|
+
maximum?: number
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
declare const WebAssembly: {
|
|
48
|
+
validate(buffer: ArrayBuffer): boolean
|
|
49
|
+
compile(buffer: ArrayBuffer): Promise<WebAssembly.Module>
|
|
50
|
+
instantiate(buffer: ArrayBuffer, importObject?: any): Promise<{ module: WebAssembly.Module; instance: WebAssembly.Instance }>
|
|
51
|
+
instantiate(module: WebAssembly.Module, importObject?: any): Promise<WebAssembly.Instance>
|
|
52
|
+
Module: {
|
|
53
|
+
new(buffer: ArrayBuffer): WebAssembly.Module
|
|
54
|
+
exports(module: WebAssembly.Module): { name: string; kind: string }[]
|
|
55
|
+
imports(module: WebAssembly.Module): { module: string; name: string; kind: string }[]
|
|
56
|
+
}
|
|
57
|
+
Instance: {
|
|
58
|
+
/**
|
|
59
|
+
* WAMR 限制:
|
|
60
|
+
* - 导入的 Global 在实例化时会 snapshot 值,之后无法与宿主或其他实例共享
|
|
61
|
+
* - 不支持 mutable imported global 的实时同步
|
|
62
|
+
*/
|
|
63
|
+
new(module: WebAssembly.Module, importObject?: any): WebAssembly.Instance
|
|
64
|
+
}
|
|
65
|
+
Global: {
|
|
66
|
+
new(descriptor: WebAssembly.GlobalDescriptor, value?: any): WebAssembly.Global
|
|
67
|
+
}
|
|
68
|
+
Memory: {
|
|
69
|
+
new(descriptor: WebAssembly.MemoryDescriptor): WebAssembly.Memory
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
interface Event {
|
|
74
|
+
readonly type: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
interface MessageEvent {
|
|
78
|
+
readonly type: string;
|
|
79
|
+
readonly data: any;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
interface CloseEvent {
|
|
83
|
+
readonly type: string;
|
|
84
|
+
readonly code: number;
|
|
85
|
+
readonly reason: string;
|
|
86
|
+
readonly wasClean: boolean;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
interface ReadableStreamReader {
|
|
90
|
+
read(): Promise<{ done: false; value: Uint8Array } | { done: true; value?: undefined }>;
|
|
91
|
+
cancel(reason?: any): void;
|
|
92
|
+
releaseLock(): void;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
interface ReadableStream {
|
|
96
|
+
readonly locked: boolean;
|
|
97
|
+
getReader(): ReadableStreamReader;
|
|
98
|
+
cancel(reason?: any): void;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
declare module "std" {
|
|
102
|
+
interface FILE {
|
|
103
|
+
close(): number;
|
|
104
|
+
puts(str: string): void;
|
|
105
|
+
printf(fmt: string, ...args: any[]): void;
|
|
106
|
+
flush(): void;
|
|
107
|
+
seek(offset: number | bigint, whence: number): number;
|
|
108
|
+
tell(): number;
|
|
109
|
+
tello(): bigint;
|
|
110
|
+
eof(): boolean;
|
|
111
|
+
fileno(): number;
|
|
112
|
+
error(): boolean;
|
|
113
|
+
clearerr(): void;
|
|
114
|
+
read(buffer: ArrayBuffer, position?: number, length?: number): number;
|
|
115
|
+
write(buffer: ArrayBuffer | string, position?: number, length?: number): number;
|
|
116
|
+
getline(): string | null;
|
|
117
|
+
readAsArrayBuffer(max_size?: number): ArrayBuffer | null;
|
|
118
|
+
readAsString(max_size?: number): string | null;
|
|
119
|
+
getByte(): number;
|
|
120
|
+
putByte(c: number): void;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
interface UrlGetOptions {
|
|
124
|
+
binary?: boolean;
|
|
125
|
+
full?: boolean;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
interface UrlGetFullResult {
|
|
129
|
+
response: string | ArrayBuffer | null;
|
|
130
|
+
responseHeaders: string;
|
|
131
|
+
status: number;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
interface EvalScriptOptions {
|
|
135
|
+
backtrace_barrier?: boolean;
|
|
136
|
+
async?: boolean;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
interface OpenOptions {
|
|
140
|
+
binary?: boolean;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function exit(n: number): never;
|
|
144
|
+
function evalScript(str: string, options?: EvalScriptOptions): any;
|
|
145
|
+
function loadScript(filename: string): any;
|
|
146
|
+
/** 只适合读取 UTF-8 文本文件,读取二进制文件用 std.open + FILE.read */
|
|
147
|
+
function loadFile(filename: string, options?: OpenOptions): string | Uint8Array | null;
|
|
148
|
+
function writeFile(filename: string, data: string | ArrayBuffer | Uint8Array): void;
|
|
149
|
+
function open(filename: string, flags: string, errorObj?: { errno: number }): FILE | null;
|
|
150
|
+
function popen(command: string, flags: string, errorObj?: { errno: number }): FILE | null;
|
|
151
|
+
function fdopen(fd: number, flags: string, errorObj?: { errno: number }): FILE | null;
|
|
152
|
+
function tmpfile(errorObj?: { errno: number }): FILE | null;
|
|
153
|
+
function puts(str: string): void;
|
|
154
|
+
function printf(fmt: string, ...args: any[]): void;
|
|
155
|
+
function sprintf(fmt: string, ...args: any[]): string;
|
|
156
|
+
|
|
157
|
+
const out: FILE;
|
|
158
|
+
const err: FILE;
|
|
159
|
+
|
|
160
|
+
namespace Error {
|
|
161
|
+
const EINVAL: number;
|
|
162
|
+
const EIO: number;
|
|
163
|
+
const EACCES: number;
|
|
164
|
+
const EEXIST: number;
|
|
165
|
+
const ENOSPC: number;
|
|
166
|
+
const ENOSYS: number;
|
|
167
|
+
const EBUSY: number;
|
|
168
|
+
const ENOENT: number;
|
|
169
|
+
const EPERM: number;
|
|
170
|
+
const EPIPE: number;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function strerror(errno: number): string;
|
|
174
|
+
function gc(): void;
|
|
175
|
+
function getenv(name: string): string | undefined;
|
|
176
|
+
function setenv(name: string, value: string): void;
|
|
177
|
+
function unsetenv(name: string): void;
|
|
178
|
+
function getenviron(): Record<string, string>;
|
|
179
|
+
function urlGet(url: string, options?: UrlGetOptions): string | ArrayBuffer | UrlGetFullResult | null;
|
|
180
|
+
|
|
181
|
+
const SEEK_SET: number;
|
|
182
|
+
const SEEK_CUR: number;
|
|
183
|
+
const SEEK_END: number;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
declare module "os" {
|
|
187
|
+
interface StatResult {
|
|
188
|
+
dev: number;
|
|
189
|
+
ino: number;
|
|
190
|
+
mode: number;
|
|
191
|
+
nlink: number;
|
|
192
|
+
uid: number;
|
|
193
|
+
gid: number;
|
|
194
|
+
rdev: number;
|
|
195
|
+
size: number;
|
|
196
|
+
blocks: number;
|
|
197
|
+
atime: number;
|
|
198
|
+
mtime: number;
|
|
199
|
+
ctime: number;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
interface ExecOptions {
|
|
203
|
+
block?: boolean;
|
|
204
|
+
usePath?: boolean;
|
|
205
|
+
file?: string;
|
|
206
|
+
cwd?: string;
|
|
207
|
+
stdin?: number;
|
|
208
|
+
stdout?: number;
|
|
209
|
+
stderr?: number;
|
|
210
|
+
env?: Record<string, string>;
|
|
211
|
+
uid?: number;
|
|
212
|
+
gid?: number;
|
|
213
|
+
groups?: number[];
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function open(filename: string, flags: number, mode?: number): number;
|
|
217
|
+
function close(fd: number): number;
|
|
218
|
+
function seek(fd: number, offset: number | bigint, whence: number): number | bigint;
|
|
219
|
+
function read(fd: number, buffer: ArrayBuffer, offset: number, length: number): number;
|
|
220
|
+
function write(fd: number, buffer: ArrayBuffer, offset: number, length: number): number;
|
|
221
|
+
function isatty(fd: number): boolean;
|
|
222
|
+
function ttyGetWinSize(fd: number): [number, number] | null;
|
|
223
|
+
function ttySetRaw(fd: number): void;
|
|
224
|
+
function remove(filename: string): number;
|
|
225
|
+
function rename(oldname: string, newname: string): number;
|
|
226
|
+
function realpath(path: string): [string, number];
|
|
227
|
+
function getcwd(): [string, number];
|
|
228
|
+
function exePath(): string | undefined;
|
|
229
|
+
function chdir(path: string): number;
|
|
230
|
+
function mkdir(path: string, mode?: number): number;
|
|
231
|
+
function mkdtemp(pattern?: string): [string, number];
|
|
232
|
+
function mkstemp(pattern?: string): [string, number];
|
|
233
|
+
function stat(path: string): [StatResult, number];
|
|
234
|
+
function lstat(path: string): [StatResult, number];
|
|
235
|
+
function utimes(path: string, atime: number, mtime: number): number;
|
|
236
|
+
function symlink(target: string, linkpath: string): number;
|
|
237
|
+
function readlink(path: string): [string, number];
|
|
238
|
+
function readdir(path: string): [string[], number];
|
|
239
|
+
function setReadHandler(fd: number, func: (() => void) | null): void;
|
|
240
|
+
function setWriteHandler(fd: number, func: (() => void) | null): void;
|
|
241
|
+
function signal(signal: number, func: (() => void) | null | undefined): void;
|
|
242
|
+
function kill(pid: number, sig: number): void;
|
|
243
|
+
function exec(args: string[], options?: ExecOptions): number;
|
|
244
|
+
function waitpid(pid: number, options: number): [number, number];
|
|
245
|
+
function dup(fd: number): number;
|
|
246
|
+
function dup2(oldfd: number, newfd: number): number;
|
|
247
|
+
function pipe(): [number, number] | null;
|
|
248
|
+
function sleep(delay_ms: number): void;
|
|
249
|
+
function sleepAsync(delay_ms: number): Promise<void>;
|
|
250
|
+
function setTimeout(func: () => void, delay: number): number;
|
|
251
|
+
function clearTimeout(id: number): void;
|
|
252
|
+
|
|
253
|
+
const platform: string;
|
|
254
|
+
|
|
255
|
+
const O_RDONLY: number;
|
|
256
|
+
const O_WRONLY: number;
|
|
257
|
+
const O_RDWR: number;
|
|
258
|
+
const O_APPEND: number;
|
|
259
|
+
const O_CREAT: number;
|
|
260
|
+
const O_EXCL: number;
|
|
261
|
+
const O_TRUNC: number;
|
|
262
|
+
const O_TEXT: number;
|
|
263
|
+
|
|
264
|
+
const SIGINT: number;
|
|
265
|
+
const SIGABRT: number;
|
|
266
|
+
const SIGFPE: number;
|
|
267
|
+
const SIGILL: number;
|
|
268
|
+
const SIGSEGV: number;
|
|
269
|
+
const SIGTERM: number;
|
|
270
|
+
|
|
271
|
+
const WNOHANG: number;
|
|
272
|
+
|
|
273
|
+
const S_IFMT: number;
|
|
274
|
+
const S_IFIFO: number;
|
|
275
|
+
const S_IFCHR: number;
|
|
276
|
+
const S_IFDIR: number;
|
|
277
|
+
const S_IFBLK: number;
|
|
278
|
+
const S_IFREG: number;
|
|
279
|
+
const S_IFSOCK: number;
|
|
280
|
+
const S_IFLNK: number;
|
|
281
|
+
const S_ISGID: number;
|
|
282
|
+
const S_ISUID: number;
|
|
283
|
+
|
|
284
|
+
class Worker {
|
|
285
|
+
constructor(module_filename: string);
|
|
286
|
+
postMessage(msg: any): void;
|
|
287
|
+
onmessage: ((event: { data: any }) => void) | null;
|
|
288
|
+
static parent: Worker;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
declare module "sock" {
|
|
293
|
+
type SockHandle = number;
|
|
294
|
+
|
|
295
|
+
function socket(domain?: number, type?: number, protocol?: number): SockHandle;
|
|
296
|
+
function bind(sock: SockHandle, addr: string, port: number): number;
|
|
297
|
+
function listen(sock: SockHandle, backlog: number): number;
|
|
298
|
+
function accept(sock: SockHandle): SockHandle;
|
|
299
|
+
function connect(sock: SockHandle, addr: string, port: number): number;
|
|
300
|
+
function send(sock: SockHandle, buf: ArrayBuffer, flags?: number): number;
|
|
301
|
+
function recv(sock: SockHandle, buf: ArrayBuffer, flags?: number): number;
|
|
302
|
+
function recv(sock: SockHandle, size: number, flags?: number): ArrayBuffer | null;
|
|
303
|
+
function closesocket(sock: SockHandle): void;
|
|
304
|
+
function shutdown(sock: SockHandle, how: number): number;
|
|
305
|
+
function setsockopt(sock: SockHandle, level: number, optname: number, optval: number): number;
|
|
306
|
+
function ioctlsocket(sock: SockHandle, cmd: number, argp: number): number;
|
|
307
|
+
function set_on_event(sock: SockHandle, callback: (events: { lNetworkEvents: number; iErrorCode: number[] }) => void): void;
|
|
308
|
+
function get_fd(sock: SockHandle): number;
|
|
309
|
+
function resolve(hostname: string): string | null;
|
|
310
|
+
|
|
311
|
+
const AF_INET: number;
|
|
312
|
+
const AF_INET6: number;
|
|
313
|
+
const SOCK_STREAM: number;
|
|
314
|
+
const SOCK_DGRAM: number;
|
|
315
|
+
const IPPROTO_TCP: number;
|
|
316
|
+
const IPPROTO_UDP: number;
|
|
317
|
+
const SD_RECEIVE: number;
|
|
318
|
+
const SD_SEND: number;
|
|
319
|
+
const SD_BOTH: number;
|
|
320
|
+
const FD_READ: number;
|
|
321
|
+
const FD_WRITE: number;
|
|
322
|
+
const FD_ACCEPT: number;
|
|
323
|
+
const FD_CONNECT: number;
|
|
324
|
+
const FD_CLOSE: number;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
declare module "wolfssl" {
|
|
328
|
+
type WOLFSSL = number;
|
|
329
|
+
type WOLFSSL_CTX = number;
|
|
330
|
+
type WOLFSSL_METHOD = number;
|
|
331
|
+
|
|
332
|
+
function wolfSSL_library_init(): number;
|
|
333
|
+
function wolfSSL_CTX_new(method: WOLFSSL_METHOD): WOLFSSL_CTX;
|
|
334
|
+
function wolfSSL_CTX_free(ctx: WOLFSSL_CTX): void;
|
|
335
|
+
function wolfSSL_CTX_set_verify(ctx: WOLFSSL_CTX, mode: number): number;
|
|
336
|
+
function wolfSSL_CTX_load_system_CA_certs(ctx: WOLFSSL_CTX): number;
|
|
337
|
+
function wolfSSL_CTX_set_default_passwd_cb(ctx: WOLFSSL_CTX, cb: number): void;
|
|
338
|
+
|
|
339
|
+
function wolfSSL_new(ctx: WOLFSSL_CTX): WOLFSSL;
|
|
340
|
+
function wolfSSL_free(ssl: WOLFSSL): void;
|
|
341
|
+
function wolfSSL_set_fd(ssl: WOLFSSL, fd: number): number;
|
|
342
|
+
function wolfSSL_connect(ssl: WOLFSSL): number;
|
|
343
|
+
function wolfSSL_accept(ssl: WOLFSSL): number;
|
|
344
|
+
function wolfSSL_shutdown(ssl: WOLFSSL): number;
|
|
345
|
+
function wolfSSL_write(ssl: WOLFSSL, buf: ArrayBuffer): number;
|
|
346
|
+
function wolfSSL_read(ssl: WOLFSSL, sz: number): ArrayBuffer | null;
|
|
347
|
+
function wolfSSL_get_error(ssl: WOLFSSL, ret: number): number;
|
|
348
|
+
function wolfSSL_use_certificate_file(ssl: WOLFSSL, file: string, format: number): number;
|
|
349
|
+
function wolfSSL_use_PrivateKey_file(ssl: WOLFSSL, file: string, format: number): number;
|
|
350
|
+
function wolfSSL_UseSNI(ssl: WOLFSSL, type: number, name: string, len?: number): number;
|
|
351
|
+
|
|
352
|
+
function wolfTLS_client_method(): WOLFSSL_METHOD;
|
|
353
|
+
function wolfTLS_server_method(): WOLFSSL_METHOD;
|
|
354
|
+
function wolfTLSv1_2_client_method(): WOLFSSL_METHOD;
|
|
355
|
+
function wolfTLSv1_3_client_method(): WOLFSSL_METHOD;
|
|
356
|
+
function wolfSSLv23_client_method(): WOLFSSL_METHOD;
|
|
357
|
+
|
|
358
|
+
const SSL_VERIFY_NONE: number;
|
|
359
|
+
const SSL_VERIFY_PEER: number;
|
|
360
|
+
const WOLFSSL_SNI_HOST_NAME: number;
|
|
361
|
+
const SSL_FILETYPE_PEM: number;
|
|
362
|
+
const SSL_SUCCESS: number;
|
|
363
|
+
const WOLFSSL_ERROR_WANT_READ: number;
|
|
364
|
+
const WOLFSSL_ERROR_WANT_WRITE: number;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
declare module "tls" {
|
|
368
|
+
function https_get_sync(url: string): string;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
declare module "win" {
|
|
372
|
+
type HMODULE = number & { readonly __label: unique symbol };
|
|
373
|
+
|
|
374
|
+
function LoadLibrary(libName: string): HMODULE | null;
|
|
375
|
+
function GetProcAddress(hModule: HMODULE, procName: string): number | null;
|
|
376
|
+
function FreeLibrary(hModule: HMODULE): boolean;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
declare module "gui" {
|
|
380
|
+
type HWND = number & { readonly __label: unique symbol };
|
|
381
|
+
type HMENU = number & { readonly __label: unique symbol };
|
|
382
|
+
type HFONT = number & { readonly __label: unique symbol };
|
|
383
|
+
type WNDPROC = number & { readonly __label: unique symbol };
|
|
384
|
+
|
|
385
|
+
function RegisterClass(className: string, wndProc?: (hwnd: HWND, msg: number, wParam: number, lParam: number) => number): number;
|
|
386
|
+
function CreateWindow(className: string, title: string, style: number, x: number, y: number, width: number, height: number, parent: HWND | null, menu: HMENU | null): HWND;
|
|
387
|
+
function ShowWindow(hwnd: HWND, nCmdShow?: number): void;
|
|
388
|
+
function SetWindowProc(hwnd: HWND, wndProc: (hwnd: HWND, msg: number, wParam: number, lParam: number) => number): void;
|
|
389
|
+
function DefWindowProc(hwnd: HWND, msg: number, wParam: number, lParam: number): number;
|
|
390
|
+
function PostQuitMessage(exitCode: number): void;
|
|
391
|
+
function SendMessage(hwnd: HWND, msg: number, wParam: number, lParam: number | string): void;
|
|
392
|
+
function MessageBox(message: string): void;
|
|
393
|
+
function SetWindowText(hwnd: HWND, text: string): void;
|
|
394
|
+
function GetWindowText(hwnd: HWND): string;
|
|
395
|
+
function GetScaleFactor(): number;
|
|
396
|
+
function CreateSystemDpiFont(): HFONT | null;
|
|
397
|
+
function GetWindowLongPtr(hwnd: HWND, nIndex: number): number;
|
|
398
|
+
function SetWindowLongPtr(hwnd: HWND, nIndex: number, newLong: number): number;
|
|
399
|
+
function RemoveWindow(hwnd: HWND): boolean;
|
|
400
|
+
function CallWindowProc(wndProc: WNDPROC, hwnd: HWND, msg: number, wParam: number, lParam: number): number;
|
|
401
|
+
|
|
402
|
+
// Tray icon
|
|
403
|
+
const enum NotifyIconCmd { ADD = 0, MODIFY = 1, DELETE = 2 }
|
|
404
|
+
const enum NotifyIconFlag { MESSAGE = 1, ICON = 2, TIP = 4 }
|
|
405
|
+
|
|
406
|
+
interface NotifyIconData {
|
|
407
|
+
hwnd: number
|
|
408
|
+
uID?: number
|
|
409
|
+
flags?: number
|
|
410
|
+
callbackMessage?: number
|
|
411
|
+
hIcon?: number
|
|
412
|
+
tip?: string
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
function ShellNotifyIcon(cmd: number, nid: NotifyIconData): boolean;
|
|
416
|
+
function LoadIcon(name: string): number | null;
|
|
417
|
+
|
|
418
|
+
// Popup menu
|
|
419
|
+
const enum MenuFlag {
|
|
420
|
+
STRING = 0,
|
|
421
|
+
SEPARATOR = 0x0800,
|
|
422
|
+
CHECKED = 0x0008,
|
|
423
|
+
GRAYED = 0x0001,
|
|
424
|
+
DISABLED = 0x0002,
|
|
425
|
+
POPUP = 0x0010,
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
function CreatePopupMenu(): number | null;
|
|
429
|
+
function AppendMenu(menu: number, flags: number, id: number, text: string): boolean;
|
|
430
|
+
function TrackPopupMenu(menu: number, x: number, y: number, flags?: number, hwnd?: number): number;
|
|
431
|
+
function DestroyMenu(menu: number): boolean;
|
|
432
|
+
function SetForegroundWindow(hwnd: number): boolean;
|
|
433
|
+
/** Returns [x, y] or null */
|
|
434
|
+
function GetCursorPos(): [number, number] | null;
|
|
435
|
+
/** Returns [width, height] of the primary monitor */
|
|
436
|
+
function GetScreenSize(): [number, number];
|
|
437
|
+
|
|
438
|
+
// 窗口样式 (Window Styles)
|
|
439
|
+
export const enum WindowStyle {
|
|
440
|
+
OVERLAPPEDWINDOW = 0x00CF0000,
|
|
441
|
+
CHILD = 0x40000000,
|
|
442
|
+
VISIBLE = 0x10000000,
|
|
443
|
+
BORDER = 0x00800000,
|
|
444
|
+
HSCROLL = 0x00100000,
|
|
445
|
+
VSCROLL = 0x00200000,
|
|
446
|
+
CLIPCHILDREN = 0x02000000,
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
// 窗口消息 (Window Messages)
|
|
450
|
+
export const enum WmMsg {
|
|
451
|
+
CREATE = 0x0001,
|
|
452
|
+
DESTROY = 0x0002,
|
|
453
|
+
CLOSE = 0x0010,
|
|
454
|
+
QUIT = 0x0012,
|
|
455
|
+
PAINT = 0x000F,
|
|
456
|
+
COMMAND = 0x0111,
|
|
457
|
+
SIZE = 0x0003,
|
|
458
|
+
CHAR = 0x0102,
|
|
459
|
+
KEYDOWN = 0x0100,
|
|
460
|
+
KEYUP = 0x0101,
|
|
461
|
+
MOUSEMOVE = 0x0200,
|
|
462
|
+
LBUTTONDOWN = 0x0201,
|
|
463
|
+
LBUTTONUP = 0x0202,
|
|
464
|
+
RBUTTONDOWN = 0x0204,
|
|
465
|
+
RBUTTONUP = 0x0205,
|
|
466
|
+
SETFONT = 0x0030,
|
|
467
|
+
HSCROLL = 0x0114,
|
|
468
|
+
VSCROLL = 0x0115,
|
|
469
|
+
MOUSEWHEEL = 0x020A,
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
// 滚动条常量 (Scroll Bar)
|
|
473
|
+
export const enum ScrollBar {
|
|
474
|
+
HORZ = 0,
|
|
475
|
+
VERT = 1,
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
// 滚动命令 (Scroll Commands)
|
|
479
|
+
export const enum ScrollCmd {
|
|
480
|
+
LINEUP = 0,
|
|
481
|
+
LINEDOWN = 1,
|
|
482
|
+
PAGEUP = 2,
|
|
483
|
+
PAGEDOWN = 3,
|
|
484
|
+
THUMBTRACK = 5,
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
// 滚动信息标志 (Scroll Info Flags)
|
|
488
|
+
export const enum ScrollInfoFlag {
|
|
489
|
+
RANGE = 0x0001,
|
|
490
|
+
PAGE = 0x0002,
|
|
491
|
+
POS = 0x0004,
|
|
492
|
+
ALL = 0x0017,
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
// 系统度量 (System Metrics)
|
|
496
|
+
export const enum SysMetrics {
|
|
497
|
+
CXSCREEN = 0,
|
|
498
|
+
CYSCREEN = 1,
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
// 按钮样式 (Button Styles)
|
|
502
|
+
export const enum ButtonStyle {
|
|
503
|
+
PUSHBUTTON = 0x00000000,
|
|
504
|
+
GROUPBOX = 0x00000007,
|
|
505
|
+
CHECKBOX = 0x00000002,
|
|
506
|
+
AUTOCHECKBOX = 0x00000003,
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
// ListBox 消息
|
|
510
|
+
export const enum LbMsg {
|
|
511
|
+
ADDSTRING = 0x0180,
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
// 静态控件样式 (Static Control Styles)
|
|
515
|
+
export const enum StaticStyle {
|
|
516
|
+
LEFT = 0x00000000,
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
// 编辑框样式 (Edit Control Styles)
|
|
520
|
+
export const enum EditStyle {
|
|
521
|
+
LEFT = 0x0000,
|
|
522
|
+
AUTOHSCROLL = 0x0080,
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
// 组合框样式 (Combo Box Styles)
|
|
526
|
+
export const enum ComboBoxStyle {
|
|
527
|
+
DROPDOWNLIST = 0x0003,
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
// 列表框样式 (List Box Styles)
|
|
531
|
+
export const enum ListBoxStyle {
|
|
532
|
+
NOTIFY = 0x0001,
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
// ShowWindow 命令 (ShowWindow nCmdShow)
|
|
536
|
+
export const enum ShowWindowCmd {
|
|
537
|
+
HIDE = 0,
|
|
538
|
+
SHOW = 5,
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
// 按钮消息 (Button Control Messages)
|
|
542
|
+
export const enum ButtonMsg {
|
|
543
|
+
GETCHECK = 0x00F0,
|
|
544
|
+
SETCHECK = 0x00F1,
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
// 按钮选中状态 (Button Check State)
|
|
548
|
+
export const enum ButtonCheckState {
|
|
549
|
+
UNCHECKED = 0,
|
|
550
|
+
CHECKED = 1,
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
// 编辑框消息 (Edit Control Messages)
|
|
554
|
+
export const enum EditMsg {
|
|
555
|
+
SETCUEBANNER = 0x1501,
|
|
556
|
+
SETPASSWORDCHAR = 0x00CC,
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
// 组合框消息 (Combo Box Messages)
|
|
560
|
+
export const enum ComboBoxMsg {
|
|
561
|
+
ADDSTRING = 0x0143,
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
// 进度条消息 (Progress Bar Messages)
|
|
565
|
+
export const enum ProgressMsg {
|
|
566
|
+
SETRANGE32 = 0x0406,
|
|
567
|
+
SETPOS = 0x0402,
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
// 窗口额外数据偏移 (GetWindowLongPtr 索引)
|
|
571
|
+
export const enum Gwlp {
|
|
572
|
+
WNDPROC = -4,
|
|
573
|
+
HINSTANCE = -6,
|
|
574
|
+
HWNDPARENT = -8,
|
|
575
|
+
USERDATA = -21,
|
|
576
|
+
ID = -12,
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
declare module "ffi" {
|
|
581
|
+
type TYPE_OF_FFI_TYPE_VOID = number & { readonly __label: unique symbol }
|
|
582
|
+
type TYPE_OF_FFI_TYPE_UINT8 = number & { readonly __label: unique symbol }
|
|
583
|
+
type TYPE_OF_FFI_TYPE_SINT8 = number & { readonly __label: unique symbol }
|
|
584
|
+
type TYPE_OF_FFI_TYPE_UINT16 = number & { readonly __label: unique symbol }
|
|
585
|
+
type TYPE_OF_FFI_TYPE_SINT16 = number & { readonly __label: unique symbol }
|
|
586
|
+
type TYPE_OF_FFI_TYPE_UINT32 = number & { readonly __label: unique symbol }
|
|
587
|
+
type TYPE_OF_FFI_TYPE_SINT32 = number & { readonly __label: unique symbol }
|
|
588
|
+
type TYPE_OF_FFI_TYPE_UINT64 = number & { readonly __label: unique symbol }
|
|
589
|
+
type TYPE_OF_FFI_TYPE_SINT64 = number & { readonly __label: unique symbol }
|
|
590
|
+
type TYPE_OF_FFI_TYPE_POINTER = number & { readonly __label: unique symbol }
|
|
591
|
+
|
|
592
|
+
const FFI_TYPE_VOID: TYPE_OF_FFI_TYPE_VOID;
|
|
593
|
+
const FFI_TYPE_UINT8: TYPE_OF_FFI_TYPE_UINT8;
|
|
594
|
+
const FFI_TYPE_SINT8: TYPE_OF_FFI_TYPE_SINT8;
|
|
595
|
+
const FFI_TYPE_UINT16: TYPE_OF_FFI_TYPE_UINT16;
|
|
596
|
+
const FFI_TYPE_SINT16: TYPE_OF_FFI_TYPE_SINT16;
|
|
597
|
+
const FFI_TYPE_UINT32: TYPE_OF_FFI_TYPE_UINT32;
|
|
598
|
+
const FFI_TYPE_SINT32: TYPE_OF_FFI_TYPE_SINT32;
|
|
599
|
+
const FFI_TYPE_UINT64: TYPE_OF_FFI_TYPE_UINT64;
|
|
600
|
+
const FFI_TYPE_SINT64: TYPE_OF_FFI_TYPE_SINT64;
|
|
601
|
+
const FFI_TYPE_POINTER: TYPE_OF_FFI_TYPE_POINTER;
|
|
602
|
+
|
|
603
|
+
type FfiType = TYPE_OF_FFI_TYPE_VOID | TYPE_OF_FFI_TYPE_UINT8 | TYPE_OF_FFI_TYPE_SINT8 | TYPE_OF_FFI_TYPE_UINT16 | TYPE_OF_FFI_TYPE_SINT16 | TYPE_OF_FFI_TYPE_UINT32 | TYPE_OF_FFI_TYPE_SINT32 | TYPE_OF_FFI_TYPE_UINT64 | TYPE_OF_FFI_TYPE_SINT64 | TYPE_OF_FFI_TYPE_POINTER;
|
|
604
|
+
type TypeArg<T extends FfiType> = T extends Exclude<FfiType, TYPE_OF_FFI_TYPE_VOID | TYPE_OF_FFI_TYPE_POINTER> ? number : T extends TYPE_OF_FFI_TYPE_POINTER ? (ArrayBuffer | null) : never;
|
|
605
|
+
type TypeArgs<T extends FfiType[], Args = []> = T extends [infer T1, ...infer RES] ? TypeArgs<RES, [...Args, TypeArg<T1>]> : Args;
|
|
606
|
+
|
|
607
|
+
function ffiCall<const T extends Exclude<FfiType, TYPE_OF_FFI_TYPE_VOID>[], const R extends FfiType>(func: number, argTypes: T, args: TypeArgs<T>, retType: R): R extends TYPE_OF_FFI_TYPE_VOID ? undefined : R extends TYPE_OF_FFI_TYPE_POINTER ? number | null : TypeArg<R>;
|
|
608
|
+
function bufferPtr(buf: ArrayBuffer): number;
|
|
609
|
+
function readByte(ptr: number): number;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
declare module "../lib/fetch.js" {
|
|
613
|
+
export { fetch, Request, Response, Headers, RequestInit, HeadersInit };
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
declare module "wamr" {
|
|
617
|
+
interface WAMRExport {
|
|
618
|
+
name: string;
|
|
619
|
+
kind: 'function' | 'table' | 'memory' | 'global';
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
interface WAMRImport {
|
|
623
|
+
module: string;
|
|
624
|
+
name: string;
|
|
625
|
+
kind: 'function' | 'table' | 'memory' | 'global';
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
interface WAMRModule {
|
|
629
|
+
delete(): void;
|
|
630
|
+
exports(): WAMRExport[];
|
|
631
|
+
imports(): WAMRImport[];
|
|
632
|
+
instantiate(imports?: { [moduleName: string]: { [funcName: string]: Function } }): WAMRInstance;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
interface WAMRInstance {
|
|
636
|
+
delete(): void;
|
|
637
|
+
exports(): { [funcName: string]: (...args: number[]) => number };
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
function validate(buffer: ArrayBuffer): boolean;
|
|
641
|
+
function compile(buffer: ArrayBuffer): WAMRModule;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
interface HttpCache {
|
|
645
|
+
readMeta(url: string): string | null;
|
|
646
|
+
readBody(url: string): ArrayBuffer | null;
|
|
647
|
+
writeCache(url: string, maxAge: number, body: string | ArrayBuffer): void;
|
|
648
|
+
writeMeta(url: string, json: string): void;
|
|
649
|
+
cacheKey(url: string): string;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
declare var __httpCache__: HttpCache;
|
|
653
|
+
|
|
654
|
+
declare module "brotli" {
|
|
655
|
+
function decompress(data: ArrayBufferLike): ArrayBuffer;
|
|
656
|
+
}
|
|
657
|
+
|
package/test/add.wasm
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|