@bytecodealliance/jco 1.30.0 → 1.32.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 +47 -0
- package/dist/cmd/new/builtin-wit.d.ts +13 -0
- package/dist/cmd/new/builtin-wit.d.ts.map +1 -0
- package/dist/cmd/new/builtin-wit.js +53 -0
- package/dist/cmd/new/builtin-wit.js.map +1 -0
- package/dist/cmd/new/oci-wit.d.ts +5 -0
- package/dist/cmd/new/oci-wit.d.ts.map +1 -0
- package/dist/cmd/new/oci-wit.js +124 -0
- package/dist/cmd/new/oci-wit.js.map +1 -0
- package/dist/cmd/new.d.ts.map +1 -1
- package/dist/cmd/new.js +58 -39
- package/dist/cmd/new.js.map +1 -1
- package/dist/cmd/run.d.ts +8 -0
- package/dist/cmd/run.d.ts.map +1 -1
- package/dist/cmd/run.js +202 -6
- package/dist/cmd/run.js.map +1 -1
- package/dist/cmd/transpile.d.ts +3 -0
- package/dist/cmd/transpile.d.ts.map +1 -1
- package/dist/cmd/transpile.js +3 -0
- package/dist/cmd/transpile.js.map +1 -1
- package/dist/cmd/types.d.ts +3 -0
- package/dist/cmd/types.d.ts.map +1 -1
- package/dist/cmd/types.js +6 -1
- package/dist/cmd/types.js.map +1 -1
- package/dist/jco.js +22 -3
- package/dist/jco.js.map +1 -1
- package/lib/wit/builtin/0.2.12/wasi-cli/package.wit +64 -0
- package/lib/wit/builtin/0.2.12/wasi-clocks/package.wit +43 -0
- package/lib/wit/builtin/0.2.12/wasi-filesystem/package.wit +196 -0
- package/lib/wit/builtin/0.2.12/wasi-http/package.wit +205 -0
- package/lib/wit/builtin/0.2.12/wasi-io/package.wit +66 -0
- package/lib/wit/builtin/0.2.12/wasi-random/package.wit +17 -0
- package/lib/wit/builtin/0.2.12/wasi-sockets/package.wit +164 -0
- package/lib/wit/builtin/0.3.0/wasi-cli/package.wit +70 -0
- package/lib/wit/builtin/0.3.0/wasi-clocks/package.wit +42 -0
- package/lib/wit/builtin/0.3.0/wasi-filesystem/package.wit +184 -0
- package/lib/wit/builtin/0.3.0/wasi-http/package.wit +170 -0
- package/lib/wit/builtin/0.3.0/wasi-random/package.wit +17 -0
- package/lib/wit/builtin/0.3.0/wasi-sockets/package.wit +105 -0
- package/lib/wit/builtin/LICENSE.md +8 -0
- package/lib/wit/builtin/README.md +12 -0
- package/package.json +4 -4
- package/LICENSE +0 -220
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
package wasi:cli@0.3.0;
|
|
2
|
+
world command {
|
|
3
|
+
include imports;
|
|
4
|
+
export run;
|
|
5
|
+
}
|
|
6
|
+
interface environment {
|
|
7
|
+
get-environment: func() -> list<tuple<string, string>>;
|
|
8
|
+
get-arguments: func() -> list<string>;
|
|
9
|
+
get-initial-cwd: func() -> option<string>;
|
|
10
|
+
}
|
|
11
|
+
interface exit {
|
|
12
|
+
exit: func(status: result);
|
|
13
|
+
exit-with-code: func(status-code: u8);
|
|
14
|
+
}
|
|
15
|
+
world imports {
|
|
16
|
+
include wasi:clocks/imports@0.3.0;
|
|
17
|
+
include wasi:filesystem/imports@0.3.0;
|
|
18
|
+
include wasi:sockets/imports@0.3.0;
|
|
19
|
+
include wasi:random/imports@0.3.0;
|
|
20
|
+
import environment;
|
|
21
|
+
import exit;
|
|
22
|
+
import stdin;
|
|
23
|
+
import stdout;
|
|
24
|
+
import stderr;
|
|
25
|
+
import terminal-input;
|
|
26
|
+
import terminal-output;
|
|
27
|
+
import terminal-stdin;
|
|
28
|
+
import terminal-stdout;
|
|
29
|
+
import terminal-stderr;
|
|
30
|
+
}
|
|
31
|
+
interface run {
|
|
32
|
+
run: async func() -> result;
|
|
33
|
+
}
|
|
34
|
+
interface types {
|
|
35
|
+
enum error-code {
|
|
36
|
+
io,
|
|
37
|
+
illegal-byte-sequence,
|
|
38
|
+
pipe,
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
interface stdin {
|
|
42
|
+
use types.{error-code};
|
|
43
|
+
read-via-stream: func() -> tuple<stream<u8>, future<result<_, error-code>>>;
|
|
44
|
+
}
|
|
45
|
+
interface stdout {
|
|
46
|
+
use types.{error-code};
|
|
47
|
+
write-via-stream: func(data: stream<u8>) -> future<result<_, error-code>>;
|
|
48
|
+
}
|
|
49
|
+
interface stderr {
|
|
50
|
+
use types.{error-code};
|
|
51
|
+
write-via-stream: func(data: stream<u8>) -> future<result<_, error-code>>;
|
|
52
|
+
}
|
|
53
|
+
interface terminal-input {
|
|
54
|
+
resource terminal-input;
|
|
55
|
+
}
|
|
56
|
+
interface terminal-output {
|
|
57
|
+
resource terminal-output;
|
|
58
|
+
}
|
|
59
|
+
interface terminal-stdin {
|
|
60
|
+
use terminal-input.{terminal-input};
|
|
61
|
+
get-terminal-stdin: func() -> option<terminal-input>;
|
|
62
|
+
}
|
|
63
|
+
interface terminal-stdout {
|
|
64
|
+
use terminal-output.{terminal-output};
|
|
65
|
+
get-terminal-stdout: func() -> option<terminal-output>;
|
|
66
|
+
}
|
|
67
|
+
interface terminal-stderr {
|
|
68
|
+
use terminal-output.{terminal-output};
|
|
69
|
+
get-terminal-stderr: func() -> option<terminal-output>;
|
|
70
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
package wasi:clocks@0.3.0;
|
|
2
|
+
interface monotonic-clock {
|
|
3
|
+
use types.{duration};
|
|
4
|
+
type mark = u64;
|
|
5
|
+
now: func() -> mark;
|
|
6
|
+
get-resolution: func() -> duration;
|
|
7
|
+
wait-until: async func(
|
|
8
|
+
when: mark,
|
|
9
|
+
);
|
|
10
|
+
wait-for: async func(
|
|
11
|
+
how-long: duration,
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
interface system-clock {
|
|
15
|
+
use types.{duration};
|
|
16
|
+
record instant {
|
|
17
|
+
seconds: s64,
|
|
18
|
+
nanoseconds: u32,
|
|
19
|
+
}
|
|
20
|
+
now: func() -> instant;
|
|
21
|
+
get-resolution: func() -> duration;
|
|
22
|
+
}
|
|
23
|
+
@unstable(feature = clocks-timezone)
|
|
24
|
+
interface timezone {
|
|
25
|
+
@unstable(feature = clocks-timezone)
|
|
26
|
+
use system-clock.{instant};
|
|
27
|
+
@unstable(feature = clocks-timezone)
|
|
28
|
+
iana-id: func() -> option<string>;
|
|
29
|
+
@unstable(feature = clocks-timezone)
|
|
30
|
+
utc-offset: func(when: instant) -> option<s64>;
|
|
31
|
+
@unstable(feature = clocks-timezone)
|
|
32
|
+
to-debug-string: func() -> string;
|
|
33
|
+
}
|
|
34
|
+
interface types {
|
|
35
|
+
type duration = u64;
|
|
36
|
+
}
|
|
37
|
+
world imports {
|
|
38
|
+
import monotonic-clock;
|
|
39
|
+
import system-clock;
|
|
40
|
+
@unstable(feature = clocks-timezone)
|
|
41
|
+
import timezone;
|
|
42
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
package wasi:filesystem@0.3.0;
|
|
2
|
+
interface preopens {
|
|
3
|
+
use types.{descriptor};
|
|
4
|
+
get-directories: func() -> list<tuple<descriptor, string>>;
|
|
5
|
+
}
|
|
6
|
+
interface types {
|
|
7
|
+
use wasi:clocks/system-clock@0.3.0.{instant};
|
|
8
|
+
type filesize = u64;
|
|
9
|
+
variant descriptor-type {
|
|
10
|
+
block-device,
|
|
11
|
+
character-device,
|
|
12
|
+
directory,
|
|
13
|
+
fifo,
|
|
14
|
+
symbolic-link,
|
|
15
|
+
regular-file,
|
|
16
|
+
socket,
|
|
17
|
+
other(option<string>),
|
|
18
|
+
}
|
|
19
|
+
flags descriptor-flags {
|
|
20
|
+
read,
|
|
21
|
+
write,
|
|
22
|
+
file-integrity-sync,
|
|
23
|
+
data-integrity-sync,
|
|
24
|
+
requested-write-sync,
|
|
25
|
+
mutate-directory,
|
|
26
|
+
}
|
|
27
|
+
record descriptor-stat {
|
|
28
|
+
%type: descriptor-type,
|
|
29
|
+
link-count: link-count,
|
|
30
|
+
size: filesize,
|
|
31
|
+
data-access-timestamp: option<instant>,
|
|
32
|
+
data-modification-timestamp: option<instant>,
|
|
33
|
+
status-change-timestamp: option<instant>,
|
|
34
|
+
}
|
|
35
|
+
flags path-flags {
|
|
36
|
+
symlink-follow,
|
|
37
|
+
}
|
|
38
|
+
flags open-flags {
|
|
39
|
+
create,
|
|
40
|
+
directory,
|
|
41
|
+
exclusive,
|
|
42
|
+
truncate,
|
|
43
|
+
}
|
|
44
|
+
type link-count = u64;
|
|
45
|
+
variant new-timestamp {
|
|
46
|
+
no-change,
|
|
47
|
+
now,
|
|
48
|
+
timestamp(instant),
|
|
49
|
+
}
|
|
50
|
+
record directory-entry {
|
|
51
|
+
%type: descriptor-type,
|
|
52
|
+
name: string,
|
|
53
|
+
}
|
|
54
|
+
variant error-code {
|
|
55
|
+
access,
|
|
56
|
+
already,
|
|
57
|
+
bad-descriptor,
|
|
58
|
+
busy,
|
|
59
|
+
deadlock,
|
|
60
|
+
quota,
|
|
61
|
+
exist,
|
|
62
|
+
file-too-large,
|
|
63
|
+
illegal-byte-sequence,
|
|
64
|
+
in-progress,
|
|
65
|
+
interrupted,
|
|
66
|
+
invalid,
|
|
67
|
+
io,
|
|
68
|
+
is-directory,
|
|
69
|
+
loop,
|
|
70
|
+
too-many-links,
|
|
71
|
+
message-size,
|
|
72
|
+
name-too-long,
|
|
73
|
+
no-device,
|
|
74
|
+
no-entry,
|
|
75
|
+
no-lock,
|
|
76
|
+
insufficient-memory,
|
|
77
|
+
insufficient-space,
|
|
78
|
+
not-directory,
|
|
79
|
+
not-empty,
|
|
80
|
+
not-recoverable,
|
|
81
|
+
unsupported,
|
|
82
|
+
no-tty,
|
|
83
|
+
no-such-device,
|
|
84
|
+
overflow,
|
|
85
|
+
not-permitted,
|
|
86
|
+
pipe,
|
|
87
|
+
read-only,
|
|
88
|
+
invalid-seek,
|
|
89
|
+
text-file-busy,
|
|
90
|
+
cross-device,
|
|
91
|
+
other(option<string>),
|
|
92
|
+
}
|
|
93
|
+
enum advice {
|
|
94
|
+
normal,
|
|
95
|
+
sequential,
|
|
96
|
+
random,
|
|
97
|
+
will-need,
|
|
98
|
+
dont-need,
|
|
99
|
+
no-reuse,
|
|
100
|
+
}
|
|
101
|
+
record metadata-hash-value {
|
|
102
|
+
lower: u64,
|
|
103
|
+
upper: u64,
|
|
104
|
+
}
|
|
105
|
+
resource descriptor {
|
|
106
|
+
read-via-stream: func(
|
|
107
|
+
offset: filesize,
|
|
108
|
+
) -> tuple<stream<u8>, future<result<_, error-code>>>;
|
|
109
|
+
write-via-stream: func(
|
|
110
|
+
data: stream<u8>,
|
|
111
|
+
offset: filesize,
|
|
112
|
+
) -> future<result<_, error-code>>;
|
|
113
|
+
append-via-stream: func(data: stream<u8>) -> future<result<_, error-code>>;
|
|
114
|
+
advise: async func(
|
|
115
|
+
offset: filesize,
|
|
116
|
+
length: filesize,
|
|
117
|
+
advice: advice
|
|
118
|
+
) -> result<_, error-code>;
|
|
119
|
+
sync-data: async func() -> result<_, error-code>;
|
|
120
|
+
get-flags: async func() -> result<descriptor-flags, error-code>;
|
|
121
|
+
get-type: async func() -> result<descriptor-type, error-code>;
|
|
122
|
+
set-size: async func(size: filesize) -> result<_, error-code>;
|
|
123
|
+
set-times: async func(
|
|
124
|
+
data-access-timestamp: new-timestamp,
|
|
125
|
+
data-modification-timestamp: new-timestamp,
|
|
126
|
+
) -> result<_, error-code>;
|
|
127
|
+
read-directory: func() -> tuple<stream<directory-entry>, future<result<_, error-code>>>;
|
|
128
|
+
sync: async func() -> result<_, error-code>;
|
|
129
|
+
create-directory-at: async func(
|
|
130
|
+
path: string,
|
|
131
|
+
) -> result<_, error-code>;
|
|
132
|
+
stat: async func() -> result<descriptor-stat, error-code>;
|
|
133
|
+
stat-at: async func(
|
|
134
|
+
path-flags: path-flags,
|
|
135
|
+
path: string,
|
|
136
|
+
) -> result<descriptor-stat, error-code>;
|
|
137
|
+
set-times-at: async func(
|
|
138
|
+
path-flags: path-flags,
|
|
139
|
+
path: string,
|
|
140
|
+
data-access-timestamp: new-timestamp,
|
|
141
|
+
data-modification-timestamp: new-timestamp,
|
|
142
|
+
) -> result<_, error-code>;
|
|
143
|
+
link-at: async func(
|
|
144
|
+
old-path-flags: path-flags,
|
|
145
|
+
old-path: string,
|
|
146
|
+
new-descriptor: borrow<descriptor>,
|
|
147
|
+
new-path: string,
|
|
148
|
+
) -> result<_, error-code>;
|
|
149
|
+
open-at: async func(
|
|
150
|
+
path-flags: path-flags,
|
|
151
|
+
path: string,
|
|
152
|
+
open-flags: open-flags,
|
|
153
|
+
%flags: descriptor-flags,
|
|
154
|
+
) -> result<descriptor, error-code>;
|
|
155
|
+
readlink-at: async func(
|
|
156
|
+
path: string,
|
|
157
|
+
) -> result<string, error-code>;
|
|
158
|
+
remove-directory-at: async func(
|
|
159
|
+
path: string,
|
|
160
|
+
) -> result<_, error-code>;
|
|
161
|
+
rename-at: async func(
|
|
162
|
+
old-path: string,
|
|
163
|
+
new-descriptor: borrow<descriptor>,
|
|
164
|
+
new-path: string,
|
|
165
|
+
) -> result<_, error-code>;
|
|
166
|
+
symlink-at: async func(
|
|
167
|
+
old-path: string,
|
|
168
|
+
new-path: string,
|
|
169
|
+
) -> result<_, error-code>;
|
|
170
|
+
unlink-file-at: async func(
|
|
171
|
+
path: string,
|
|
172
|
+
) -> result<_, error-code>;
|
|
173
|
+
is-same-object: async func(other: borrow<descriptor>) -> bool;
|
|
174
|
+
metadata-hash: async func() -> result<metadata-hash-value, error-code>;
|
|
175
|
+
metadata-hash-at: async func(
|
|
176
|
+
path-flags: path-flags,
|
|
177
|
+
path: string,
|
|
178
|
+
) -> result<metadata-hash-value, error-code>;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
world imports {
|
|
182
|
+
import types;
|
|
183
|
+
import preopens;
|
|
184
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
package wasi:http@0.3.0;
|
|
2
|
+
interface types {
|
|
3
|
+
use wasi:clocks/types@0.3.0.{duration};
|
|
4
|
+
variant method {
|
|
5
|
+
get,
|
|
6
|
+
head,
|
|
7
|
+
post,
|
|
8
|
+
put,
|
|
9
|
+
delete,
|
|
10
|
+
connect,
|
|
11
|
+
options,
|
|
12
|
+
trace,
|
|
13
|
+
patch,
|
|
14
|
+
other(string)
|
|
15
|
+
}
|
|
16
|
+
variant scheme {
|
|
17
|
+
HTTP,
|
|
18
|
+
HTTPS,
|
|
19
|
+
other(string)
|
|
20
|
+
}
|
|
21
|
+
variant error-code {
|
|
22
|
+
DNS-timeout,
|
|
23
|
+
DNS-error(DNS-error-payload),
|
|
24
|
+
destination-not-found,
|
|
25
|
+
destination-unavailable,
|
|
26
|
+
destination-IP-prohibited,
|
|
27
|
+
destination-IP-unroutable,
|
|
28
|
+
connection-refused,
|
|
29
|
+
connection-terminated,
|
|
30
|
+
connection-timeout,
|
|
31
|
+
connection-read-timeout,
|
|
32
|
+
connection-write-timeout,
|
|
33
|
+
connection-limit-reached,
|
|
34
|
+
TLS-protocol-error,
|
|
35
|
+
TLS-certificate-error,
|
|
36
|
+
TLS-alert-received(TLS-alert-received-payload),
|
|
37
|
+
HTTP-request-denied,
|
|
38
|
+
HTTP-request-length-required,
|
|
39
|
+
HTTP-request-body-size(option<u64>),
|
|
40
|
+
HTTP-request-method-invalid,
|
|
41
|
+
HTTP-request-URI-invalid,
|
|
42
|
+
HTTP-request-URI-too-long,
|
|
43
|
+
HTTP-request-header-section-size(option<u32>),
|
|
44
|
+
HTTP-request-header-size(option<field-size-payload>),
|
|
45
|
+
HTTP-request-trailer-section-size(option<u32>),
|
|
46
|
+
HTTP-request-trailer-size(field-size-payload),
|
|
47
|
+
HTTP-response-incomplete,
|
|
48
|
+
HTTP-response-header-section-size(option<u32>),
|
|
49
|
+
HTTP-response-header-size(field-size-payload),
|
|
50
|
+
HTTP-response-body-size(option<u64>),
|
|
51
|
+
HTTP-response-trailer-section-size(option<u32>),
|
|
52
|
+
HTTP-response-trailer-size(field-size-payload),
|
|
53
|
+
HTTP-response-transfer-coding(option<string>),
|
|
54
|
+
HTTP-response-content-coding(option<string>),
|
|
55
|
+
HTTP-response-timeout,
|
|
56
|
+
HTTP-upgrade-failed,
|
|
57
|
+
HTTP-protocol-error,
|
|
58
|
+
loop-detected,
|
|
59
|
+
configuration-error,
|
|
60
|
+
internal-error(option<string>)
|
|
61
|
+
}
|
|
62
|
+
record DNS-error-payload {
|
|
63
|
+
rcode: option<string>,
|
|
64
|
+
info-code: option<u16>
|
|
65
|
+
}
|
|
66
|
+
record TLS-alert-received-payload {
|
|
67
|
+
alert-id: option<u8>,
|
|
68
|
+
alert-message: option<string>
|
|
69
|
+
}
|
|
70
|
+
record field-size-payload {
|
|
71
|
+
field-name: option<string>,
|
|
72
|
+
field-size: option<u32>
|
|
73
|
+
}
|
|
74
|
+
variant header-error {
|
|
75
|
+
invalid-syntax,
|
|
76
|
+
forbidden,
|
|
77
|
+
immutable,
|
|
78
|
+
size-exceeded,
|
|
79
|
+
other(option<string>),
|
|
80
|
+
}
|
|
81
|
+
variant request-options-error {
|
|
82
|
+
not-supported,
|
|
83
|
+
immutable,
|
|
84
|
+
other(option<string>),
|
|
85
|
+
}
|
|
86
|
+
type field-name = string;
|
|
87
|
+
type field-value = list<u8>;
|
|
88
|
+
resource fields {
|
|
89
|
+
constructor();
|
|
90
|
+
from-list: static func(
|
|
91
|
+
entries: list<tuple<field-name,field-value>>
|
|
92
|
+
) -> result<fields, header-error>;
|
|
93
|
+
get: func(name: field-name) -> list<field-value>;
|
|
94
|
+
has: func(name: field-name) -> bool;
|
|
95
|
+
set: func(name: field-name, value: list<field-value>) -> result<_, header-error>;
|
|
96
|
+
delete: func(name: field-name) -> result<_, header-error>;
|
|
97
|
+
get-and-delete: func(name: field-name) -> result<list<field-value>, header-error>;
|
|
98
|
+
append: func(name: field-name, value: field-value) -> result<_, header-error>;
|
|
99
|
+
copy-all: func() -> list<tuple<field-name,field-value>>;
|
|
100
|
+
clone: func() -> fields;
|
|
101
|
+
}
|
|
102
|
+
type headers = fields;
|
|
103
|
+
type trailers = fields;
|
|
104
|
+
resource request {
|
|
105
|
+
new: static func(
|
|
106
|
+
headers: headers,
|
|
107
|
+
contents: option<stream<u8>>,
|
|
108
|
+
trailers: future<result<option<trailers>, error-code>>,
|
|
109
|
+
options: option<request-options>
|
|
110
|
+
) -> tuple<request, future<result<_, error-code>>>;
|
|
111
|
+
get-method: func() -> method;
|
|
112
|
+
set-method: func(method: method) -> result;
|
|
113
|
+
get-path-with-query: func() -> option<string>;
|
|
114
|
+
set-path-with-query: func(path-with-query: option<string>) -> result;
|
|
115
|
+
get-scheme: func() -> option<scheme>;
|
|
116
|
+
set-scheme: func(scheme: option<scheme>) -> result;
|
|
117
|
+
get-authority: func() -> option<string>;
|
|
118
|
+
set-authority: func(authority: option<string>) -> result;
|
|
119
|
+
get-options: func() -> option<request-options>;
|
|
120
|
+
get-headers: func() -> headers;
|
|
121
|
+
consume-body: static func(this: request, res: future<result<_, error-code>>) -> tuple<stream<u8>, future<result<option<trailers>, error-code>>>;
|
|
122
|
+
}
|
|
123
|
+
resource request-options {
|
|
124
|
+
constructor();
|
|
125
|
+
get-connect-timeout: func() -> option<duration>;
|
|
126
|
+
set-connect-timeout: func(duration: option<duration>) -> result<_, request-options-error>;
|
|
127
|
+
get-first-byte-timeout: func() -> option<duration>;
|
|
128
|
+
set-first-byte-timeout: func(duration: option<duration>) -> result<_, request-options-error>;
|
|
129
|
+
get-between-bytes-timeout: func() -> option<duration>;
|
|
130
|
+
set-between-bytes-timeout: func(duration: option<duration>) -> result<_, request-options-error>;
|
|
131
|
+
clone: func() -> request-options;
|
|
132
|
+
}
|
|
133
|
+
type status-code = u16;
|
|
134
|
+
resource response {
|
|
135
|
+
new: static func(
|
|
136
|
+
headers: headers,
|
|
137
|
+
contents: option<stream<u8>>,
|
|
138
|
+
trailers: future<result<option<trailers>, error-code>>,
|
|
139
|
+
) -> tuple<response, future<result<_, error-code>>>;
|
|
140
|
+
get-status-code: func() -> status-code;
|
|
141
|
+
set-status-code: func(status-code: status-code) -> result;
|
|
142
|
+
get-headers: func() -> headers;
|
|
143
|
+
consume-body: static func(this: response, res: future<result<_, error-code>>) -> tuple<stream<u8>, future<result<option<trailers>, error-code>>>;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
world service {
|
|
147
|
+
include wasi:clocks/imports@0.3.0;
|
|
148
|
+
include wasi:random/imports@0.3.0;
|
|
149
|
+
import wasi:cli/stdout@0.3.0;
|
|
150
|
+
import wasi:cli/stderr@0.3.0;
|
|
151
|
+
import wasi:cli/stdin@0.3.0;
|
|
152
|
+
import client;
|
|
153
|
+
export handler;
|
|
154
|
+
}
|
|
155
|
+
world middleware {
|
|
156
|
+
include service;
|
|
157
|
+
import handler;
|
|
158
|
+
}
|
|
159
|
+
interface handler {
|
|
160
|
+
use types.{request, response, error-code};
|
|
161
|
+
handle: async func(
|
|
162
|
+
request: request,
|
|
163
|
+
) -> result<response, error-code>;
|
|
164
|
+
}
|
|
165
|
+
interface client {
|
|
166
|
+
use types.{request, response, error-code};
|
|
167
|
+
send: async func(
|
|
168
|
+
request: request,
|
|
169
|
+
) -> result<response, error-code>;
|
|
170
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
package wasi:random@0.3.0;
|
|
2
|
+
interface insecure-seed {
|
|
3
|
+
get-insecure-seed: func() -> tuple<u64, u64>;
|
|
4
|
+
}
|
|
5
|
+
interface insecure {
|
|
6
|
+
get-insecure-random-bytes: func(max-len: u64) -> list<u8>;
|
|
7
|
+
get-insecure-random-u64: func() -> u64;
|
|
8
|
+
}
|
|
9
|
+
interface random {
|
|
10
|
+
get-random-bytes: func(max-len: u64) -> list<u8>;
|
|
11
|
+
get-random-u64: func() -> u64;
|
|
12
|
+
}
|
|
13
|
+
world imports {
|
|
14
|
+
import random;
|
|
15
|
+
import insecure;
|
|
16
|
+
import insecure-seed;
|
|
17
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
package wasi:sockets@0.3.0;
|
|
2
|
+
interface ip-name-lookup {
|
|
3
|
+
use types.{ip-address};
|
|
4
|
+
variant error-code {
|
|
5
|
+
access-denied,
|
|
6
|
+
invalid-argument,
|
|
7
|
+
name-unresolvable,
|
|
8
|
+
temporary-resolver-failure,
|
|
9
|
+
permanent-resolver-failure,
|
|
10
|
+
other(option<string>),
|
|
11
|
+
}
|
|
12
|
+
resolve-addresses: async func(name: string) -> result<list<ip-address>, error-code>;
|
|
13
|
+
}
|
|
14
|
+
interface types {
|
|
15
|
+
use wasi:clocks/types@0.3.0.{duration};
|
|
16
|
+
variant error-code {
|
|
17
|
+
access-denied,
|
|
18
|
+
not-supported,
|
|
19
|
+
invalid-argument,
|
|
20
|
+
out-of-memory,
|
|
21
|
+
timeout,
|
|
22
|
+
invalid-state,
|
|
23
|
+
address-not-bindable,
|
|
24
|
+
address-in-use,
|
|
25
|
+
remote-unreachable,
|
|
26
|
+
connection-refused,
|
|
27
|
+
connection-broken,
|
|
28
|
+
connection-reset,
|
|
29
|
+
connection-aborted,
|
|
30
|
+
datagram-too-large,
|
|
31
|
+
other(option<string>),
|
|
32
|
+
}
|
|
33
|
+
enum ip-address-family {
|
|
34
|
+
ipv4,
|
|
35
|
+
ipv6,
|
|
36
|
+
}
|
|
37
|
+
type ipv4-address = tuple<u8, u8, u8, u8>;
|
|
38
|
+
type ipv6-address = tuple<u16, u16, u16, u16, u16, u16, u16, u16>;
|
|
39
|
+
variant ip-address {
|
|
40
|
+
ipv4(ipv4-address),
|
|
41
|
+
ipv6(ipv6-address),
|
|
42
|
+
}
|
|
43
|
+
record ipv4-socket-address {
|
|
44
|
+
port: u16,
|
|
45
|
+
address: ipv4-address,
|
|
46
|
+
}
|
|
47
|
+
record ipv6-socket-address {
|
|
48
|
+
port: u16,
|
|
49
|
+
flow-info: u32,
|
|
50
|
+
address: ipv6-address,
|
|
51
|
+
scope-id: u32,
|
|
52
|
+
}
|
|
53
|
+
variant ip-socket-address {
|
|
54
|
+
ipv4(ipv4-socket-address),
|
|
55
|
+
ipv6(ipv6-socket-address),
|
|
56
|
+
}
|
|
57
|
+
resource tcp-socket {
|
|
58
|
+
create: static func(address-family: ip-address-family) -> result<tcp-socket, error-code>;
|
|
59
|
+
bind: func(local-address: ip-socket-address) -> result<_, error-code>;
|
|
60
|
+
connect: async func(remote-address: ip-socket-address) -> result<_, error-code>;
|
|
61
|
+
listen: func() -> result<stream<tcp-socket>, error-code>;
|
|
62
|
+
send: func(data: stream<u8>) -> future<result<_, error-code>>;
|
|
63
|
+
receive: func() -> tuple<stream<u8>, future<result<_, error-code>>>;
|
|
64
|
+
get-local-address: func() -> result<ip-socket-address, error-code>;
|
|
65
|
+
get-remote-address: func() -> result<ip-socket-address, error-code>;
|
|
66
|
+
get-is-listening: func() -> bool;
|
|
67
|
+
get-address-family: func() -> ip-address-family;
|
|
68
|
+
set-listen-backlog-size: func(value: u64) -> result<_, error-code>;
|
|
69
|
+
get-keep-alive-enabled: func() -> result<bool, error-code>;
|
|
70
|
+
set-keep-alive-enabled: func(value: bool) -> result<_, error-code>;
|
|
71
|
+
get-keep-alive-idle-time: func() -> result<duration, error-code>;
|
|
72
|
+
set-keep-alive-idle-time: func(value: duration) -> result<_, error-code>;
|
|
73
|
+
get-keep-alive-interval: func() -> result<duration, error-code>;
|
|
74
|
+
set-keep-alive-interval: func(value: duration) -> result<_, error-code>;
|
|
75
|
+
get-keep-alive-count: func() -> result<u32, error-code>;
|
|
76
|
+
set-keep-alive-count: func(value: u32) -> result<_, error-code>;
|
|
77
|
+
get-hop-limit: func() -> result<u8, error-code>;
|
|
78
|
+
set-hop-limit: func(value: u8) -> result<_, error-code>;
|
|
79
|
+
get-receive-buffer-size: func() -> result<u64, error-code>;
|
|
80
|
+
set-receive-buffer-size: func(value: u64) -> result<_, error-code>;
|
|
81
|
+
get-send-buffer-size: func() -> result<u64, error-code>;
|
|
82
|
+
set-send-buffer-size: func(value: u64) -> result<_, error-code>;
|
|
83
|
+
}
|
|
84
|
+
resource udp-socket {
|
|
85
|
+
create: static func(address-family: ip-address-family) -> result<udp-socket, error-code>;
|
|
86
|
+
bind: func(local-address: ip-socket-address) -> result<_, error-code>;
|
|
87
|
+
connect: func(remote-address: ip-socket-address) -> result<_, error-code>;
|
|
88
|
+
disconnect: func() -> result<_, error-code>;
|
|
89
|
+
send: async func(data: list<u8>, remote-address: option<ip-socket-address>) -> result<_, error-code>;
|
|
90
|
+
receive: async func() -> result<tuple<list<u8>, ip-socket-address>, error-code>;
|
|
91
|
+
get-local-address: func() -> result<ip-socket-address, error-code>;
|
|
92
|
+
get-remote-address: func() -> result<ip-socket-address, error-code>;
|
|
93
|
+
get-address-family: func() -> ip-address-family;
|
|
94
|
+
get-unicast-hop-limit: func() -> result<u8, error-code>;
|
|
95
|
+
set-unicast-hop-limit: func(value: u8) -> result<_, error-code>;
|
|
96
|
+
get-receive-buffer-size: func() -> result<u64, error-code>;
|
|
97
|
+
set-receive-buffer-size: func(value: u64) -> result<_, error-code>;
|
|
98
|
+
get-send-buffer-size: func() -> result<u64, error-code>;
|
|
99
|
+
set-send-buffer-size: func(value: u64) -> result<_, error-code>;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
world imports {
|
|
103
|
+
import types;
|
|
104
|
+
import ip-name-lookup;
|
|
105
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Copyright © 2019-2023 the Contributors to the WASI Specification, published
|
|
2
|
+
by the [WebAssembly Community Group][cg] under the
|
|
3
|
+
[W3C Community Contributor License Agreement (CLA)][cla]. A human-readable
|
|
4
|
+
[summary][summary] is available.
|
|
5
|
+
|
|
6
|
+
[cg]: https://www.w3.org/community/webassembly/
|
|
7
|
+
[cla]: https://www.w3.org/community/about/agreements/cla/
|
|
8
|
+
[summary]: https://www.w3.org/community/about/agreements/cla-deed/
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Bundled WASI WIT snapshots
|
|
2
|
+
|
|
3
|
+
These WIT sources are derived from the official
|
|
4
|
+
[`WebAssembly/WASI`](https://github.com/WebAssembly/WASI) repository:
|
|
5
|
+
|
|
6
|
+
- `0.3.0`: tag `v0.3.0`, commit `3ee2a590c766594ae44a54730fc74fc27da5c609`
|
|
7
|
+
- `0.2.12`: tag `v0.2.12`, commit `281ba75fafcd50961ef55f9e52747afcc9b71ede`
|
|
8
|
+
|
|
9
|
+
Each proposal package's `.wit` files are combined into one `package.wit`.
|
|
10
|
+
Documentation comments, blank lines, and release-history annotations are
|
|
11
|
+
removed to reduce the published package size; WIT declarations are unchanged.
|
|
12
|
+
The snapshots remain covered by the official WASI license in `LICENSE.md`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bytecodealliance/jco",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.32.0",
|
|
4
4
|
"description": "JavaScript tooling for working with WebAssembly Components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Component",
|
|
@@ -57,9 +57,8 @@
|
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@bytecodealliance/componentize-js": "^0.22.0",
|
|
59
59
|
"@bytecodealliance/componentize-js-0-19-3": "npm:@bytecodealliance/componentize-js@^0.19.3",
|
|
60
|
-
"@bytecodealliance/jco-transpile": "^0.
|
|
61
|
-
"@bytecodealliance/preview2-shim": "^0.
|
|
62
|
-
"@bytecodealliance/preview3-shim": "^0.3.2",
|
|
60
|
+
"@bytecodealliance/jco-transpile": "^0.12.0",
|
|
61
|
+
"@bytecodealliance/preview2-shim": "^0.22.0",
|
|
63
62
|
"binaryen": "^130.0.0",
|
|
64
63
|
"commander": "^14",
|
|
65
64
|
"componentize-qjs": "^0.4.2",
|
|
@@ -88,6 +87,7 @@
|
|
|
88
87
|
"build:ts": "tsc -p tsconfig.json",
|
|
89
88
|
"build:types:preview2-shim": "pnpm run build:types:preview2-shim --include-workspace-root",
|
|
90
89
|
"build:test:components": "cargo xtask build-test-components",
|
|
90
|
+
"bench:serve-isolation": "node test/bench/serve-request-isolation.js",
|
|
91
91
|
"fmt": "oxfmt",
|
|
92
92
|
"fmt:check": "oxfmt --check",
|
|
93
93
|
"lint": "oxlint",
|