virtual-machine 0.4.1 → 0.5.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/build/{chunk-ZJDBYKV4.mjs → chunk-RSLWCOLA.mjs} +117 -16
- package/build/cli.js +233 -18
- package/build/index.d.ts +53 -4
- package/build/index.js +118 -17
- package/build/index.mjs +3 -3
- package/build/node-worker.js +118 -17
- package/build/{riscv_vm-76YCYKQP.mjs → riscv_vm-TC4XQSNV.mjs} +1 -1
- package/build/worker.js +53 -17
- package/native/index.mjs +1 -0
- package/native/riscv-vm-native.darwin-arm64.node +0 -0
- package/native/riscv-vm-native.darwin-x64.node +0 -0
- package/native/riscv-vm-native.linux-arm64-gnu.node +0 -0
- package/native/riscv-vm-native.linux-arm64-musl.node +0 -0
- package/native/riscv-vm-native.linux-x64-gnu.node +0 -0
- package/native/riscv-vm-native.linux-x64-musl.node +0 -0
- package/native/riscv-vm-native.win32-x64-msvc.node +0 -0
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -73,6 +73,22 @@ declare class WasmVm {
|
|
|
73
73
|
* Print a status message to UART output (visible in browser).
|
|
74
74
|
*/
|
|
75
75
|
print_status(message: string): void;
|
|
76
|
+
/**
|
|
77
|
+
* Send a typed character to the D1 input device.
|
|
78
|
+
*
|
|
79
|
+
* This is the preferred way to send text input because it respects
|
|
80
|
+
* keyboard layouts. For example, Shift+7 produces '/' on German keyboards,
|
|
81
|
+
* and this method sends the actual '/' character.
|
|
82
|
+
*
|
|
83
|
+
* Use this for printable characters typed by the user.
|
|
84
|
+
* Use send_d1_key_event for special keys like Enter, Backspace, arrows.
|
|
85
|
+
*
|
|
86
|
+
* # Arguments
|
|
87
|
+
* * `char_code` - ASCII/Unicode code point (e.g., 47 for '/')
|
|
88
|
+
*
|
|
89
|
+
* Returns true if the character was sent successfully.
|
|
90
|
+
*/
|
|
91
|
+
send_d1_char(char_code: number): boolean;
|
|
76
92
|
/**
|
|
77
93
|
* Get CPU count (from kernel-reported value).
|
|
78
94
|
*/
|
|
@@ -188,6 +204,19 @@ declare class WasmVm {
|
|
|
188
204
|
* Returns None if not in SMP mode.
|
|
189
205
|
*/
|
|
190
206
|
get_shared_buffer(): SharedArrayBuffer | undefined;
|
|
207
|
+
/**
|
|
208
|
+
* Send a keyboard event to the D1 input device.
|
|
209
|
+
*
|
|
210
|
+
* This is the primary way to send keyboard input to the VM when using
|
|
211
|
+
* the D1 touch/input device (as opposed to VirtIO input).
|
|
212
|
+
*
|
|
213
|
+
* # Arguments
|
|
214
|
+
* * `js_key_code` - JavaScript keyCode (e.g., 65 for 'A', 13 for Enter)
|
|
215
|
+
* * `pressed` - true for key press, false for key release
|
|
216
|
+
*
|
|
217
|
+
* Returns true if the event was sent successfully.
|
|
218
|
+
*/
|
|
219
|
+
send_d1_key_event(js_key_code: number, pressed: boolean): boolean;
|
|
191
220
|
/**
|
|
192
221
|
* Send a mouse button event to the guest.
|
|
193
222
|
*
|
|
@@ -337,6 +366,23 @@ declare class WasmVm {
|
|
|
337
366
|
* This is the address where secondary harts should start executing.
|
|
338
367
|
*/
|
|
339
368
|
entry_pc(): bigint;
|
|
369
|
+
/**
|
|
370
|
+
* Enable VirtIO 9P device for host directory mounting.
|
|
371
|
+
*
|
|
372
|
+
* This exposes a host directory to the guest kernel at the specified
|
|
373
|
+
* mount point. The JavaScript side must provide a `window.p9Host` object
|
|
374
|
+
* with the following methods:
|
|
375
|
+
* - `read(path)` - Returns Uint8Array of file contents
|
|
376
|
+
* - `write(path, data)` - Writes data to file, returns boolean
|
|
377
|
+
* - `readdir(path)` - Returns array of `{name, isDir}` objects
|
|
378
|
+
* - `exists(path)` - Returns boolean
|
|
379
|
+
* - `isDir(path)` - Returns boolean
|
|
380
|
+
*
|
|
381
|
+
* # Arguments
|
|
382
|
+
* * `host_path` - Path prefix for the host directory
|
|
383
|
+
* * `mount_tag` - Mount tag for guest to identify the mount
|
|
384
|
+
*/
|
|
385
|
+
enable_9p(host_path: string, mount_tag: string): void;
|
|
340
386
|
/**
|
|
341
387
|
* Get the halt code if the VM has halted.
|
|
342
388
|
* Code 0x5555 typically means successful shutdown (PASS).
|
|
@@ -454,6 +500,7 @@ interface InitOutput {
|
|
|
454
500
|
readonly wasmvm_allow_workers_to_start: (a: number) => void;
|
|
455
501
|
readonly wasmvm_connect_webtransport: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
456
502
|
readonly wasmvm_disconnect_network: (a: number) => void;
|
|
503
|
+
readonly wasmvm_enable_9p: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
457
504
|
readonly wasmvm_enable_audio: (a: number) => void;
|
|
458
505
|
readonly wasmvm_enable_emac: (a: number) => void;
|
|
459
506
|
readonly wasmvm_enable_gpu: (a: number, b: number, c: number) => void;
|
|
@@ -493,6 +540,8 @@ interface InitOutput {
|
|
|
493
540
|
readonly wasmvm_num_harts: (a: number) => number;
|
|
494
541
|
readonly wasmvm_print_banner: (a: number) => void;
|
|
495
542
|
readonly wasmvm_print_status: (a: number, b: number, c: number) => void;
|
|
543
|
+
readonly wasmvm_send_d1_char: (a: number, b: number) => number;
|
|
544
|
+
readonly wasmvm_send_d1_key_event: (a: number, b: number, c: number) => number;
|
|
496
545
|
readonly wasmvm_send_key_event: (a: number, b: number, c: number) => number;
|
|
497
546
|
readonly wasmvm_send_mouse_button: (a: number, b: number, c: number) => number;
|
|
498
547
|
readonly wasmvm_send_mouse_event: (a: number, b: number, c: number, d: number) => number;
|
|
@@ -513,10 +562,10 @@ interface InitOutput {
|
|
|
513
562
|
readonly workerstate_step_batch: (a: number, b: number) => number;
|
|
514
563
|
readonly workerstate_step_count: (a: number) => bigint;
|
|
515
564
|
readonly worker_entry: (a: number, b: any, c: bigint) => void;
|
|
516
|
-
readonly
|
|
517
|
-
readonly
|
|
518
|
-
readonly
|
|
519
|
-
readonly
|
|
565
|
+
readonly wasm_bindgen__convert__closures_____invoke__hb64b0e492ba30db3: (a: number, b: number, c: any) => void;
|
|
566
|
+
readonly wasm_bindgen__closure__destroy__h75e3a518a3f3beb0: (a: number, b: number) => void;
|
|
567
|
+
readonly wasm_bindgen__convert__closures_____invoke__h18739833ac56d704: (a: number, b: number) => void;
|
|
568
|
+
readonly wasm_bindgen__convert__closures_____invoke__hba8efd9a01e74992: (a: number, b: number) => void;
|
|
520
569
|
readonly wasm_bindgen__convert__closures_____invoke__h260170fb96639bcf: (a: number, b: number, c: any) => void;
|
|
521
570
|
readonly wasm_bindgen__closure__destroy__h612f8e24953b61d5: (a: number, b: number) => void;
|
|
522
571
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|