@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,145 @@
|
|
|
1
|
+
package jco:node@0.1.0;
|
|
2
|
+
|
|
3
|
+
/// Typed, runtime-neutral host boundary for Node-compatible DNS operations.
|
|
4
|
+
interface dns {
|
|
5
|
+
enum family {
|
|
6
|
+
unspecified,
|
|
7
|
+
ipv4,
|
|
8
|
+
ipv6,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
enum result-order {
|
|
12
|
+
ipv4-first,
|
|
13
|
+
ipv6-first,
|
|
14
|
+
verbatim,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
variant errno {
|
|
18
|
+
number(s64),
|
|
19
|
+
symbolic(string),
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
record error {
|
|
23
|
+
name: string,
|
|
24
|
+
message: string,
|
|
25
|
+
code: option<string>,
|
|
26
|
+
errno: option<errno>,
|
|
27
|
+
syscall: option<string>,
|
|
28
|
+
hostname: option<string>,
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
record resolver-options {
|
|
32
|
+
timeout: option<s32>,
|
|
33
|
+
tries: option<u32>,
|
|
34
|
+
max-timeout: option<u32>,
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
record resolver-config {
|
|
38
|
+
options: resolver-options,
|
|
39
|
+
servers: option<list<string>>,
|
|
40
|
+
local-address: option<tuple<string, string>>,
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
record lookup-options {
|
|
44
|
+
family: family,
|
|
45
|
+
hints: u32,
|
|
46
|
+
all: bool,
|
|
47
|
+
order: result-order,
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
record lookup-address {
|
|
51
|
+
address: string,
|
|
52
|
+
family: family,
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
record lookup-service-result {
|
|
56
|
+
hostname: string,
|
|
57
|
+
service: string,
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
record address-with-ttl {
|
|
61
|
+
address: string,
|
|
62
|
+
ttl: u32,
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
record caa-record {
|
|
66
|
+
critical: u32,
|
|
67
|
+
issue: option<string>,
|
|
68
|
+
issuewild: option<string>,
|
|
69
|
+
iodef: option<string>,
|
|
70
|
+
contactemail: option<string>,
|
|
71
|
+
contactphone: option<string>,
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
record mx-record {
|
|
75
|
+
priority: u32,
|
|
76
|
+
exchange: string,
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
record naptr-record {
|
|
80
|
+
%flags: string,
|
|
81
|
+
service: string,
|
|
82
|
+
regexp: string,
|
|
83
|
+
replacement: string,
|
|
84
|
+
order: u32,
|
|
85
|
+
preference: u32,
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
record soa-record {
|
|
89
|
+
nsname: string,
|
|
90
|
+
hostmaster: string,
|
|
91
|
+
serial: u32,
|
|
92
|
+
refresh: u32,
|
|
93
|
+
retry: u32,
|
|
94
|
+
expire: u32,
|
|
95
|
+
minttl: u32,
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
record srv-record {
|
|
99
|
+
priority: u32,
|
|
100
|
+
weight: u32,
|
|
101
|
+
port: u16,
|
|
102
|
+
name: string,
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
record tlsa-record {
|
|
106
|
+
cert-usage: u8,
|
|
107
|
+
selector: u8,
|
|
108
|
+
match: u8,
|
|
109
|
+
data: list<u8>,
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
variant any-record {
|
|
113
|
+
a(address-with-ttl),
|
|
114
|
+
aaaa(address-with-ttl),
|
|
115
|
+
caa(caa-record),
|
|
116
|
+
cname(string),
|
|
117
|
+
mx(mx-record),
|
|
118
|
+
naptr(naptr-record),
|
|
119
|
+
ns(string),
|
|
120
|
+
ptr(string),
|
|
121
|
+
soa(soa-record),
|
|
122
|
+
srv(srv-record),
|
|
123
|
+
tlsa(tlsa-record),
|
|
124
|
+
txt(list<string>),
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
get-servers: func() -> result<list<string>, error>;
|
|
128
|
+
validate-servers: func(servers: list<string>) -> result<list<string>, error>;
|
|
129
|
+
lookup: func(hostname: string, options: lookup-options) -> result<list<lookup-address>, error>;
|
|
130
|
+
lookup-service: func(address: string, port: u16) -> result<lookup-service-result, error>;
|
|
131
|
+
resolve4: func(hostname: string, ttl: bool, resolver: option<resolver-config>) -> result<list<address-with-ttl>, error>;
|
|
132
|
+
resolve6: func(hostname: string, ttl: bool, resolver: option<resolver-config>) -> result<list<address-with-ttl>, error>;
|
|
133
|
+
resolve-any: func(hostname: string, resolver: option<resolver-config>) -> result<list<any-record>, error>;
|
|
134
|
+
resolve-caa: func(hostname: string, resolver: option<resolver-config>) -> result<list<caa-record>, error>;
|
|
135
|
+
resolve-cname: func(hostname: string, resolver: option<resolver-config>) -> result<list<string>, error>;
|
|
136
|
+
resolve-mx: func(hostname: string, resolver: option<resolver-config>) -> result<list<mx-record>, error>;
|
|
137
|
+
resolve-naptr: func(hostname: string, resolver: option<resolver-config>) -> result<list<naptr-record>, error>;
|
|
138
|
+
resolve-ns: func(hostname: string, resolver: option<resolver-config>) -> result<list<string>, error>;
|
|
139
|
+
resolve-ptr: func(hostname: string, resolver: option<resolver-config>) -> result<list<string>, error>;
|
|
140
|
+
resolve-soa: func(hostname: string, resolver: option<resolver-config>) -> result<soa-record, error>;
|
|
141
|
+
resolve-srv: func(hostname: string, resolver: option<resolver-config>) -> result<list<srv-record>, error>;
|
|
142
|
+
resolve-tlsa: func(hostname: string, resolver: option<resolver-config>) -> result<list<tlsa-record>, error>;
|
|
143
|
+
resolve-txt: func(hostname: string, resolver: option<resolver-config>) -> result<list<list<string>>, error>;
|
|
144
|
+
reverse: func(ip: string, resolver: option<resolver-config>) -> result<list<string>, error>;
|
|
145
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
package jco:node@0.1.0;
|
|
2
|
+
|
|
3
|
+
/// Host-backed adapter for Node's `ffi` module.
|
|
4
|
+
///
|
|
5
|
+
/// `node:ffi` arrived in Node 26.1.0 (Stability 1, behind `--experimental-ffi`), so unlike the
|
|
6
|
+
/// other Node builtins this one has no Node 24 equivalent at all. WASI has nothing like it: there
|
|
7
|
+
/// is no dynamic loader and no host address space to reach. The host owns a real `node:ffi` and
|
|
8
|
+
/// this interface exposes enough of it to rebuild the observable JS surface guest-side.
|
|
9
|
+
///
|
|
10
|
+
/// Pointers cross as `u64` and become JavaScript `bigint`s, matching what Node hands back.
|
|
11
|
+
///
|
|
12
|
+
/// Parts of Node's surface deliberately have no representation here, because a component cannot
|
|
13
|
+
/// express them and a silently wrong answer would be worse than an error. Each is refused
|
|
14
|
+
/// guest-side; see the matching `TODO(ffi)` in jco-std for what lifting it would take.
|
|
15
|
+
///
|
|
16
|
+
/// - **Guest memory has no host address.** `ffi.getRawPointer()` asks for the address of a
|
|
17
|
+
/// JavaScript buffer; guest memory is not mapped into the host, so the guest refuses instead.
|
|
18
|
+
/// - **The host cannot call back into the guest.** `register-callback` would need a `callback`
|
|
19
|
+
/// resource for the trampoline's lifetime *and* a guest export for the host to invoke when
|
|
20
|
+
/// native code fires. Resources alone would not do it: their methods run host-side.
|
|
21
|
+
/// - **Buffer-shaped arguments** would be copied, so a native function writing through the pointer
|
|
22
|
+
/// writes into a copy the guest never sees. Callers pass a `pointer` and use
|
|
23
|
+
/// `read-bytes`/`write-bytes`, which is explicit about the copy. Adding copy-out results to
|
|
24
|
+
/// `call` would make out-parameters work.
|
|
25
|
+
///
|
|
26
|
+
/// The library handle is a `u32` rather than a `resource`, matching `cluster`'s worker ids, which
|
|
27
|
+
/// is the shape componentize-js is known to handle. A resource would give it a drop and remove the
|
|
28
|
+
/// stale-handle case; worth revisiting when guest-side resource support is proven.
|
|
29
|
+
interface ffi {
|
|
30
|
+
/// A value crossing the boundary, tagged by the type it was declared as.
|
|
31
|
+
///
|
|
32
|
+
/// `nothing` is Node's `void`. There is no buffer case on purpose -- see the interface docs.
|
|
33
|
+
variant value {
|
|
34
|
+
nothing,
|
|
35
|
+
boolean(bool),
|
|
36
|
+
int8(s8),
|
|
37
|
+
uint8(u8),
|
|
38
|
+
int16(s16),
|
|
39
|
+
uint16(u16),
|
|
40
|
+
int32(s32),
|
|
41
|
+
uint32(u32),
|
|
42
|
+
int64(s64),
|
|
43
|
+
uint64(u64),
|
|
44
|
+
float32(f32),
|
|
45
|
+
float64(f64),
|
|
46
|
+
pointer(u64),
|
|
47
|
+
text(string),
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/// A failure reported by the host's `node:ffi`, carrying Node's own code where it has one.
|
|
51
|
+
record failure {
|
|
52
|
+
code: string,
|
|
53
|
+
message: string,
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
variant error {
|
|
57
|
+
/// No FFI capability was granted to this component.
|
|
58
|
+
denied(string),
|
|
59
|
+
/// The host runtime has no `node:ffi`: it predates Node 26.1.0, or the flag is missing.
|
|
60
|
+
unavailable(string),
|
|
61
|
+
/// The library handle is not open.
|
|
62
|
+
no-such-library(u32),
|
|
63
|
+
/// The symbol has not been defined on that library.
|
|
64
|
+
no-such-symbol(string),
|
|
65
|
+
/// The signature names a type this boundary cannot carry.
|
|
66
|
+
unsupported-type(string),
|
|
67
|
+
/// The underlying call failed.
|
|
68
|
+
failed(failure),
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/// A function signature. Type names are Node's own: `int32`, `pointer`, `string`, `void`, ...
|
|
72
|
+
record signature {
|
|
73
|
+
arguments: list<string>,
|
|
74
|
+
returns: string,
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/// The host platform's shared-library suffix: `so`, `dylib`, or `dll`.
|
|
78
|
+
suffix: func() -> string;
|
|
79
|
+
|
|
80
|
+
/// Load a shared library. A missing path resolves symbols from the host process image.
|
|
81
|
+
open: func(path: option<string>) -> result<u32, error>;
|
|
82
|
+
|
|
83
|
+
/// Release a library handle.
|
|
84
|
+
close: func(handle: u32) -> result<_, error>;
|
|
85
|
+
|
|
86
|
+
/// Resolve a symbol's address.
|
|
87
|
+
symbol: func(handle: u32, name: string) -> result<u64, error>;
|
|
88
|
+
|
|
89
|
+
/// Declare a function so it can be called. Separate from `call` so a signature is validated
|
|
90
|
+
/// once, where Node validates it, rather than on every invocation.
|
|
91
|
+
define: func(handle: u32, name: string, sig: signature) -> result<_, error>;
|
|
92
|
+
|
|
93
|
+
/// Call a previously declared function.
|
|
94
|
+
call: func(handle: u32, name: string, args: list<value>) -> result<value, error>;
|
|
95
|
+
|
|
96
|
+
/// Read one primitive from host memory. `kind` is a Node type name.
|
|
97
|
+
read: func(pointer: u64, offset: u64, kind: string) -> result<value, error>;
|
|
98
|
+
|
|
99
|
+
/// Write one primitive into host memory.
|
|
100
|
+
write: func(pointer: u64, offset: u64, kind: string, data: value) -> result<_, error>;
|
|
101
|
+
|
|
102
|
+
/// Read a NUL-terminated string. Absent for a null pointer, which is what Node returns.
|
|
103
|
+
read-text: func(pointer: u64) -> result<option<string>, error>;
|
|
104
|
+
|
|
105
|
+
/// Copy bytes out of host memory. Always a copy: a component cannot hold a live view.
|
|
106
|
+
read-bytes: func(pointer: u64, length: u64) -> result<list<u8>, error>;
|
|
107
|
+
|
|
108
|
+
/// Copy bytes into host memory.
|
|
109
|
+
write-bytes: func(pointer: u64, length: u64, data: list<u8>) -> result<_, error>;
|
|
110
|
+
|
|
111
|
+
/// Encode a string into host memory.
|
|
112
|
+
write-text: func(pointer: u64, length: u64, data: string, encoding: string) -> result<_, error>;
|
|
113
|
+
|
|
114
|
+
/// The host's libuv event loop address.
|
|
115
|
+
current-event-loop: func() -> result<u64, error>;
|
|
116
|
+
}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
package jco:node@0.1.0;
|
|
2
|
+
|
|
3
|
+
/// Typed, runtime-neutral host boundary for the supported Node filesystem API.
|
|
4
|
+
interface fs {
|
|
5
|
+
variant path {
|
|
6
|
+
text(string),
|
|
7
|
+
bytes(list<u8>),
|
|
8
|
+
file-url(string),
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
variant path-or-descriptor {
|
|
12
|
+
path(path),
|
|
13
|
+
descriptor(u32),
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
variant mode {
|
|
17
|
+
number(u32),
|
|
18
|
+
symbolic(string),
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
variant open-mode {
|
|
22
|
+
number(s32),
|
|
23
|
+
symbolic(string),
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
variant errno {
|
|
27
|
+
number(s64),
|
|
28
|
+
symbolic(string),
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
record error {
|
|
32
|
+
name: string,
|
|
33
|
+
message: string,
|
|
34
|
+
code: option<string>,
|
|
35
|
+
errno: option<errno>,
|
|
36
|
+
syscall: option<string>,
|
|
37
|
+
path: option<string>,
|
|
38
|
+
dest: option<string>,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
enum file-type {
|
|
42
|
+
block,
|
|
43
|
+
character,
|
|
44
|
+
directory,
|
|
45
|
+
fifo,
|
|
46
|
+
file,
|
|
47
|
+
socket,
|
|
48
|
+
symlink,
|
|
49
|
+
unknown,
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
variant numeric {
|
|
53
|
+
number(f64),
|
|
54
|
+
bigint(s64),
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
record stats {
|
|
58
|
+
dev: numeric,
|
|
59
|
+
ino: numeric,
|
|
60
|
+
mode: numeric,
|
|
61
|
+
nlink: numeric,
|
|
62
|
+
uid: numeric,
|
|
63
|
+
gid: numeric,
|
|
64
|
+
rdev: numeric,
|
|
65
|
+
size: numeric,
|
|
66
|
+
blksize: numeric,
|
|
67
|
+
blocks: numeric,
|
|
68
|
+
atime-ms: numeric,
|
|
69
|
+
mtime-ms: numeric,
|
|
70
|
+
ctime-ms: numeric,
|
|
71
|
+
birthtime-ms: numeric,
|
|
72
|
+
atime-ns: option<s64>,
|
|
73
|
+
mtime-ns: option<s64>,
|
|
74
|
+
ctime-ns: option<s64>,
|
|
75
|
+
birthtime-ns: option<s64>,
|
|
76
|
+
file-type: file-type,
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
record statfs-result {
|
|
80
|
+
%type: numeric,
|
|
81
|
+
bsize: numeric,
|
|
82
|
+
blocks: numeric,
|
|
83
|
+
bfree: numeric,
|
|
84
|
+
bavail: numeric,
|
|
85
|
+
files: numeric,
|
|
86
|
+
ffree: numeric,
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
record dirent {
|
|
90
|
+
name: string,
|
|
91
|
+
parent-path: string,
|
|
92
|
+
file-type: file-type,
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
variant directory-entry {
|
|
96
|
+
name(string),
|
|
97
|
+
dirent(dirent),
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
variant glob-entry {
|
|
101
|
+
path(string),
|
|
102
|
+
dirent(dirent),
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
variant glob-exclude {
|
|
106
|
+
pattern(string),
|
|
107
|
+
patterns(list<string>),
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
record copy-options {
|
|
111
|
+
dereference: bool,
|
|
112
|
+
error-on-exist: bool,
|
|
113
|
+
force: bool,
|
|
114
|
+
preserve-timestamps: bool,
|
|
115
|
+
recursive: bool,
|
|
116
|
+
verbatim-symlinks: bool,
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
record glob-options {
|
|
120
|
+
cwd: option<path>,
|
|
121
|
+
exclude: option<glob-exclude>,
|
|
122
|
+
with-file-types: bool,
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
record mkdir-options {
|
|
126
|
+
recursive: bool,
|
|
127
|
+
mode: option<mode>,
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
record readdir-options {
|
|
131
|
+
recursive: bool,
|
|
132
|
+
with-file-types: bool,
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
record remove-options {
|
|
136
|
+
force: bool,
|
|
137
|
+
max-retries: u32,
|
|
138
|
+
recursive: bool,
|
|
139
|
+
retry-delay: u32,
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
record stat-options {
|
|
143
|
+
bigint: bool,
|
|
144
|
+
throw-if-no-entry: bool,
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
record read-file-options {
|
|
148
|
+
flag: option<string>,
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
record write-file-options {
|
|
152
|
+
flag: option<string>,
|
|
153
|
+
mode: option<mode>,
|
|
154
|
+
flush: bool,
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
record read-result {
|
|
158
|
+
bytes-read: u32,
|
|
159
|
+
data: list<u8>,
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
record readv-result {
|
|
163
|
+
bytes-read: u32,
|
|
164
|
+
buffers: list<list<u8>>,
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
access: func(path: path, mode: s32) -> result<_, error>;
|
|
168
|
+
append-file: func(file: path-or-descriptor, data: list<u8>, options: write-file-options) -> result<_, error>;
|
|
169
|
+
chmod: func(path: path, mode: mode) -> result<_, error>;
|
|
170
|
+
chown: func(path: path, uid: u32, gid: u32) -> result<_, error>;
|
|
171
|
+
close: func(descriptor: u32) -> result<_, error>;
|
|
172
|
+
copy-file: func(source: path, destination: path, mode: s32) -> result<_, error>;
|
|
173
|
+
cp: func(source: path, destination: path, options: copy-options) -> result<_, error>;
|
|
174
|
+
exists: func(path: path) -> result<bool, error>;
|
|
175
|
+
fchmod: func(descriptor: u32, mode: mode) -> result<_, error>;
|
|
176
|
+
fchown: func(descriptor: u32, uid: u32, gid: u32) -> result<_, error>;
|
|
177
|
+
fdatasync: func(descriptor: u32) -> result<_, error>;
|
|
178
|
+
fstat: func(descriptor: u32, options: stat-options) -> result<stats, error>;
|
|
179
|
+
fsync: func(descriptor: u32) -> result<_, error>;
|
|
180
|
+
ftruncate: func(descriptor: u32, length: u32) -> result<_, error>;
|
|
181
|
+
futimes: func(descriptor: u32, atime: f64, mtime: f64) -> result<_, error>;
|
|
182
|
+
glob: func(patterns: list<string>, options: glob-options) -> result<list<glob-entry>, error>;
|
|
183
|
+
lchown: func(path: path, uid: u32, gid: u32) -> result<_, error>;
|
|
184
|
+
link: func(existing-path: path, new-path: path) -> result<_, error>;
|
|
185
|
+
lstat: func(path: path, options: stat-options) -> result<option<stats>, error>;
|
|
186
|
+
lutimes: func(path: path, atime: f64, mtime: f64) -> result<_, error>;
|
|
187
|
+
mkdir: func(path: path, options: mkdir-options) -> result<option<string>, error>;
|
|
188
|
+
mkdtemp: func(prefix: string) -> result<string, error>;
|
|
189
|
+
open: func(path: path, %flags: open-mode, mode: mode) -> result<u32, error>;
|
|
190
|
+
read-file: func(file: path-or-descriptor, options: read-file-options) -> result<list<u8>, error>;
|
|
191
|
+
readdir: func(path: path, options: readdir-options) -> result<list<directory-entry>, error>;
|
|
192
|
+
readlink: func(path: path) -> result<string, error>;
|
|
193
|
+
realpath: func(path: path) -> result<string, error>;
|
|
194
|
+
rename: func(old-path: path, new-path: path) -> result<_, error>;
|
|
195
|
+
rm: func(path: path, options: remove-options) -> result<_, error>;
|
|
196
|
+
rmdir: func(path: path, options: remove-options) -> result<_, error>;
|
|
197
|
+
stat: func(path: path, options: stat-options) -> result<option<stats>, error>;
|
|
198
|
+
statfs: func(path: path, bigint: bool) -> result<statfs-result, error>;
|
|
199
|
+
symlink: func(target: path, path: path, %type: option<string>) -> result<_, error>;
|
|
200
|
+
truncate: func(path: path, length: u32) -> result<_, error>;
|
|
201
|
+
unlink: func(path: path) -> result<_, error>;
|
|
202
|
+
utimes: func(path: path, atime: f64, mtime: f64) -> result<_, error>;
|
|
203
|
+
write-file: func(file: path-or-descriptor, data: list<u8>, options: write-file-options) -> result<_, error>;
|
|
204
|
+
read: func(descriptor: u32, length: u32, position: option<u64>) -> result<read-result, error>;
|
|
205
|
+
write: func(descriptor: u32, data: list<u8>, position: option<u64>) -> result<u32, error>;
|
|
206
|
+
readv: func(descriptor: u32, lengths: list<u32>, position: option<u64>) -> result<readv-result, error>;
|
|
207
|
+
writev: func(descriptor: u32, buffers: list<list<u8>>, position: option<u64>) -> result<u32, error>;
|
|
208
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
package jco:node@0.1.0;
|
|
2
|
+
|
|
3
|
+
/// Guest-owned callback resources used by the direct Node-compatible HTTP implementation.
|
|
4
|
+
interface http-callbacks {
|
|
5
|
+
variant errno {
|
|
6
|
+
number(s64),
|
|
7
|
+
symbolic(string),
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
record error {
|
|
11
|
+
name: string,
|
|
12
|
+
message: string,
|
|
13
|
+
code: option<string>,
|
|
14
|
+
errno: option<errno>,
|
|
15
|
+
syscall: option<string>,
|
|
16
|
+
hostname: option<string>,
|
|
17
|
+
address: option<string>,
|
|
18
|
+
port: option<u16>,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
record header {
|
|
22
|
+
name: string,
|
|
23
|
+
value: list<u8>,
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
record incoming-request {
|
|
27
|
+
method: string,
|
|
28
|
+
url: string,
|
|
29
|
+
http-version: string,
|
|
30
|
+
headers: list<header>,
|
|
31
|
+
body: list<u8>,
|
|
32
|
+
remote-address: option<string>,
|
|
33
|
+
remote-port: option<u16>,
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
record outgoing-response {
|
|
37
|
+
status-code: u16,
|
|
38
|
+
status-message: string,
|
|
39
|
+
headers: list<header>,
|
|
40
|
+
body: list<u8>,
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
resource request-listener {
|
|
44
|
+
handle: func(request: incoming-request) -> result<outgoing-response, error>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/// Redeem a registration once. The host owns the returned listener until the server closes.
|
|
48
|
+
take-request-listener: func(id: u32) -> option<request-listener>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/// Typed host boundary for Node-compatible HTTP clients and servers.
|
|
52
|
+
interface http {
|
|
53
|
+
variant errno {
|
|
54
|
+
number(s64),
|
|
55
|
+
symbolic(string),
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
record error {
|
|
59
|
+
name: string,
|
|
60
|
+
message: string,
|
|
61
|
+
code: option<string>,
|
|
62
|
+
errno: option<errno>,
|
|
63
|
+
syscall: option<string>,
|
|
64
|
+
hostname: option<string>,
|
|
65
|
+
address: option<string>,
|
|
66
|
+
port: option<u16>,
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
record header {
|
|
70
|
+
name: string,
|
|
71
|
+
value: list<u8>,
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
record request-options {
|
|
75
|
+
method: string,
|
|
76
|
+
scheme: string,
|
|
77
|
+
authority: string,
|
|
78
|
+
path-with-query: string,
|
|
79
|
+
headers: list<header>,
|
|
80
|
+
body: list<u8>,
|
|
81
|
+
connect-timeout-ms: option<u32>,
|
|
82
|
+
first-byte-timeout-ms: option<u32>,
|
|
83
|
+
between-bytes-timeout-ms: option<u32>,
|
|
84
|
+
/// Set only for `https` requests that carry TLS options.
|
|
85
|
+
tls: option<tls-options>,
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
record response {
|
|
89
|
+
status-code: u16,
|
|
90
|
+
status-message: string,
|
|
91
|
+
http-version: string,
|
|
92
|
+
headers: list<header>,
|
|
93
|
+
body: list<u8>,
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/// Configuration issued by the same jco:node/tls provider bound to this HTTP host.
|
|
97
|
+
record tls-options { context-id: u32 }
|
|
98
|
+
|
|
99
|
+
record server-options {
|
|
100
|
+
request-timeout: option<u32>,
|
|
101
|
+
headers-timeout: option<u32>,
|
|
102
|
+
keep-alive-timeout: option<u32>,
|
|
103
|
+
keep-alive-timeout-buffer: option<u32>,
|
|
104
|
+
connections-checking-interval: option<u32>,
|
|
105
|
+
max-header-size: option<u32>,
|
|
106
|
+
join-duplicate-headers: option<bool>,
|
|
107
|
+
no-delay: option<bool>,
|
|
108
|
+
require-host-header: option<bool>,
|
|
109
|
+
keep-alive: option<bool>,
|
|
110
|
+
keep-alive-initial-delay: option<u32>,
|
|
111
|
+
reject-non-standard-body-writes: option<bool>,
|
|
112
|
+
optimize-empty-requests: option<bool>,
|
|
113
|
+
/// Present for every `node:https` server, even when empty: the host terminates TLS.
|
|
114
|
+
tls: option<tls-options>,
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
record listen-options {
|
|
118
|
+
port: option<u16>,
|
|
119
|
+
host: option<string>,
|
|
120
|
+
backlog: option<u32>,
|
|
121
|
+
path: option<string>,
|
|
122
|
+
exclusive: option<bool>,
|
|
123
|
+
ipv6-only: option<bool>,
|
|
124
|
+
reuse-port: option<bool>,
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
record tcp-address {
|
|
128
|
+
address: string,
|
|
129
|
+
family: string,
|
|
130
|
+
port: u16,
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
variant server-address {
|
|
134
|
+
tcp(tcp-address),
|
|
135
|
+
pipe(string),
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
request: func(options: request-options) -> result<response, error>;
|
|
139
|
+
|
|
140
|
+
resource server {
|
|
141
|
+
constructor(options: server-options, listener: u32);
|
|
142
|
+
listen: func(options: listen-options) -> result<server-address, error>;
|
|
143
|
+
close: func() -> result<bool, error>;
|
|
144
|
+
close-all-connections: func() -> result<_, error>;
|
|
145
|
+
close-idle-connections: func() -> result<_, error>;
|
|
146
|
+
get-connections: func() -> result<u64, error>;
|
|
147
|
+
address: func() -> option<server-address>;
|
|
148
|
+
ref: func();
|
|
149
|
+
unref: func();
|
|
150
|
+
}
|
|
151
|
+
}
|