@remix_labs/hub-client 2.3348.0-dev → 2.3351.0-dev

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 (2) hide show
  1. package/miniwasi.js +18 -12
  2. package/package.json +1 -1
package/miniwasi.js CHANGED
@@ -36,7 +36,7 @@ class MiniWASI {
36
36
  }
37
37
 
38
38
  fd_seek(fd, offset_low, offset_high, whence, newOffset) {
39
- this.abort("unexpected fd_seek call");
39
+ return 70; // ESPIPE
40
40
  }
41
41
 
42
42
  clock_time_get(id, precision, time) {
@@ -66,8 +66,7 @@ class MiniWASI {
66
66
  }
67
67
 
68
68
  poll_oneoff(in_, out, nsub) {
69
- this.update();
70
- this.abort("unexpected poll_oneoff call");
69
+ return 58; // ENOTSUP
71
70
  }
72
71
 
73
72
  fd_write(fd, iov, iovcnt, pnum) {
@@ -83,6 +82,7 @@ class MiniWASI {
83
82
  output = console.error;
84
83
  break;
85
84
  default:
85
+ console.error("[groovebox miniwasi] filesystem not supported");
86
86
  return 8; // EBADF
87
87
  }
88
88
  let num = 0;
@@ -115,8 +115,20 @@ class MiniWASI {
115
115
  }
116
116
 
117
117
  fd_fdstat_get(fd, buf) {
118
+ if (fd > 2) {
119
+ console.error("[groovebox miniwasi] filesystem not supported");
120
+ return 8; // EBADF
121
+ }
118
122
  this.update();
119
- this.abort("unexpected fd_fdstat_get call");
123
+ // fdstat layout: fs_filetype(u8) + pad(1) + fs_flags(u16) + pad(4) + fs_rights_base(u64) + fs_rights_inheriting(u64)
124
+ const view = new DataView(this.memory.buffer);
125
+ view.setUint8(buf, 2); // FILETYPE_CHARACTER_DEVICE
126
+ view.setUint8(buf + 1, 0);
127
+ view.setUint16(buf + 2, 0, true);
128
+ view.setUint32(buf + 4, 0, true);
129
+ view.setBigUint64(buf + 8, 0n, true);
130
+ view.setBigUint64(buf + 16, 0n, true);
131
+ return 0;
120
132
  }
121
133
 
122
134
  args_sizes_get(ptr_count, ptr_sizes) {
@@ -131,10 +143,11 @@ class MiniWASI {
131
143
  }
132
144
 
133
145
  fd_prestat_get(fd, buf) {
146
+ console.error("[groovebox miniwasi] filesystem not supported");
134
147
  return 8; // EBADF
135
148
  }
136
-
137
149
  fd_prestat_dir_name(fd, path, path_len) {
150
+ console.error("[groovebox miniwasi] filesystem not supported");
138
151
  return 8; // EBADF
139
152
  }
140
153
 
@@ -171,13 +184,6 @@ class MiniWASI {
171
184
  proc_exit(code) {
172
185
  throw new ProcExit(code);
173
186
  }
174
-
175
- abort(msg) {
176
- let e = new Error();
177
- let stack = e.stack || "(no stack trace)";
178
- console.error("WASM ABORT: %s at %s", msg, stack);
179
- throw new WebAssembly.RuntimeError(msg);
180
- }
181
187
  }
182
188
 
183
189
  class ProcExit extends Error {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remix_labs/hub-client",
3
- "version": "2.3348.0-dev",
3
+ "version": "2.3351.0-dev",
4
4
  "description": "talk to the Hub web worker",
5
5
  "main": "node.js",
6
6
  "browser": "index.js",