@bytecodealliance/preview2-shim 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/README.md +1 -0
  2. package/lib/browser/cli-base.js +57 -0
  3. package/lib/browser/clocks.js +50 -0
  4. package/lib/browser/filesystem.js +134 -141
  5. package/lib/browser/http.js +120 -0
  6. package/lib/browser/index.js +15 -37
  7. package/lib/browser/io.js +62 -20
  8. package/lib/browser/logging.js +16 -0
  9. package/lib/browser/poll.js +10 -6
  10. package/lib/browser/random.js +32 -25
  11. package/lib/browser/sockets.js +203 -0
  12. package/lib/nodejs/{preopens.js → cli-base.js} +47 -8
  13. package/lib/nodejs/clocks.js +50 -0
  14. package/lib/nodejs/filesystem.js +239 -234
  15. package/lib/nodejs/http.js +120 -0
  16. package/lib/nodejs/index.js +15 -37
  17. package/lib/nodejs/io.js +138 -19
  18. package/lib/nodejs/logging.js +16 -0
  19. package/lib/nodejs/poll.js +10 -6
  20. package/lib/nodejs/random.js +18 -13
  21. package/lib/nodejs/sockets.js +203 -0
  22. package/package.json +1 -1
  23. package/types/exports/{HTTP.d.ts → http-incoming-handler.d.ts} +1 -1
  24. package/types/imports/cli-base-environment.d.ts +17 -0
  25. package/types/imports/{exit.d.ts → cli-base-exit.d.ts} +4 -1
  26. package/types/imports/{preopens.d.ts → cli-base-preopens.d.ts} +6 -9
  27. package/types/imports/cli-base-stderr.d.ts +5 -0
  28. package/types/imports/cli-base-stdin.d.ts +5 -0
  29. package/types/imports/cli-base-stdout.d.ts +5 -0
  30. package/types/imports/clocks-monotonic-clock.d.ts +24 -0
  31. package/types/imports/clocks-timezone.d.ts +71 -0
  32. package/types/imports/clocks-wall-clock.d.ts +31 -0
  33. package/types/imports/filesystem-filesystem.d.ts +857 -0
  34. package/types/imports/{default-outgoing-HTTP.d.ts → http-outgoing-handler.d.ts} +1 -1
  35. package/types/imports/{types.d.ts → http-types.d.ts} +28 -28
  36. package/types/imports/io-streams.d.ts +180 -0
  37. package/types/imports/logging-handler.d.ts +40 -0
  38. package/types/imports/poll-poll.d.ts +41 -0
  39. package/types/imports/random-insecure-seed.d.ts +22 -0
  40. package/types/imports/random-insecure.d.ts +20 -0
  41. package/types/imports/random-random.d.ts +22 -0
  42. package/types/imports/{instance-network.d.ts → sockets-instance-network.d.ts} +4 -1
  43. package/types/imports/sockets-ip-name-lookup.d.ts +76 -0
  44. package/types/imports/sockets-network.d.ts +212 -0
  45. package/types/imports/sockets-tcp-create-socket.d.ts +33 -0
  46. package/types/imports/sockets-tcp.d.ts +285 -0
  47. package/types/imports/sockets-udp-create-socket.d.ts +33 -0
  48. package/types/imports/sockets-udp.d.ts +219 -0
  49. package/types/wasi-command.d.ts +23 -0
  50. package/types/wasi-proxy.d.ts +11 -44
  51. package/types/wasi-reactor.d.ts +23 -70
  52. package/lib/browser/console.js +0 -12
  53. package/lib/browser/default-outgoing-HTTP.js +0 -3
  54. package/lib/browser/environment.js +0 -17
  55. package/lib/browser/exit.js +0 -21
  56. package/lib/browser/instance-network.js +0 -3
  57. package/lib/browser/ip-name-lookup.js +0 -23
  58. package/lib/browser/monotonic-clock.js +0 -14
  59. package/lib/browser/network.js +0 -3
  60. package/lib/browser/preopens.js +0 -11
  61. package/lib/browser/stderr.js +0 -4
  62. package/lib/browser/streams.js +0 -60
  63. package/lib/browser/tcp-create-socket.js +0 -3
  64. package/lib/browser/tcp.js +0 -75
  65. package/lib/browser/timezone.js +0 -12
  66. package/lib/browser/types.js +0 -99
  67. package/lib/browser/udp-create-socket.js +0 -3
  68. package/lib/browser/udp.js +0 -75
  69. package/lib/browser/wall-clock.js +0 -9
  70. package/lib/nodejs/console.js +0 -12
  71. package/lib/nodejs/default-outgoing-HTTP.js +0 -3
  72. package/lib/nodejs/environment.js +0 -19
  73. package/lib/nodejs/exit.js +0 -3
  74. package/lib/nodejs/instance-network.js +0 -3
  75. package/lib/nodejs/ip-name-lookup.js +0 -23
  76. package/lib/nodejs/monotonic-clock.js +0 -14
  77. package/lib/nodejs/network.js +0 -3
  78. package/lib/nodejs/stderr.js +0 -4
  79. package/lib/nodejs/streams.js +0 -97
  80. package/lib/nodejs/tcp-create-socket.js +0 -3
  81. package/lib/nodejs/tcp.js +0 -75
  82. package/lib/nodejs/timezone.js +0 -12
  83. package/lib/nodejs/types.js +0 -99
  84. package/lib/nodejs/udp-create-socket.js +0 -3
  85. package/lib/nodejs/udp.js +0 -75
  86. package/lib/nodejs/wall-clock.js +0 -9
  87. package/types/imports/console.d.ts +0 -17
  88. package/types/imports/environment.d.ts +0 -4
  89. package/types/imports/filesystem.d.ts +0 -210
  90. package/types/imports/ip-name-lookup.d.ts +0 -19
  91. package/types/imports/monotonic-clock.d.ts +0 -8
  92. package/types/imports/network.d.ts +0 -50
  93. package/types/imports/poll.d.ts +0 -5
  94. package/types/imports/random.d.ts +0 -5
  95. package/types/imports/streams.d.ts +0 -23
  96. package/types/imports/tcp-create-socket.d.ts +0 -9
  97. package/types/imports/tcp.d.ts +0 -52
  98. package/types/imports/timezone.d.ts +0 -13
  99. package/types/imports/udp-create-socket.d.ts +0 -9
  100. package/types/imports/udp.d.ts +0 -36
  101. package/types/imports/wall-clock.d.ts +0 -8
  102. package/types/index.d.ts +0 -8
