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
|
@@ -217,14 +217,14 @@ if (!("encodeInto" in cachedTextEncoder)) {
|
|
|
217
217
|
};
|
|
218
218
|
}
|
|
219
219
|
var WASM_VECTOR_LEN = 0;
|
|
220
|
-
function
|
|
221
|
-
wasm.
|
|
220
|
+
function wasm_bindgen__convert__closures_____invoke__hb64b0e492ba30db3(arg0, arg1, arg2) {
|
|
221
|
+
wasm.wasm_bindgen__convert__closures_____invoke__hb64b0e492ba30db3(arg0, arg1, arg2);
|
|
222
222
|
}
|
|
223
|
-
function
|
|
224
|
-
wasm.
|
|
223
|
+
function wasm_bindgen__convert__closures_____invoke__h18739833ac56d704(arg0, arg1) {
|
|
224
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h18739833ac56d704(arg0, arg1);
|
|
225
225
|
}
|
|
226
|
-
function
|
|
227
|
-
wasm.
|
|
226
|
+
function wasm_bindgen__convert__closures_____invoke__hba8efd9a01e74992(arg0, arg1) {
|
|
227
|
+
wasm.wasm_bindgen__convert__closures_____invoke__hba8efd9a01e74992(arg0, arg1);
|
|
228
228
|
}
|
|
229
229
|
function wasm_bindgen__convert__closures_____invoke__h260170fb96639bcf(arg0, arg1, arg2) {
|
|
230
230
|
wasm.wasm_bindgen__convert__closures_____invoke__h260170fb96639bcf(arg0, arg1, arg2);
|
|
@@ -348,6 +348,27 @@ var WasmVm = class _WasmVm {
|
|
|
348
348
|
const len0 = WASM_VECTOR_LEN;
|
|
349
349
|
wasm.wasmvm_print_status(this.__wbg_ptr, ptr0, len0);
|
|
350
350
|
}
|
|
351
|
+
/**
|
|
352
|
+
* Send a typed character to the D1 input device.
|
|
353
|
+
*
|
|
354
|
+
* This is the preferred way to send text input because it respects
|
|
355
|
+
* keyboard layouts. For example, Shift+7 produces '/' on German keyboards,
|
|
356
|
+
* and this method sends the actual '/' character.
|
|
357
|
+
*
|
|
358
|
+
* Use this for printable characters typed by the user.
|
|
359
|
+
* Use send_d1_key_event for special keys like Enter, Backspace, arrows.
|
|
360
|
+
*
|
|
361
|
+
* # Arguments
|
|
362
|
+
* * `char_code` - ASCII/Unicode code point (e.g., 47 for '/')
|
|
363
|
+
*
|
|
364
|
+
* Returns true if the character was sent successfully.
|
|
365
|
+
* @param {number} char_code
|
|
366
|
+
* @returns {boolean}
|
|
367
|
+
*/
|
|
368
|
+
send_d1_char(char_code) {
|
|
369
|
+
const ret = wasm.wasmvm_send_d1_char(this.__wbg_ptr, char_code);
|
|
370
|
+
return ret !== 0;
|
|
371
|
+
}
|
|
351
372
|
/**
|
|
352
373
|
* Get CPU count (from kernel-reported value).
|
|
353
374
|
* @returns {number}
|
|
@@ -547,6 +568,25 @@ var WasmVm = class _WasmVm {
|
|
|
547
568
|
const ret = wasm.wasmvm_get_shared_buffer(this.__wbg_ptr);
|
|
548
569
|
return ret;
|
|
549
570
|
}
|
|
571
|
+
/**
|
|
572
|
+
* Send a keyboard event to the D1 input device.
|
|
573
|
+
*
|
|
574
|
+
* This is the primary way to send keyboard input to the VM when using
|
|
575
|
+
* the D1 touch/input device (as opposed to VirtIO input).
|
|
576
|
+
*
|
|
577
|
+
* # Arguments
|
|
578
|
+
* * `js_key_code` - JavaScript keyCode (e.g., 65 for 'A', 13 for Enter)
|
|
579
|
+
* * `pressed` - true for key press, false for key release
|
|
580
|
+
*
|
|
581
|
+
* Returns true if the event was sent successfully.
|
|
582
|
+
* @param {number} js_key_code
|
|
583
|
+
* @param {boolean} pressed
|
|
584
|
+
* @returns {boolean}
|
|
585
|
+
*/
|
|
586
|
+
send_d1_key_event(js_key_code, pressed) {
|
|
587
|
+
const ret = wasm.wasmvm_send_d1_key_event(this.__wbg_ptr, js_key_code, pressed);
|
|
588
|
+
return ret !== 0;
|
|
589
|
+
}
|
|
550
590
|
/**
|
|
551
591
|
* Send a mouse button event to the guest.
|
|
552
592
|
*
|
|
@@ -810,6 +850,31 @@ var WasmVm = class _WasmVm {
|
|
|
810
850
|
const ret = wasm.wasmvm_entry_pc(this.__wbg_ptr);
|
|
811
851
|
return BigInt.asUintN(64, ret);
|
|
812
852
|
}
|
|
853
|
+
/**
|
|
854
|
+
* Enable VirtIO 9P device for host directory mounting.
|
|
855
|
+
*
|
|
856
|
+
* This exposes a host directory to the guest kernel at the specified
|
|
857
|
+
* mount point. The JavaScript side must provide a `window.p9Host` object
|
|
858
|
+
* with the following methods:
|
|
859
|
+
* - `read(path)` - Returns Uint8Array of file contents
|
|
860
|
+
* - `write(path, data)` - Writes data to file, returns boolean
|
|
861
|
+
* - `readdir(path)` - Returns array of `{name, isDir}` objects
|
|
862
|
+
* - `exists(path)` - Returns boolean
|
|
863
|
+
* - `isDir(path)` - Returns boolean
|
|
864
|
+
*
|
|
865
|
+
* # Arguments
|
|
866
|
+
* * `host_path` - Path prefix for the host directory
|
|
867
|
+
* * `mount_tag` - Mount tag for guest to identify the mount
|
|
868
|
+
* @param {string} host_path
|
|
869
|
+
* @param {string} mount_tag
|
|
870
|
+
*/
|
|
871
|
+
enable_9p(host_path, mount_tag) {
|
|
872
|
+
const ptr0 = passStringToWasm0(host_path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
873
|
+
const len0 = WASM_VECTOR_LEN;
|
|
874
|
+
const ptr1 = passStringToWasm0(mount_tag, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
875
|
+
const len1 = WASM_VECTOR_LEN;
|
|
876
|
+
wasm.wasmvm_enable_9p(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
877
|
+
}
|
|
813
878
|
/**
|
|
814
879
|
* Get the halt code if the VM has halted.
|
|
815
880
|
* Code 0x5555 typically means successful shutdown (PASS).
|
|
@@ -1012,6 +1077,10 @@ function __wbg_get_imports() {
|
|
|
1012
1077
|
const ret = typeof arg0 === "function";
|
|
1013
1078
|
return ret;
|
|
1014
1079
|
};
|
|
1080
|
+
imports.wbg.__wbg___wbindgen_is_null_dfda7d66506c95b5 = function(arg0) {
|
|
1081
|
+
const ret = arg0 === null;
|
|
1082
|
+
return ret;
|
|
1083
|
+
};
|
|
1015
1084
|
imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
|
|
1016
1085
|
const ret = arg0 === void 0;
|
|
1017
1086
|
return ret;
|
|
@@ -1118,6 +1187,10 @@ function __wbg_get_imports() {
|
|
|
1118
1187
|
return ret;
|
|
1119
1188
|
}, arguments);
|
|
1120
1189
|
};
|
|
1190
|
+
imports.wbg.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) {
|
|
1191
|
+
const ret = arg0[arg1 >>> 0];
|
|
1192
|
+
return ret;
|
|
1193
|
+
};
|
|
1121
1194
|
imports.wbg.__wbg_get_af9dab7e9603ea93 = function() {
|
|
1122
1195
|
return handleError(function(arg0, arg1) {
|
|
1123
1196
|
const ret = Reflect.get(arg0, arg1);
|
|
@@ -1132,6 +1205,26 @@ function __wbg_get_imports() {
|
|
|
1132
1205
|
const ret = arg0.hardwareConcurrency;
|
|
1133
1206
|
return ret;
|
|
1134
1207
|
};
|
|
1208
|
+
imports.wbg.__wbg_instanceof_Object_577e21051f7bcb79 = function(arg0) {
|
|
1209
|
+
let result;
|
|
1210
|
+
try {
|
|
1211
|
+
result = arg0 instanceof Object;
|
|
1212
|
+
} catch (_) {
|
|
1213
|
+
result = false;
|
|
1214
|
+
}
|
|
1215
|
+
const ret = result;
|
|
1216
|
+
return ret;
|
|
1217
|
+
};
|
|
1218
|
+
imports.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function(arg0) {
|
|
1219
|
+
let result;
|
|
1220
|
+
try {
|
|
1221
|
+
result = arg0 instanceof Uint8Array;
|
|
1222
|
+
} catch (_) {
|
|
1223
|
+
result = false;
|
|
1224
|
+
}
|
|
1225
|
+
const ret = result;
|
|
1226
|
+
return ret;
|
|
1227
|
+
};
|
|
1135
1228
|
imports.wbg.__wbg_instanceof_Window_b5cf7783caa68180 = function(arg0) {
|
|
1136
1229
|
let result;
|
|
1137
1230
|
try {
|
|
@@ -1142,6 +1235,10 @@ function __wbg_get_imports() {
|
|
|
1142
1235
|
const ret = result;
|
|
1143
1236
|
return ret;
|
|
1144
1237
|
};
|
|
1238
|
+
imports.wbg.__wbg_isArray_51fd9e6422c0a395 = function(arg0) {
|
|
1239
|
+
const ret = Array.isArray(arg0);
|
|
1240
|
+
return ret;
|
|
1241
|
+
};
|
|
1145
1242
|
imports.wbg.__wbg_length_22ac23eaec9d8053 = function(arg0) {
|
|
1146
1243
|
const ret = arg0.length;
|
|
1147
1244
|
return ret;
|
|
@@ -1150,6 +1247,10 @@ function __wbg_get_imports() {
|
|
|
1150
1247
|
const ret = arg0.length;
|
|
1151
1248
|
return ret;
|
|
1152
1249
|
};
|
|
1250
|
+
imports.wbg.__wbg_length_d45040a40c570362 = function(arg0) {
|
|
1251
|
+
const ret = arg0.length;
|
|
1252
|
+
return ret;
|
|
1253
|
+
};
|
|
1153
1254
|
imports.wbg.__wbg_load_f1dd26e734971d92 = function() {
|
|
1154
1255
|
return handleError(function(arg0, arg1) {
|
|
1155
1256
|
const ret = Atomics.load(arg0, arg1 >>> 0);
|
|
@@ -1391,30 +1492,30 @@ function __wbg_get_imports() {
|
|
|
1391
1492
|
return ret;
|
|
1392
1493
|
}, arguments);
|
|
1393
1494
|
};
|
|
1394
|
-
imports.wbg.
|
|
1395
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1495
|
+
imports.wbg.__wbindgen_cast_1538354e022c36a6 = function(arg0, arg1) {
|
|
1496
|
+
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h612f8e24953b61d5, wasm_bindgen__convert__closures_____invoke__h260170fb96639bcf);
|
|
1396
1497
|
return ret;
|
|
1397
1498
|
};
|
|
1398
1499
|
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
1399
1500
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
1400
1501
|
return ret;
|
|
1401
1502
|
};
|
|
1402
|
-
imports.wbg.
|
|
1403
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1503
|
+
imports.wbg.__wbindgen_cast_2371841941b04e25 = function(arg0, arg1) {
|
|
1504
|
+
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h75e3a518a3f3beb0, wasm_bindgen__convert__closures_____invoke__h18739833ac56d704);
|
|
1404
1505
|
return ret;
|
|
1405
1506
|
};
|
|
1406
|
-
imports.wbg.
|
|
1407
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1408
|
-
return ret;
|
|
1409
|
-
};
|
|
1410
|
-
imports.wbg.__wbindgen_cast_b33b7ab8ffafb5fe = function(arg0, arg1) {
|
|
1411
|
-
const ret = makeClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h36a9954ef104e71a, wasm_bindgen__convert__closures_____invoke__h8c01b902d0cec50b);
|
|
1507
|
+
imports.wbg.__wbindgen_cast_31bf697c4579a85c = function(arg0, arg1) {
|
|
1508
|
+
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h75e3a518a3f3beb0, wasm_bindgen__convert__closures_____invoke__hb64b0e492ba30db3);
|
|
1412
1509
|
return ret;
|
|
1413
1510
|
};
|
|
1414
1511
|
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
|
|
1415
1512
|
const ret = arg0;
|
|
1416
1513
|
return ret;
|
|
1417
1514
|
};
|
|
1515
|
+
imports.wbg.__wbindgen_cast_f68bb92101f7c0ce = function(arg0, arg1) {
|
|
1516
|
+
const ret = makeClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h75e3a518a3f3beb0, wasm_bindgen__convert__closures_____invoke__hba8efd9a01e74992);
|
|
1517
|
+
return ret;
|
|
1518
|
+
};
|
|
1418
1519
|
imports.wbg.__wbindgen_init_externref_table = function() {
|
|
1419
1520
|
const table = wasm.__wbindgen_externrefs;
|
|
1420
1521
|
const offset = table.grow(4);
|