@bytecodealliance/jco 1.32.1 → 1.34.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/README.md +12 -1
- package/dist/bundle.d.ts +2 -0
- package/dist/bundle.d.ts.map +1 -1
- package/dist/bundle.js +12 -0
- package/dist/bundle.js.map +1 -1
- package/dist/cmd/componentize.d.ts +33 -0
- package/dist/cmd/componentize.d.ts.map +1 -1
- package/dist/cmd/componentize.js +92 -8
- package/dist/cmd/componentize.js.map +1 -1
- package/dist/cmd/new.js +2 -1
- package/dist/cmd/new.js.map +1 -1
- package/dist/cmd/run.d.ts.map +1 -1
- package/dist/cmd/run.js +58 -1
- package/dist/cmd/run.js.map +1 -1
- package/dist/cmd/transpile.d.ts +5 -1
- package/dist/cmd/transpile.d.ts.map +1 -1
- package/dist/cmd/transpile.js +124 -0
- package/dist/cmd/transpile.js.map +1 -1
- package/dist/engine-compat.d.ts +11 -0
- package/dist/engine-compat.d.ts.map +1 -0
- package/dist/engine-compat.js +56 -0
- package/dist/engine-compat.js.map +1 -0
- package/dist/jco.js +12 -1
- package/dist/jco.js.map +1 -1
- package/dist/node-builtins/assert.d.ts +3 -0
- package/dist/node-builtins/assert.d.ts.map +1 -0
- package/dist/node-builtins/assert.js +65 -0
- package/dist/node-builtins/assert.js.map +1 -0
- package/dist/node-builtins/async-hooks.d.ts +3 -0
- package/dist/node-builtins/async-hooks.d.ts.map +1 -0
- package/dist/node-builtins/async-hooks.js +27 -0
- package/dist/node-builtins/async-hooks.js.map +1 -0
- package/dist/node-builtins/buffer.d.ts +4 -0
- package/dist/node-builtins/buffer.d.ts.map +1 -0
- package/dist/node-builtins/buffer.js +87 -0
- package/dist/node-builtins/buffer.js.map +1 -0
- package/dist/node-builtins/child-process.d.ts +3 -0
- package/dist/node-builtins/child-process.d.ts.map +1 -0
- package/dist/node-builtins/child-process.js +23 -0
- package/dist/node-builtins/child-process.js.map +1 -0
- package/dist/node-builtins/cluster.d.ts +3 -0
- package/dist/node-builtins/cluster.d.ts.map +1 -0
- package/dist/node-builtins/cluster.js +28 -0
- package/dist/node-builtins/cluster.js.map +1 -0
- package/dist/node-builtins/console.d.ts +3 -0
- package/dist/node-builtins/console.d.ts.map +1 -0
- package/dist/node-builtins/console.js +39 -0
- package/dist/node-builtins/console.js.map +1 -0
- package/dist/node-builtins/crypto.d.ts +3 -0
- package/dist/node-builtins/crypto.d.ts.map +1 -0
- package/dist/node-builtins/crypto.js +5 -0
- package/dist/node-builtins/crypto.js.map +1 -0
- package/dist/node-builtins/dgram.d.ts +4 -0
- package/dist/node-builtins/dgram.d.ts.map +1 -0
- package/dist/node-builtins/dgram.js +13 -0
- package/dist/node-builtins/dgram.js.map +1 -0
- package/dist/node-builtins/diagnostics-channel.d.ts +3 -0
- package/dist/node-builtins/diagnostics-channel.d.ts.map +1 -0
- package/dist/node-builtins/diagnostics-channel.js +26 -0
- package/dist/node-builtins/diagnostics-channel.js.map +1 -0
- package/dist/node-builtins/dns.d.ts +3 -0
- package/dist/node-builtins/dns.d.ts.map +1 -0
- package/dist/node-builtins/dns.js +12 -0
- package/dist/node-builtins/dns.js.map +1 -0
- package/dist/node-builtins/domain.d.ts +3 -0
- package/dist/node-builtins/domain.d.ts.map +1 -0
- package/dist/node-builtins/domain.js +19 -0
- package/dist/node-builtins/domain.js.map +1 -0
- package/dist/node-builtins/events.d.ts +3 -0
- package/dist/node-builtins/events.d.ts.map +1 -0
- package/dist/node-builtins/events.js +39 -0
- package/dist/node-builtins/events.js.map +1 -0
- package/dist/node-builtins/ffi.d.ts +3 -0
- package/dist/node-builtins/ffi.d.ts.map +1 -0
- package/dist/node-builtins/ffi.js +59 -0
- package/dist/node-builtins/ffi.js.map +1 -0
- package/dist/node-builtins/fs.d.ts +3 -0
- package/dist/node-builtins/fs.d.ts.map +1 -0
- package/dist/node-builtins/fs.js +16 -0
- package/dist/node-builtins/fs.js.map +1 -0
- package/dist/node-builtins/globals.d.ts +19 -0
- package/dist/node-builtins/globals.d.ts.map +1 -0
- package/dist/node-builtins/globals.js +56 -0
- package/dist/node-builtins/globals.js.map +1 -0
- package/dist/node-builtins/http-common.d.ts +6 -0
- package/dist/node-builtins/http-common.d.ts.map +1 -0
- package/dist/node-builtins/http-common.js +111 -0
- package/dist/node-builtins/http-common.js.map +1 -0
- package/dist/node-builtins/http.d.ts +4 -0
- package/dist/node-builtins/http.d.ts.map +1 -0
- package/dist/node-builtins/http.js +15 -0
- package/dist/node-builtins/http.js.map +1 -0
- package/dist/node-builtins/http2.d.ts +4 -0
- package/dist/node-builtins/http2.d.ts.map +1 -0
- package/dist/node-builtins/http2.js +79 -0
- package/dist/node-builtins/http2.js.map +1 -0
- package/dist/node-builtins/https.d.ts +3 -0
- package/dist/node-builtins/https.d.ts.map +1 -0
- package/dist/node-builtins/https.js +5 -0
- package/dist/node-builtins/https.js.map +1 -0
- package/dist/node-builtins/index.d.ts +10 -0
- package/dist/node-builtins/index.d.ts.map +1 -0
- package/dist/node-builtins/index.js +164 -0
- package/dist/node-builtins/index.js.map +1 -0
- package/dist/node-builtins/inspector.d.ts +12 -0
- package/dist/node-builtins/inspector.d.ts.map +1 -0
- package/dist/node-builtins/inspector.js +70 -0
- package/dist/node-builtins/inspector.js.map +1 -0
- package/dist/node-builtins/module.d.ts +3 -0
- package/dist/node-builtins/module.d.ts.map +1 -0
- package/dist/node-builtins/module.js +55 -0
- package/dist/node-builtins/module.js.map +1 -0
- package/dist/node-builtins/net.d.ts +3 -0
- package/dist/node-builtins/net.d.ts.map +1 -0
- package/dist/node-builtins/net.js +46 -0
- package/dist/node-builtins/net.js.map +1 -0
- package/dist/node-builtins/os.d.ts +3 -0
- package/dist/node-builtins/os.d.ts.map +1 -0
- package/dist/node-builtins/os.js +39 -0
- package/dist/node-builtins/os.js.map +1 -0
- package/dist/node-builtins/path.d.ts +3 -0
- package/dist/node-builtins/path.d.ts.map +1 -0
- package/dist/node-builtins/path.js +91 -0
- package/dist/node-builtins/path.js.map +1 -0
- package/dist/node-builtins/perf-hooks.d.ts +3 -0
- package/dist/node-builtins/perf-hooks.d.ts.map +1 -0
- package/dist/node-builtins/perf-hooks.js +12 -0
- package/dist/node-builtins/perf-hooks.js.map +1 -0
- package/dist/node-builtins/process.d.ts +3 -0
- package/dist/node-builtins/process.d.ts.map +1 -0
- package/dist/node-builtins/process.js +9 -0
- package/dist/node-builtins/process.js.map +1 -0
- package/dist/node-builtins/querystring.d.ts +3 -0
- package/dist/node-builtins/querystring.d.ts.map +1 -0
- package/dist/node-builtins/querystring.js +18 -0
- package/dist/node-builtins/querystring.js.map +1 -0
- package/dist/node-builtins/readline.d.ts +3 -0
- package/dist/node-builtins/readline.d.ts.map +1 -0
- package/dist/node-builtins/readline.js +11 -0
- package/dist/node-builtins/readline.js.map +1 -0
- package/dist/node-builtins/repl.d.ts +9 -0
- package/dist/node-builtins/repl.d.ts.map +1 -0
- package/dist/node-builtins/repl.js +12 -0
- package/dist/node-builtins/repl.js.map +1 -0
- package/dist/node-builtins/shared.d.ts +24 -0
- package/dist/node-builtins/shared.d.ts.map +1 -0
- package/dist/node-builtins/shared.js +68 -0
- package/dist/node-builtins/shared.js.map +1 -0
- package/dist/node-builtins/sqlite.d.ts +3 -0
- package/dist/node-builtins/sqlite.d.ts.map +1 -0
- package/dist/node-builtins/sqlite.js +9 -0
- package/dist/node-builtins/sqlite.js.map +1 -0
- package/dist/node-builtins/stream.d.ts +3 -0
- package/dist/node-builtins/stream.d.ts.map +1 -0
- package/dist/node-builtins/stream.js +64 -0
- package/dist/node-builtins/stream.js.map +1 -0
- package/dist/node-builtins/string-decoder.d.ts +3 -0
- package/dist/node-builtins/string-decoder.d.ts.map +1 -0
- package/dist/node-builtins/string-decoder.js +14 -0
- package/dist/node-builtins/string-decoder.js.map +1 -0
- package/dist/node-builtins/test.d.ts +4 -0
- package/dist/node-builtins/test.d.ts.map +1 -0
- package/dist/node-builtins/test.js +8 -0
- package/dist/node-builtins/test.js.map +1 -0
- package/dist/node-builtins/timers.d.ts +4 -0
- package/dist/node-builtins/timers.d.ts.map +1 -0
- package/dist/node-builtins/timers.js +9 -0
- package/dist/node-builtins/timers.js.map +1 -0
- package/dist/node-builtins/tls.d.ts +3 -0
- package/dist/node-builtins/tls.d.ts.map +1 -0
- package/dist/node-builtins/tls.js +10 -0
- package/dist/node-builtins/tls.js.map +1 -0
- package/dist/node-builtins/trace-events.d.ts +3 -0
- package/dist/node-builtins/trace-events.d.ts.map +1 -0
- package/dist/node-builtins/trace-events.js +9 -0
- package/dist/node-builtins/trace-events.js.map +1 -0
- package/dist/node-builtins/tty.d.ts +8 -0
- package/dist/node-builtins/tty.d.ts.map +1 -0
- package/dist/node-builtins/tty.js +12 -0
- package/dist/node-builtins/tty.js.map +1 -0
- package/dist/node-builtins/types.d.ts +159 -0
- package/dist/node-builtins/types.d.ts.map +1 -0
- package/dist/node-builtins/types.js +2 -0
- package/dist/node-builtins/types.js.map +1 -0
- package/dist/node-builtins/unenv.d.ts +6 -0
- package/dist/node-builtins/unenv.d.ts.map +1 -0
- package/dist/node-builtins/unenv.js +27 -0
- package/dist/node-builtins/unenv.js.map +1 -0
- package/dist/node-builtins/url-pattern.d.ts +8 -0
- package/dist/node-builtins/url-pattern.d.ts.map +1 -0
- package/dist/node-builtins/url-pattern.js +19 -0
- package/dist/node-builtins/url-pattern.js.map +1 -0
- package/dist/node-builtins/url.d.ts +4 -0
- package/dist/node-builtins/url.d.ts.map +1 -0
- package/dist/node-builtins/url.js +100 -0
- package/dist/node-builtins/url.js.map +1 -0
- package/dist/node-builtins/util.d.ts +3 -0
- package/dist/node-builtins/util.d.ts.map +1 -0
- package/dist/node-builtins/util.js +7 -0
- package/dist/node-builtins/util.js.map +1 -0
- package/dist/node-builtins/v8.d.ts +3 -0
- package/dist/node-builtins/v8.d.ts.map +1 -0
- package/dist/node-builtins/v8.js +6 -0
- package/dist/node-builtins/v8.js.map +1 -0
- package/dist/node-builtins/vfs.d.ts +3 -0
- package/dist/node-builtins/vfs.d.ts.map +1 -0
- package/dist/node-builtins/vfs.js +42 -0
- package/dist/node-builtins/vfs.js.map +1 -0
- package/dist/node-builtins/vm.d.ts +4 -0
- package/dist/node-builtins/vm.d.ts.map +1 -0
- package/dist/node-builtins/vm.js +6 -0
- package/dist/node-builtins/vm.js.map +1 -0
- package/dist/node-builtins/wasi-sockets.d.ts +10 -0
- package/dist/node-builtins/wasi-sockets.d.ts.map +1 -0
- package/dist/node-builtins/wasi-sockets.js +25 -0
- package/dist/node-builtins/wasi-sockets.js.map +1 -0
- package/dist/node-builtins/wasi.d.ts +10 -0
- package/dist/node-builtins/wasi.d.ts.map +1 -0
- package/dist/node-builtins/wasi.js +14 -0
- package/dist/node-builtins/wasi.js.map +1 -0
- package/dist/node-builtins/worker-threads.d.ts +3 -0
- package/dist/node-builtins/worker-threads.d.ts.map +1 -0
- package/dist/node-builtins/worker-threads.js +16 -0
- package/dist/node-builtins/worker-threads.js.map +1 -0
- package/dist/node-builtins/zlib.d.ts +3 -0
- package/dist/node-builtins/zlib.d.ts.map +1 -0
- package/dist/node-builtins/zlib.js +6 -0
- package/dist/node-builtins/zlib.js.map +1 -0
- package/dist/node-wit.d.ts +102 -0
- package/dist/node-wit.d.ts.map +1 -0
- package/dist/node-wit.js +469 -0
- package/dist/node-wit.js.map +1 -0
- package/lib/wasi_snapshot_preview1.command.wasm +0 -0
- package/lib/wasi_snapshot_preview1.reactor.wasm +0 -0
- package/lib/wit/builtin/0.2.10/wasi-clocks/package.wit +35 -0
- package/lib/wit/builtin/0.2.10/wasi-io/package.wit +47 -0
- package/lib/wit/builtin/0.2.10/wasi-sockets/package.wit +168 -0
- package/lib/wit/builtin/jco-node-0.1.0/child-process.wit +42 -0
- package/lib/wit/builtin/jco-node-0.1.0/cluster.wit +112 -0
- package/lib/wit/builtin/jco-node-0.1.0/console.wit +12 -0
- package/lib/wit/builtin/jco-node-0.1.0/dgram.wit +142 -0
- package/lib/wit/builtin/jco-node-0.1.0/dns.wit +145 -0
- package/lib/wit/builtin/jco-node-0.1.0/ffi.wit +116 -0
- package/lib/wit/builtin/jco-node-0.1.0/fs.wit +208 -0
- package/lib/wit/builtin/jco-node-0.1.0/http.wit +151 -0
- package/lib/wit/builtin/jco-node-0.1.0/http2.wit +190 -0
- package/lib/wit/builtin/jco-node-0.1.0/inspector.wit +142 -0
- package/lib/wit/builtin/jco-node-0.1.0/os.wit +120 -0
- package/lib/wit/builtin/jco-node-0.1.0/process.wit +245 -0
- package/lib/wit/builtin/jco-node-0.1.0/sqlite.wit +154 -0
- package/lib/wit/builtin/jco-node-0.1.0/tls.wit +108 -0
- package/lib/wit/builtin/jco-node-0.1.0/trace-events.wit +27 -0
- package/lib/wit/builtin/jco-node-0.1.0/tty.wit +59 -0
- package/lib/wit/builtin/jco-node-0.1.0/types.wit +12 -0
- package/lib/wit/builtin/jco-node-0.1.0/v8.wit +102 -0
- package/lib/wit/builtin/jco-node-0.1.0/wasi.wit +57 -0
- package/lib/wit/builtin/jco-node-0.1.0/worker-threads.wit +67 -0
- package/lib/wit/builtin/jco-node-0.1.0/zlib.wit +77 -0
- package/lib/wit/builtin/wasi-tls-0.2.0-draft/LICENSE.md +8 -0
- package/lib/wit/builtin/wasi-tls-0.2.0-draft/README.md +25 -0
- package/lib/wit/builtin/wasi-tls-0.2.0-draft/deps/io/package.wit +66 -0
- package/lib/wit/builtin/wasi-tls-0.2.0-draft/types.wit +27 -0
- package/lib/wit/builtin/wasi-tls-0.2.0-draft/world.wit +8 -0
- package/package.json +9 -5
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
package wasi:clocks@0.2.10;
|
|
2
|
+
|
|
3
|
+
interface monotonic-clock {
|
|
4
|
+
use wasi:io/poll@0.2.10.{pollable};
|
|
5
|
+
|
|
6
|
+
type instant = u64;
|
|
7
|
+
type duration = u64;
|
|
8
|
+
now: func() -> instant;
|
|
9
|
+
resolution: func() -> duration;
|
|
10
|
+
subscribe-instant: func(when: instant) -> pollable;
|
|
11
|
+
subscribe-duration: func(when: duration) -> pollable;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface wall-clock {
|
|
15
|
+
record datetime {
|
|
16
|
+
seconds: u64,
|
|
17
|
+
nanoseconds: u32,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
now: func() -> datetime;
|
|
21
|
+
resolution: func() -> datetime;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface timezone {
|
|
25
|
+
use wall-clock.{datetime};
|
|
26
|
+
|
|
27
|
+
record timezone-display {
|
|
28
|
+
utc-offset: s32,
|
|
29
|
+
name: string,
|
|
30
|
+
in-daylight-saving-time: bool,
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
display: func(when: datetime) -> timezone-display;
|
|
34
|
+
utc-offset: func(when: datetime) -> s32;
|
|
35
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
package wasi:io@0.2.10;
|
|
2
|
+
|
|
3
|
+
interface error {
|
|
4
|
+
resource error {
|
|
5
|
+
to-debug-string: func() -> string;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface poll {
|
|
10
|
+
resource pollable {
|
|
11
|
+
ready: func() -> bool;
|
|
12
|
+
block: func();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
poll: func(in: list<borrow<pollable>>) -> list<u32>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface streams {
|
|
19
|
+
use error.{error};
|
|
20
|
+
use poll.{pollable};
|
|
21
|
+
|
|
22
|
+
variant stream-error {
|
|
23
|
+
last-operation-failed(error),
|
|
24
|
+
closed,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
resource input-stream {
|
|
28
|
+
read: func(len: u64) -> result<list<u8>, stream-error>;
|
|
29
|
+
blocking-read: func(len: u64) -> result<list<u8>, stream-error>;
|
|
30
|
+
skip: func(len: u64) -> result<u64, stream-error>;
|
|
31
|
+
blocking-skip: func(len: u64) -> result<u64, stream-error>;
|
|
32
|
+
subscribe: func() -> pollable;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
resource output-stream {
|
|
36
|
+
check-write: func() -> result<u64, stream-error>;
|
|
37
|
+
write: func(contents: list<u8>) -> result<_, stream-error>;
|
|
38
|
+
blocking-write-and-flush: func(contents: list<u8>) -> result<_, stream-error>;
|
|
39
|
+
flush: func() -> result<_, stream-error>;
|
|
40
|
+
blocking-flush: func() -> result<_, stream-error>;
|
|
41
|
+
subscribe: func() -> pollable;
|
|
42
|
+
write-zeroes: func(len: u64) -> result<_, stream-error>;
|
|
43
|
+
blocking-write-zeroes-and-flush: func(len: u64) -> result<_, stream-error>;
|
|
44
|
+
splice: func(src: borrow<input-stream>, len: u64) -> result<u64, stream-error>;
|
|
45
|
+
blocking-splice: func(src: borrow<input-stream>, len: u64) -> result<u64, stream-error>;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
package wasi:sockets@0.2.10;
|
|
2
|
+
|
|
3
|
+
interface network {
|
|
4
|
+
use wasi:io/error@0.2.10.{error};
|
|
5
|
+
|
|
6
|
+
resource network {
|
|
7
|
+
/// Work around a ComponentizeJS 0.22 bindings bug: it omits the wrapper
|
|
8
|
+
/// class for a methodless resource when that resource crosses interfaces.
|
|
9
|
+
/// This method is deliberately never called and can be removed once the
|
|
10
|
+
/// bindings generator handles the canonical methodless WIT declaration.
|
|
11
|
+
noop: func();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
enum error-code {
|
|
15
|
+
unknown,
|
|
16
|
+
access-denied,
|
|
17
|
+
not-supported,
|
|
18
|
+
invalid-argument,
|
|
19
|
+
out-of-memory,
|
|
20
|
+
timeout,
|
|
21
|
+
concurrency-conflict,
|
|
22
|
+
not-in-progress,
|
|
23
|
+
would-block,
|
|
24
|
+
invalid-state,
|
|
25
|
+
new-socket-limit,
|
|
26
|
+
address-not-bindable,
|
|
27
|
+
address-in-use,
|
|
28
|
+
remote-unreachable,
|
|
29
|
+
connection-refused,
|
|
30
|
+
connection-reset,
|
|
31
|
+
connection-aborted,
|
|
32
|
+
datagram-too-large,
|
|
33
|
+
name-unresolvable,
|
|
34
|
+
temporary-resolver-failure,
|
|
35
|
+
permanent-resolver-failure,
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
enum ip-address-family { ipv4, ipv6 }
|
|
39
|
+
type ipv4-address = tuple<u8, u8, u8, u8>;
|
|
40
|
+
type ipv6-address = tuple<u16, u16, u16, u16, u16, u16, u16, u16>;
|
|
41
|
+
variant ip-address { ipv4(ipv4-address), ipv6(ipv6-address) }
|
|
42
|
+
|
|
43
|
+
record ipv4-socket-address {
|
|
44
|
+
port: u16,
|
|
45
|
+
address: ipv4-address,
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
record ipv6-socket-address {
|
|
49
|
+
port: u16,
|
|
50
|
+
flow-info: u32,
|
|
51
|
+
address: ipv6-address,
|
|
52
|
+
scope-id: u32,
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
variant ip-socket-address { ipv4(ipv4-socket-address), ipv6(ipv6-socket-address) }
|
|
56
|
+
network-error-code: func(err: borrow<error>) -> option<error-code>;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
interface instance-network {
|
|
60
|
+
use network.{network};
|
|
61
|
+
instance-network: func() -> network;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
interface udp {
|
|
65
|
+
use wasi:io/poll@0.2.10.{pollable};
|
|
66
|
+
use network.{network, error-code, ip-socket-address, ip-address-family};
|
|
67
|
+
|
|
68
|
+
record incoming-datagram {
|
|
69
|
+
data: list<u8>,
|
|
70
|
+
remote-address: ip-socket-address,
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
record outgoing-datagram {
|
|
74
|
+
data: list<u8>,
|
|
75
|
+
remote-address: option<ip-socket-address>,
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
resource udp-socket {
|
|
79
|
+
start-bind: func(network: borrow<network>, local-address: ip-socket-address) -> result<_, error-code>;
|
|
80
|
+
finish-bind: func() -> result<_, error-code>;
|
|
81
|
+
%stream: func(remote-address: option<ip-socket-address>) -> result<tuple<incoming-datagram-stream, outgoing-datagram-stream>, error-code>;
|
|
82
|
+
local-address: func() -> result<ip-socket-address, error-code>;
|
|
83
|
+
remote-address: func() -> result<ip-socket-address, error-code>;
|
|
84
|
+
address-family: func() -> ip-address-family;
|
|
85
|
+
unicast-hop-limit: func() -> result<u8, error-code>;
|
|
86
|
+
set-unicast-hop-limit: func(value: u8) -> result<_, error-code>;
|
|
87
|
+
receive-buffer-size: func() -> result<u64, error-code>;
|
|
88
|
+
set-receive-buffer-size: func(value: u64) -> result<_, error-code>;
|
|
89
|
+
send-buffer-size: func() -> result<u64, error-code>;
|
|
90
|
+
set-send-buffer-size: func(value: u64) -> result<_, error-code>;
|
|
91
|
+
subscribe: func() -> pollable;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
resource incoming-datagram-stream {
|
|
95
|
+
receive: func(max-results: u64) -> result<list<incoming-datagram>, error-code>;
|
|
96
|
+
subscribe: func() -> pollable;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
resource outgoing-datagram-stream {
|
|
100
|
+
check-send: func() -> result<u64, error-code>;
|
|
101
|
+
send: func(datagrams: list<outgoing-datagram>) -> result<u64, error-code>;
|
|
102
|
+
subscribe: func() -> pollable;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
interface udp-create-socket {
|
|
107
|
+
use network.{network, error-code, ip-address-family};
|
|
108
|
+
use udp.{udp-socket};
|
|
109
|
+
create-udp-socket: func(address-family: ip-address-family) -> result<udp-socket, error-code>;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
interface tcp {
|
|
113
|
+
use wasi:io/streams@0.2.10.{input-stream, output-stream};
|
|
114
|
+
use wasi:io/poll@0.2.10.{pollable};
|
|
115
|
+
use wasi:clocks/monotonic-clock@0.2.10.{duration};
|
|
116
|
+
use network.{network, error-code, ip-socket-address, ip-address-family};
|
|
117
|
+
|
|
118
|
+
enum shutdown-type { receive, send, both }
|
|
119
|
+
|
|
120
|
+
resource tcp-socket {
|
|
121
|
+
start-bind: func(network: borrow<network>, local-address: ip-socket-address) -> result<_, error-code>;
|
|
122
|
+
finish-bind: func() -> result<_, error-code>;
|
|
123
|
+
start-connect: func(network: borrow<network>, remote-address: ip-socket-address) -> result<_, error-code>;
|
|
124
|
+
finish-connect: func() -> result<tuple<input-stream, output-stream>, error-code>;
|
|
125
|
+
start-listen: func() -> result<_, error-code>;
|
|
126
|
+
finish-listen: func() -> result<_, error-code>;
|
|
127
|
+
accept: func() -> result<tuple<tcp-socket, input-stream, output-stream>, error-code>;
|
|
128
|
+
local-address: func() -> result<ip-socket-address, error-code>;
|
|
129
|
+
remote-address: func() -> result<ip-socket-address, error-code>;
|
|
130
|
+
is-listening: func() -> bool;
|
|
131
|
+
address-family: func() -> ip-address-family;
|
|
132
|
+
set-listen-backlog-size: func(value: u64) -> result<_, error-code>;
|
|
133
|
+
keep-alive-enabled: func() -> result<bool, error-code>;
|
|
134
|
+
set-keep-alive-enabled: func(value: bool) -> result<_, error-code>;
|
|
135
|
+
keep-alive-idle-time: func() -> result<duration, error-code>;
|
|
136
|
+
set-keep-alive-idle-time: func(value: duration) -> result<_, error-code>;
|
|
137
|
+
keep-alive-interval: func() -> result<duration, error-code>;
|
|
138
|
+
set-keep-alive-interval: func(value: duration) -> result<_, error-code>;
|
|
139
|
+
keep-alive-count: func() -> result<u32, error-code>;
|
|
140
|
+
set-keep-alive-count: func(value: u32) -> result<_, error-code>;
|
|
141
|
+
hop-limit: func() -> result<u8, error-code>;
|
|
142
|
+
set-hop-limit: func(value: u8) -> result<_, error-code>;
|
|
143
|
+
receive-buffer-size: func() -> result<u64, error-code>;
|
|
144
|
+
set-receive-buffer-size: func(value: u64) -> result<_, error-code>;
|
|
145
|
+
send-buffer-size: func() -> result<u64, error-code>;
|
|
146
|
+
set-send-buffer-size: func(value: u64) -> result<_, error-code>;
|
|
147
|
+
subscribe: func() -> pollable;
|
|
148
|
+
shutdown: func(shutdown-type: shutdown-type) -> result<_, error-code>;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
interface tcp-create-socket {
|
|
153
|
+
use network.{network, error-code, ip-address-family};
|
|
154
|
+
use tcp.{tcp-socket};
|
|
155
|
+
create-tcp-socket: func(address-family: ip-address-family) -> result<tcp-socket, error-code>;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
interface ip-name-lookup {
|
|
159
|
+
use wasi:io/poll@0.2.10.{pollable};
|
|
160
|
+
use network.{network, error-code, ip-address};
|
|
161
|
+
|
|
162
|
+
resource resolve-address-stream {
|
|
163
|
+
resolve-next-address: func() -> result<option<ip-address>, error-code>;
|
|
164
|
+
subscribe: func() -> pollable;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
resolve-addresses: func(network: borrow<network>, name: string) -> result<resolve-address-stream, error-code>;
|
|
168
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
package jco:node@0.1.0;
|
|
2
|
+
|
|
3
|
+
interface child-process {
|
|
4
|
+
use types.{env-vars};
|
|
5
|
+
|
|
6
|
+
record process-error {
|
|
7
|
+
name: string,
|
|
8
|
+
message: string,
|
|
9
|
+
code: option<string>,
|
|
10
|
+
errno: option<s32>,
|
|
11
|
+
syscall: option<string>,
|
|
12
|
+
path: option<string>,
|
|
13
|
+
spawnargs: list<string>,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
record spawn-options {
|
|
17
|
+
cwd: option<string>,
|
|
18
|
+
cwd-is-url: bool,
|
|
19
|
+
env: option<env-vars>,
|
|
20
|
+
input: option<list<u8>>,
|
|
21
|
+
timeout: u64,
|
|
22
|
+
kill-signal: string,
|
|
23
|
+
max-buffer: u64,
|
|
24
|
+
shell: option<string>,
|
|
25
|
+
stdio: option<list<string>>,
|
|
26
|
+
windows-hide: bool,
|
|
27
|
+
windows-verbatim-arguments: bool,
|
|
28
|
+
uid: option<u32>,
|
|
29
|
+
gid: option<u32>,
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
record spawn-output {
|
|
33
|
+
pid: option<u32>,
|
|
34
|
+
status: option<s32>,
|
|
35
|
+
signal: option<string>,
|
|
36
|
+
stdout: option<list<u8>>,
|
|
37
|
+
stderr: option<list<u8>>,
|
|
38
|
+
error: option<process-error>,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
spawn-sync: func(command: string, args: list<string>, options: spawn-options) -> spawn-output;
|
|
42
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
package jco:node@0.1.0;
|
|
2
|
+
|
|
3
|
+
/// Host-backed adapter for Node's `cluster` module.
|
|
4
|
+
///
|
|
5
|
+
/// WASI has no process model, so unlike Jco's other Node builtins this cannot be a portable
|
|
6
|
+
/// shim. The host owns a real `node:cluster` and this interface exposes just enough of it to
|
|
7
|
+
/// rebuild the observable JS surface guest-side.
|
|
8
|
+
///
|
|
9
|
+
/// Cluster is push-based and WIT is pull-based, so host events are queued and the guest drains
|
|
10
|
+
/// them with `drain-events`. See
|
|
11
|
+
/// `docs/src/interop/nodejs-builtins/supported-modules/cluster.md`
|
|
12
|
+
/// for the delivery-timing difference this creates.
|
|
13
|
+
interface cluster {
|
|
14
|
+
use types.{env-vars};
|
|
15
|
+
|
|
16
|
+
/// Lifecycle state of a worker, mirroring Node's `worker.state`.
|
|
17
|
+
enum worker-state {
|
|
18
|
+
none,
|
|
19
|
+
online,
|
|
20
|
+
listening,
|
|
21
|
+
disconnected,
|
|
22
|
+
dead,
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/// Snapshot of a worker. `process` is deliberately absent: it is a `ChildProcess`, which
|
|
26
|
+
/// cannot cross this boundary. The guest surfaces an explicit error for it instead.
|
|
27
|
+
record worker-info {
|
|
28
|
+
id: u32,
|
|
29
|
+
state: worker-state,
|
|
30
|
+
exited-after-disconnect: bool,
|
|
31
|
+
connected: bool,
|
|
32
|
+
dead: bool,
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/// How a worker exited. `signal` is empty when the worker exited normally.
|
|
36
|
+
record exit-info {
|
|
37
|
+
id: u32,
|
|
38
|
+
code: s32,
|
|
39
|
+
signal: string,
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/// A message sent by a worker, carried as JSON because WIT has no dynamic value type.
|
|
43
|
+
record message-info {
|
|
44
|
+
id: u32,
|
|
45
|
+
json: string,
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/// Settings the host applies to newly forked workers.
|
|
49
|
+
record settings {
|
|
50
|
+
silent: bool,
|
|
51
|
+
args: list<string>,
|
|
52
|
+
cwd: string,
|
|
53
|
+
scheduling-policy: u8,
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/// An event the host observed since the last drain, in emission order.
|
|
57
|
+
variant event {
|
|
58
|
+
fork(u32),
|
|
59
|
+
online(u32),
|
|
60
|
+
disconnect(u32),
|
|
61
|
+
exit(exit-info),
|
|
62
|
+
message(message-info),
|
|
63
|
+
setup,
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/// Why an operation the guest asked for cannot be carried out.
|
|
67
|
+
variant error {
|
|
68
|
+
/// The runtime has no process model at all (for example, a browser host).
|
|
69
|
+
unsupported(string),
|
|
70
|
+
/// No worker with this id is known.
|
|
71
|
+
no-such-worker(u32),
|
|
72
|
+
/// The host's cluster call failed.
|
|
73
|
+
failed(string),
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/// Whether this instance is the cluster primary. False in a forked worker.
|
|
77
|
+
is-primary: func() -> bool;
|
|
78
|
+
|
|
79
|
+
/// The current worker's info, or none when running as the primary.
|
|
80
|
+
current-worker: func() -> option<worker-info>;
|
|
81
|
+
|
|
82
|
+
/// Fork a worker, re-executing the host entry so the component runs again as a worker.
|
|
83
|
+
fork: func(env: env-vars) -> result<worker-info, error>;
|
|
84
|
+
|
|
85
|
+
/// Every worker the host currently knows about.
|
|
86
|
+
list-workers: func() -> list<worker-info>;
|
|
87
|
+
|
|
88
|
+
/// Re-read one worker, so guest-side state can be refreshed after events.
|
|
89
|
+
get-worker: func(id: u32) -> result<worker-info, error>;
|
|
90
|
+
|
|
91
|
+
/// Send a JSON-encoded message to a worker, or to the primary when called from a worker.
|
|
92
|
+
send: func(id: u32, json: string) -> result<_, error>;
|
|
93
|
+
|
|
94
|
+
/// Disconnect one worker.
|
|
95
|
+
disconnect-worker: func(id: u32) -> result<_, error>;
|
|
96
|
+
|
|
97
|
+
/// Disconnect every worker.
|
|
98
|
+
disconnect-all: func() -> result<_, error>;
|
|
99
|
+
|
|
100
|
+
/// Signal a worker. An empty signal means the host default (`SIGTERM`).
|
|
101
|
+
kill: func(id: u32, signal: string) -> result<_, error>;
|
|
102
|
+
|
|
103
|
+
/// Read the settings the host will apply to new workers.
|
|
104
|
+
get-settings: func() -> settings;
|
|
105
|
+
|
|
106
|
+
/// Apply settings for subsequent forks. Fails for settings the host cannot honour, such as
|
|
107
|
+
/// `exec`, which is the host runner rather than a guest file.
|
|
108
|
+
set-settings: func(value: settings) -> result<_, error>;
|
|
109
|
+
|
|
110
|
+
/// Take every event queued since the last call, oldest first.
|
|
111
|
+
drain-events: func() -> list<event>;
|
|
112
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
package jco:node@0.1.0;
|
|
2
|
+
|
|
3
|
+
interface console {
|
|
4
|
+
enum output-destination {
|
|
5
|
+
stdout,
|
|
6
|
+
stderr,
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
write: func(destination: output-destination, value: string);
|
|
10
|
+
is-terminal: func(destination: output-destination) -> bool;
|
|
11
|
+
color-depth: func(destination: output-destination) -> u8;
|
|
12
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
package jco:node@0.1.0;
|
|
2
|
+
|
|
3
|
+
/// Explicit UDP capability. Guest-owned callbacks deliver DNS results, send
|
|
4
|
+
/// completions and datagrams between component entry tasks. No Node objects,
|
|
5
|
+
/// descriptors, or implicit networking authority cross this interface.
|
|
6
|
+
interface dgram {
|
|
7
|
+
variant errno {
|
|
8
|
+
number(s64),
|
|
9
|
+
symbolic(string),
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
record buffer-error-info {
|
|
13
|
+
errno: f64,
|
|
14
|
+
code: string,
|
|
15
|
+
message: string,
|
|
16
|
+
syscall: string,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
record error {
|
|
20
|
+
name: string,
|
|
21
|
+
message: string,
|
|
22
|
+
code: option<string>,
|
|
23
|
+
errno: option<errno>,
|
|
24
|
+
syscall: option<string>,
|
|
25
|
+
address: option<string>,
|
|
26
|
+
port: option<u16>,
|
|
27
|
+
info: option<buffer-error-info>,
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
enum socket-type {
|
|
31
|
+
udp4,
|
|
32
|
+
udp6,
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
record options {
|
|
36
|
+
%type: socket-type,
|
|
37
|
+
reuse-addr: bool,
|
|
38
|
+
reuse-port: bool,
|
|
39
|
+
ipv6-only: bool,
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
record address-info {
|
|
43
|
+
address: string,
|
|
44
|
+
family: string,
|
|
45
|
+
port: u16,
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
variant socket-option {
|
|
49
|
+
broadcast(bool),
|
|
50
|
+
multicast-loopback(bool),
|
|
51
|
+
ttl(f64),
|
|
52
|
+
multicast-ttl(f64),
|
|
53
|
+
recv-buffer(u32),
|
|
54
|
+
send-buffer(u32),
|
|
55
|
+
multicast-interface(string),
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
enum socket-query {
|
|
59
|
+
recv-buffer,
|
|
60
|
+
send-buffer,
|
|
61
|
+
send-queue-size,
|
|
62
|
+
send-queue-count,
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
enum membership-action {
|
|
66
|
+
add,
|
|
67
|
+
drop,
|
|
68
|
+
add-source,
|
|
69
|
+
drop-source,
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
create-socket: func(options: options, listener: u32) -> result<socket, error>;
|
|
73
|
+
|
|
74
|
+
resource socket {
|
|
75
|
+
/// Bind/connect only accept resolved addresses and complete synchronously.
|
|
76
|
+
bind: func(address: string, port: u16) -> result<address-info, error>;
|
|
77
|
+
|
|
78
|
+
connect: func(address: string, port: u16) -> result<_, error>;
|
|
79
|
+
|
|
80
|
+
disconnect: func() -> result<_, error>;
|
|
81
|
+
|
|
82
|
+
resolve: func(address: string, id: u32);
|
|
83
|
+
|
|
84
|
+
send: func(
|
|
85
|
+
data: list<u8>,
|
|
86
|
+
port: option<u16>,
|
|
87
|
+
address: option<string>,
|
|
88
|
+
callback: option<u32>,
|
|
89
|
+
) -> result<_, error>;
|
|
90
|
+
|
|
91
|
+
address: func(remote: bool) -> result<address-info, error>;
|
|
92
|
+
|
|
93
|
+
set-option: func(%option: socket-option) -> result<_, error>;
|
|
94
|
+
|
|
95
|
+
query: func(query: socket-query) -> result<f64, error>;
|
|
96
|
+
|
|
97
|
+
membership: func(
|
|
98
|
+
action: membership-action,
|
|
99
|
+
group: string,
|
|
100
|
+
source: option<string>,
|
|
101
|
+
iface: option<string>,
|
|
102
|
+
) -> result<_, error>;
|
|
103
|
+
|
|
104
|
+
close: func();
|
|
105
|
+
|
|
106
|
+
set-ref: func(%ref: bool);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/// Each component instance owns and redeems its listeners. Providers must serialize
|
|
111
|
+
/// callback entry and drops, never re-enter while a guest import is on the stack.
|
|
112
|
+
interface dgram-callbacks {
|
|
113
|
+
use dgram.{error, address-info};
|
|
114
|
+
|
|
115
|
+
record message {
|
|
116
|
+
data: list<u8>,
|
|
117
|
+
remote: address-info,
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
record resolved {
|
|
121
|
+
id: u32,
|
|
122
|
+
%result: result<string, error>,
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
record sent {
|
|
126
|
+
id: u32,
|
|
127
|
+
%result: result<u32, error>,
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
variant socket-event {
|
|
131
|
+
message(message),
|
|
132
|
+
error(error),
|
|
133
|
+
resolved(resolved),
|
|
134
|
+
sent(sent),
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
resource socket-listener {
|
|
138
|
+
event: func(event: socket-event);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
take-socket-listener: func(id: u32) -> option<socket-listener>;
|
|
142
|
+
}
|