@@ -1,4 +0,0 @@
1
- export namespace Environment {
2
- export function getEnvironment(): [string, string][];
3
- export function getArguments(): string[];
4
- }
@@ -1,210 +0,0 @@
1
- export namespace Filesystem {
2
- export function readViaStream(this: Descriptor, offset: Filesize): InputStream;
3
- export function writeViaStream(this: Descriptor, offset: Filesize): OutputStream;
4
- export function appendViaStream(this: Descriptor): OutputStream;
5
- export function advise(this: Descriptor, offset: Filesize, length: Filesize, advice: Advice): void;
6
- export function syncData(this: Descriptor): void;
7
- export function getFlags(this: Descriptor): DescriptorFlags;
8
- export function getType(this: Descriptor): DescriptorType;
9
- export function setSize(this: Descriptor, size: Filesize): void;
10
- export function setTimes(this: Descriptor, dataAccessTimestamp: NewTimestamp, dataModificationTimestamp: NewTimestamp): void;
11
- export function read(this: Descriptor, length: Filesize, offset: Filesize): [Uint8Array | ArrayBuffer, boolean];
12
- export function write(this: Descriptor, buffer: Uint8Array, offset: Filesize): Filesize;
13
- export function readDirectory(this: Descriptor): DirectoryEntryStream;
14
- export function sync(this: Descriptor): void;
15
- export function createDirectoryAt(this: Descriptor, path: string): void;
16
- export function stat(this: Descriptor): DescriptorStat;
17
- export function statAt(this: Descriptor, pathFlags: PathFlags, path: string): DescriptorStat;
18
- export function setTimesAt(this: Descriptor, pathFlags: PathFlags, path: string, dataAccessTimestamp: NewTimestamp, dataModificationTimestamp: NewTimestamp): void;
19
- export function linkAt(this: Descriptor, oldPathFlags: PathFlags, oldPath: string, newDescriptor: Descriptor, newPath: string): void;
20
- export function openAt(this: Descriptor, pathFlags: PathFlags, path: string, openFlags: OpenFlags, flags: DescriptorFlags, modes: Modes): Descriptor;
21
- export function readlinkAt(this: Descriptor, path: string): string;
22
- export function removeDirectoryAt(this: Descriptor, path: string): void;
23
- export function renameAt(this: Descriptor, oldPath: string, newDescriptor: Descriptor, newPath: string): void;
24
- export function symlinkAt(this: Descriptor, oldPath: string, newPath: string): void;
25
- export function unlinkFileAt(this: Descriptor, path: string): void;
26
- export function changeFilePermissionsAt(this: Descriptor, pathFlags: PathFlags, path: string, modes: Modes): void;
27
- export function changeDirectoryPermissionsAt(this: Descriptor, pathFlags: PathFlags, path: string, modes: Modes): void;
28
- export function lockShared(this: Descriptor): void;
29
- export function lockExclusive(this: Descriptor): void;
30
- export function tryLockShared(this: Descriptor): void;
31
- export function tryLockExclusive(this: Descriptor): void;
32
- export function unlock(this: Descriptor): void;
33
- export function dropDescriptor(this: Descriptor): void;
34
- export function readDirectoryEntry(this: DirectoryEntryStream): DirectoryEntry | null;
35
- export function dropDirectoryEntryStream(this: DirectoryEntryStream): void;
36
- }
37
- export type Descriptor = number;
38
- export type Filesize = bigint;
39
- import type { InputStream } from '../imports/streams';
40
- export { InputStream };
41
- import type { OutputStream } from '../imports/streams';
42
- export { OutputStream };
43
- /**
44
- * # Variants
45
- *
46
- * ## `"normal"`
47
- *
48
- * ## `"sequential"`
49
- *
50
- * ## `"random"`
51
- *
52
- * ## `"will-need"`
53
- *
54
- * ## `"dont-need"`
55
- *
56
- * ## `"no-reuse"`
57
- */
58
- export type Advice = 'normal' | 'sequential' | 'random' | 'will-need' | 'dont-need' | 'no-reuse';
59
- /**
60
- * # Variants
61
- *
62
- * ## `"access"`
63
- *
64
- * ## `"would-block"`
65
- *
66
- * ## `"already"`
67
- *
68
- * ## `"bad-descriptor"`
69
- *
70
- * ## `"busy"`
71
- *
72
- * ## `"deadlock"`
73
- *
74
- * ## `"quota"`
75
- *
76
- * ## `"exist"`
77
- *
78
- * ## `"file-too-large"`
79
- *
80
- * ## `"illegal-byte-sequence"`
81
- *
82
- * ## `"in-progress"`
83
- *
84
- * ## `"interrupted"`
85
- *
86
- * ## `"invalid"`
87
- *
88
- * ## `"io"`
89
- *
90
- * ## `"is-directory"`
91
- *
92
- * ## `"loop"`
93
- *
94
- * ## `"too-many-links"`
95
- *
96
- * ## `"message-size"`
97
- *
98
- * ## `"name-too-long"`
99
- *
100
- * ## `"no-device"`
101
- *
102
- * ## `"no-entry"`
103
- *
104
- * ## `"no-lock"`
105
- *
106
- * ## `"insufficient-memory"`
107
- *
108
- * ## `"insufficient-space"`
109
- *
110
- * ## `"not-directory"`
111
- *
112
- * ## `"not-empty"`
113
- *
114
- * ## `"not-recoverable"`
115
- *
116
- * ## `"unsupported"`
117
- *
118
- * ## `"no-tty"`
119
- *
120
- * ## `"no-such-device"`
121
- *
122
- * ## `"overflow"`
123
- *
124
- * ## `"not-permitted"`
125
- *
126
- * ## `"pipe"`
127
- *
128
- * ## `"read-only"`
129
- *
130
- * ## `"invalid-seek"`
131
- *
132
- * ## `"text-file-busy"`
133
- *
134
- * ## `"cross-device"`
135
- */
136
- export type ErrorCode = 'access' | 'would-block' | 'already' | 'bad-descriptor' | 'busy' | 'deadlock' | 'quota' | 'exist' | 'file-too-large' | 'illegal-byte-sequence' | 'in-progress' | 'interrupted' | 'invalid' | 'io' | 'is-directory' | 'loop' | 'too-many-links' | 'message-size' | 'name-too-long' | 'no-device' | 'no-entry' | 'no-lock' | 'insufficient-memory' | 'insufficient-space' | 'not-directory' | 'not-empty' | 'not-recoverable' | 'unsupported' | 'no-tty' | 'no-such-device' | 'overflow' | 'not-permitted' | 'pipe' | 'read-only' | 'invalid-seek' | 'text-file-busy' | 'cross-device';
137
- export interface DescriptorFlags {
138
- read?: boolean,
139
- write?: boolean,
140
- fileIntegritySync?: boolean,
141
- dataIntegritySync?: boolean,
142
- requestedWriteSync?: boolean,
143
- mutateDirectory?: boolean,
144
- }
145
- /**
146
- * # Variants
147
- *
148
- * ## `"unknown"`
149
- *
150
- * ## `"block-device"`
151
- *
152
- * ## `"character-device"`
153
- *
154
- * ## `"directory"`
155
- *
156
- * ## `"fifo"`
157
- *
158
- * ## `"symbolic-link"`
159
- *
160
- * ## `"regular-file"`
161
- *
162
- * ## `"socket"`
163
- */
164
- export type DescriptorType = 'unknown' | 'block-device' | 'character-device' | 'directory' | 'fifo' | 'symbolic-link' | 'regular-file' | 'socket';
165
- import type { Datetime } from '../imports/wall-clock';
166
- export { Datetime };
167
- export type NewTimestamp = NewTimestampNoChange | NewTimestampNow | NewTimestampTimestamp;
168
- export interface NewTimestampNoChange {
169
- tag: 'no-change',
170
- }
171
- export interface NewTimestampNow {
172
- tag: 'now',
173
- }
174
- export interface NewTimestampTimestamp {
175
- tag: 'timestamp',
176
- val: Datetime,
177
- }
178
- export type DirectoryEntryStream = number;
179
- export type Device = bigint;
180
- export type Inode = bigint;
181
- export type LinkCount = bigint;
182
- export interface DescriptorStat {
183
- device: Device,
184
- inode: Inode,
185
- type: DescriptorType,
186
- linkCount: LinkCount,
187
- size: Filesize,
188
- dataAccessTimestamp: Datetime,
189
- dataModificationTimestamp: Datetime,
190
- statusChangeTimestamp: Datetime,
191
- }
192
- export interface PathFlags {
193
- symlinkFollow?: boolean,
194
- }
195
- export interface OpenFlags {
196
- create?: boolean,
197
- directory?: boolean,
198
- exclusive?: boolean,
199
- truncate?: boolean,
200
- }
201
- export interface Modes {
202
- readable?: boolean,
203
- writeable?: boolean,
204
- executable?: boolean,
205
- }
206
- export interface DirectoryEntry {
207
- inode?: Inode,
208
- type: DescriptorType,
209
- name: string,
210
- }
@@ -1,19 +0,0 @@
1
- export namespace IpNameLookup {
2
- export function resolveAddresses(network: Network, name: string, addressFamily: IpAddressFamily | null, includeUnavailable: boolean): ResolveAddressStream;
3
- export function resolveNextAddress(this: ResolveAddressStream): IpAddress | null;
4
- export function dropResolveAddressStream(this: ResolveAddressStream): void;
5
- export function nonBlocking(this: ResolveAddressStream): boolean;
6
- export function setNonBlocking(this: ResolveAddressStream, value: boolean): void;
7
- export function subscribe(this: ResolveAddressStream): Pollable;
8
- }
9
- import type { Network } from '../imports/network';
10
- export { Network };
11
- import type { IpAddressFamily } from '../imports/network';
12
- export { IpAddressFamily };
13
- export type ResolveAddressStream = number;
14
- import type { Error } from '../imports/network';
15
- export { Error };
16
- import type { IpAddress } from '../imports/network';
17
- export { IpAddress };
18
- import type { Pollable } from '../imports/poll';
19
- export { Pollable };
@@ -1,8 +0,0 @@
1
- export namespace MonotonicClock {
2
- export function now(): Instant;
3
- export function resolution(): Instant;
4
- export function subscribe(when: Instant, absolute: boolean): Pollable;
5
- }
6
- export type Instant = bigint;
7
- import type { Pollable } from '../imports/poll';
8
- export { Pollable };
@@ -1,50 +0,0 @@
1
- export namespace Network {
2
- export function dropNetwork(this: Network): void;
3
- }
4
- export type Network = number;
5
- export type Ipv6Address = [number, number, number, number, number, number, number, number];
6
- export interface Ipv6SocketAddress {
7
- port: number,
8
- flowInfo: number,
9
- address: Ipv6Address,
10
- scopeId: number,
11
- }
12
- export type Ipv4Address = [number, number, number, number];
13
- export interface Ipv4SocketAddress {
14
- port: number,
15
- address: Ipv4Address,
16
- }
17
- export type IpSocketAddress = IpSocketAddressIpv4 | IpSocketAddressIpv6;
18
- export interface IpSocketAddressIpv4 {
19
- tag: 'ipv4',
20
- val: Ipv4SocketAddress,
21
- }
22
- export interface IpSocketAddressIpv6 {
23
- tag: 'ipv6',
24
- val: Ipv6SocketAddress,
25
- }
26
- export type IpAddress = IpAddressIpv4 | IpAddressIpv6;
27
- export interface IpAddressIpv4 {
28
- tag: 'ipv4',
29
- val: Ipv4Address,
30
- }
31
- export interface IpAddressIpv6 {
32
- tag: 'ipv6',
33
- val: Ipv6Address,
34
- }
35
- /**
36
- * # Variants
37
- *
38
- * ## `"unknown"`
39
- *
40
- * ## `"again"`
41
- */
42
- export type Error = 'unknown' | 'again';
43
- /**
44
- * # Variants
45
- *
46
- * ## `"ipv4"`
47
- *
48
- * ## `"ipv6"`
49
- */
50
- export type IpAddressFamily = 'ipv4' | 'ipv6';
@@ -1,5 +0,0 @@
1
- export namespace Poll {
2
- export function dropPollable(this: Pollable): void;
3
- export function pollOneoff(in_: Uint32Array): Uint8Array | ArrayBuffer;
4
- }
5
- export type Pollable = number;
@@ -1,5 +0,0 @@
1
- export namespace Random {
2
- export function getRandomBytes(len: bigint): Uint8Array | ArrayBuffer;
3
- export function getRandomU64(): bigint;
4
- export function insecureRandom(): [bigint, bigint];
5
- }
@@ -1,23 +0,0 @@
1
- export namespace Streams {
2
- export function read(this: InputStream, len: bigint): [Uint8Array | ArrayBuffer, boolean];
3
- export function blockingRead(this: InputStream, len: bigint): [Uint8Array | ArrayBuffer, boolean];
4
- export function skip(this: InputStream, len: bigint): [bigint, boolean];
5
- export function blockingSkip(this: InputStream, len: bigint): [bigint, boolean];
6
- export function subscribeToInputStream(this: InputStream): Pollable;
7
- export function dropInputStream(this: InputStream): void;
8
- export function write(this: OutputStream, buf: Uint8Array): bigint;
9
- export function blockingWrite(this: OutputStream, buf: Uint8Array): bigint;
10
- export function writeZeroes(this: OutputStream, len: bigint): bigint;
11
- export function blockingWriteZeroes(this: OutputStream, len: bigint): bigint;
12
- export function splice(this: OutputStream, src: InputStream, len: bigint): [bigint, boolean];
13
- export function blockingSplice(this: OutputStream, src: InputStream, len: bigint): [bigint, boolean];
14
- export function forward(this: OutputStream, src: InputStream): bigint;
15
- export function subscribeToOutputStream(this: OutputStream): Pollable;
16
- export function dropOutputStream(this: OutputStream): void;
17
- }
18
- export type InputStream = number;
19
- export interface StreamError {
20
- }
21
- import type { Pollable } from '../imports/poll';
22
- export { Pollable };
23
- export type OutputStream = number;
@@ -1,9 +0,0 @@
1
- export namespace TcpCreateSocket {
2
- export function createTcpSocket(addressFamily: IpAddressFamily): TcpSocket;
3
- }
4
- import type { IpAddressFamily } from '../imports/network';
5
- export { IpAddressFamily };
6
- import type { TcpSocket } from '../imports/tcp';
7
- export { TcpSocket };
8
- import type { Error } from '../imports/network';
9
- export { Error };
@@ -1,52 +0,0 @@
1
- export namespace Tcp {
2
- export function bind(this: TcpSocket, network: Network, localAddress: IpSocketAddress): void;
3
- export function connect(this: TcpSocket, network: Network, remoteAddress: IpSocketAddress): [InputStream, OutputStream];
4
- export function listen(this: TcpSocket, network: Network): void;
5
- export function accept(this: TcpSocket): [TcpSocket, InputStream, OutputStream];
6
- export function localAddress(this: TcpSocket): IpSocketAddress;
7
- export function remoteAddress(this: TcpSocket): IpSocketAddress;
8
- export function addressFamily(this: TcpSocket): IpAddressFamily;
9
- export function ipv6Only(this: TcpSocket): boolean;
10
- export function setIpv6Only(this: TcpSocket, value: boolean): void;
11
- export function setListenBacklogSize(this: TcpSocket, value: bigint): void;
12
- export function keepAlive(this: TcpSocket): boolean;
13
- export function setKeepAlive(this: TcpSocket, value: boolean): void;
14
- export function noDelay(this: TcpSocket): boolean;
15
- export function setNoDelay(this: TcpSocket, value: boolean): void;
16
- export function unicastHopLimit(this: TcpSocket): number;
17
- export function setUnicastHopLimit(this: TcpSocket, value: number): void;
18
- export function receiveBufferSize(this: TcpSocket): bigint;
19
- export function setReceiveBufferSize(this: TcpSocket, value: bigint): void;
20
- export function sendBufferSize(this: TcpSocket): bigint;
21
- export function setSendBufferSize(this: TcpSocket, value: bigint): void;
22
- export function nonBlocking(this: TcpSocket): boolean;
23
- export function setNonBlocking(this: TcpSocket, value: boolean): void;
24
- export function subscribe(this: TcpSocket): Pollable;
25
- export function shutdown(this: TcpSocket, shutdownType: ShutdownType): void;
26
- export function dropTcpSocket(this: TcpSocket): void;
27
- }
28
- export type TcpSocket = number;
29
- import type { Network } from '../imports/network';
30
- export { Network };
31
- import type { IpSocketAddress } from '../imports/network';
32
- export { IpSocketAddress };
33
- import type { Error } from '../imports/network';
34
- export { Error };
35
- import type { InputStream } from '../imports/streams';
36
- export { InputStream };
37
- import type { OutputStream } from '../imports/streams';
38
- export { OutputStream };
39
- import type { IpAddressFamily } from '../imports/network';
40
- export { IpAddressFamily };
41
- import type { Pollable } from '../imports/poll';
42
- export { Pollable };
43
- /**
44
- * # Variants
45
- *
46
- * ## `"receive"`
47
- *
48
- * ## `"send"`
49
- *
50
- * ## `"both"`
51
- */
52
- export type ShutdownType = 'receive' | 'send' | 'both';
@@ -1,13 +0,0 @@
1
- export namespace Timezone {
2
- export function display(this: Timezone, when: Datetime): TimezoneDisplay;
3
- export function utcOffset(this: Timezone, when: Datetime): number;
4
- export function dropTimezone(this: Timezone): void;
5
- }
6
- export type Timezone = number;
7
- import type { Datetime } from '../imports/wall-clock';
8
- export { Datetime };
9
- export interface TimezoneDisplay {
10
- utcOffset: number,
11
- name: string,
12
- inDaylightSavingTime: boolean,
13
- }
@@ -1,9 +0,0 @@
1
- export namespace UdpCreateSocket {
2
- export function createUdpSocket(addressFamily: IpAddressFamily): UdpSocket;
3
- }
4
- import type { IpAddressFamily } from '../imports/network';
5
- export { IpAddressFamily };
6
- import type { UdpSocket } from '../imports/udp';
7
- export { UdpSocket };
8
- import type { Error } from '../imports/network';
9
- export { Error };
@@ -1,36 +0,0 @@
1
- export namespace Udp {
2
- export function bind(this: UdpSocket, network: Network, localAddress: IpSocketAddress): void;
3
- export function connect(this: UdpSocket, network: Network, remoteAddress: IpSocketAddress): void;
4
- export function receive(this: UdpSocket): Datagram;
5
- export function send(this: UdpSocket, datagram: Datagram): void;
6
- export function localAddress(this: UdpSocket): IpSocketAddress;
7
- export function remoteAddress(this: UdpSocket): IpSocketAddress;
8
- export function addressFamily(this: UdpSocket): IpAddressFamily;
9
- export function ipv6Only(this: UdpSocket): boolean;
10
- export function setIpv6Only(this: UdpSocket, value: boolean): void;
11
- export function unicastHopLimit(this: UdpSocket): number;
12
- export function setUnicastHopLimit(this: UdpSocket, value: number): void;
13
- export function receiveBufferSize(this: UdpSocket): bigint;
14
- export function setReceiveBufferSize(this: UdpSocket, value: bigint): void;
15
- export function sendBufferSize(this: UdpSocket): bigint;
16
- export function setSendBufferSize(this: UdpSocket, value: bigint): void;
17
- export function nonBlocking(this: UdpSocket): boolean;
18
- export function setNonBlocking(this: UdpSocket, value: boolean): void;
19
- export function subscribe(this: UdpSocket): Pollable;
20
- export function dropUdpSocket(this: UdpSocket): void;
21
- }
22
- export type UdpSocket = number;
23
- import type { Network } from '../imports/network';
24
- export { Network };
25
- import type { IpSocketAddress } from '../imports/network';
26
- export { IpSocketAddress };
27
- import type { Error } from '../imports/network';
28
- export { Error };
29
- export interface Datagram {
30
- data: Uint8Array,
31
- remoteAddress: IpSocketAddress,
32
- }
33
- import type { IpAddressFamily } from '../imports/network';
34
- export { IpAddressFamily };
35
- import type { Pollable } from '../imports/poll';
36
- export { Pollable };
@@ -1,8 +0,0 @@
1
- export namespace WallClock {
2
- export function now(): Datetime;
3
- export function resolution(): Datetime;
4
- }
5
- export interface Datetime {
6
- seconds: bigint,
7
- nanoseconds: number,
8
- }
package/types/index.d.ts DELETED
@@ -1,8 +0,0 @@
1
- import { ImportObject as WasiProxyImportObject } from "./wasi-proxy";
2
- import { ImportObject as WasiReactorImportObject } from "./wasi-reactor";
3
-
4
- export type ImportObject = WasiProxyImportObject & WasiReactorImportObject;
5
-
6
- export declare const importObject: ImportObject;
7
-
8
- export default importObject;