@bytecodealliance/jco 0.12.3 → 0.13.1

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.
@@ -1,5 +1,5 @@
1
1
  export namespace WasiCliStderr {
2
2
  export function getStderr(): OutputStream;
3
3
  }
4
- import type { OutputStream } from '../interfaces/wasi-io-streams';
4
+ import type { OutputStream } from '../interfaces/wasi-io-streams.js';
5
5
  export { OutputStream };
@@ -1,5 +1,5 @@
1
1
  export namespace WasiCliStdin {
2
2
  export function getStdin(): InputStream;
3
3
  }
4
- import type { InputStream } from '../interfaces/wasi-io-streams';
4
+ import type { InputStream } from '../interfaces/wasi-io-streams.js';
5
5
  export { InputStream };
@@ -1,5 +1,5 @@
1
1
  export namespace WasiCliStdout {
2
2
  export function getStdout(): OutputStream;
3
3
  }
4
- import type { OutputStream } from '../interfaces/wasi-io-streams';
4
+ import type { OutputStream } from '../interfaces/wasi-io-streams.js';
5
5
  export { OutputStream };
@@ -1,4 +1,6 @@
1
1
  export namespace WasiCliTerminalInput {
2
- export function dropTerminalInput(this_: TerminalInput): void;
2
+ export { TerminalInput };
3
+ }
4
+
5
+ export class TerminalInput {
3
6
  }
4
- export type TerminalInput = number;
@@ -1,4 +1,6 @@
1
1
  export namespace WasiCliTerminalOutput {
2
- export function dropTerminalOutput(this_: TerminalOutput): void;
2
+ export { TerminalOutput };
3
+ }
4
+
5
+ export class TerminalOutput {
3
6
  }
4
- export type TerminalOutput = number;
@@ -1,5 +1,5 @@
1
1
  export namespace WasiCliTerminalStderr {
2
2
  export function getTerminalStderr(): TerminalOutput | undefined;
3
3
  }
4
- import type { TerminalOutput } from '../interfaces/wasi-cli-terminal-output';
4
+ import type { TerminalOutput } from '../interfaces/wasi-cli-terminal-output.js';
5
5
  export { TerminalOutput };
@@ -1,5 +1,5 @@
1
1
  export namespace WasiCliTerminalStdin {
2
2
  export function getTerminalStdin(): TerminalInput | undefined;
3
3
  }
4
- import type { TerminalInput } from '../interfaces/wasi-cli-terminal-input';
4
+ import type { TerminalInput } from '../interfaces/wasi-cli-terminal-input.js';
5
5
  export { TerminalInput };
@@ -1,5 +1,5 @@
1
1
  export namespace WasiCliTerminalStdout {
2
2
  export function getTerminalStdout(): TerminalOutput | undefined;
3
3
  }
4
- import type { TerminalOutput } from '../interfaces/wasi-cli-terminal-output';
4
+ import type { TerminalOutput } from '../interfaces/wasi-cli-terminal-output.js';
5
5
  export { TerminalOutput };
@@ -1,5 +1,5 @@
1
1
  export namespace WasiFilesystemPreopens {
2
2
  export function getDirectories(): [Descriptor, string][];
3
3
  }
4
- import type { Descriptor } from '../interfaces/wasi-filesystem-types';
4
+ import type { Descriptor } from '../interfaces/wasi-filesystem-types.js';
5
5
  export { Descriptor };
@@ -1,17 +1,10 @@
1
1
  export namespace WasiFilesystemTypes {
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 getType(this_: Descriptor): DescriptorType;
6
- export function stat(this_: Descriptor): DescriptorStat;
7
- export function openAt(this_: Descriptor, pathFlags: PathFlags, path: string, openFlags: OpenFlags, flags: DescriptorFlags, modes: Modes): Descriptor;
8
- export function dropDescriptor(this_: Descriptor): void;
9
- export function dropDirectoryEntryStream(this_: DirectoryEntryStream): void;
10
- export function metadataHash(this_: Descriptor): MetadataHashValue;
2
+ export { Descriptor };
3
+ export function filesystemErrorCode(err: Error): ErrorCode | undefined;
4
+ export { DirectoryEntryStream };
11
5
  }
12
- export type Descriptor = number;
13
6
  export type Filesize = bigint;
14
- import type { InputStream } from '../interfaces/wasi-io-streams';
7
+ import type { InputStream } from '../interfaces/wasi-io-streams.js';
15
8
  export { InputStream };
16
9
  /**
17
10
  * # Variants
@@ -91,7 +84,7 @@ export { InputStream };
91
84
  * ## `"cross-device"`
92
85
  */
93
86
  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';
94
- import type { OutputStream } from '../interfaces/wasi-io-streams';
87
+ import type { OutputStream } from '../interfaces/wasi-io-streams.js';
95
88
  export { OutputStream };
96
89
  /**
97
90
  * # Variants
@@ -114,15 +107,15 @@ export { OutputStream };
114
107
  */
115
108
  export type DescriptorType = 'unknown' | 'block-device' | 'character-device' | 'directory' | 'fifo' | 'symbolic-link' | 'regular-file' | 'socket';
116
109
  export type LinkCount = bigint;
117
- import type { Datetime } from '../interfaces/wasi-clocks-wall-clock';
110
+ import type { Datetime } from '../interfaces/wasi-clocks-wall-clock.js';
118
111
  export { Datetime };
119
112
  export interface DescriptorStat {
120
113
  type: DescriptorType,
121
114
  linkCount: LinkCount,
122
115
  size: Filesize,
123
- dataAccessTimestamp: Datetime,
124
- dataModificationTimestamp: Datetime,
125
- statusChangeTimestamp: Datetime,
116
+ dataAccessTimestamp?: Datetime,
117
+ dataModificationTimestamp?: Datetime,
118
+ statusChangeTimestamp?: Datetime,
126
119
  }
127
120
  export interface PathFlags {
128
121
  symlinkFollow?: boolean,
@@ -146,8 +139,22 @@ export interface Modes {
146
139
  writable?: boolean,
147
140
  executable?: boolean,
148
141
  }
149
- export type DirectoryEntryStream = number;
150
142
  export interface MetadataHashValue {
151
143
  lower: bigint,
152
144
  upper: bigint,
153
145
  }
146
+ import type { Error } from '../interfaces/wasi-io-streams.js';
147
+ export { Error };
148
+
149
+ export class Descriptor {
150
+ readViaStream(offset: Filesize): InputStream;
151
+ writeViaStream(offset: Filesize): OutputStream;
152
+ appendViaStream(): OutputStream;
153
+ getType(): DescriptorType;
154
+ stat(): DescriptorStat;
155
+ openAt(pathFlags: PathFlags, path: string, openFlags: OpenFlags, flags: DescriptorFlags, modes: Modes): Descriptor;
156
+ metadataHash(): MetadataHashValue;
157
+ }
158
+
159
+ export class DirectoryEntryStream {
160
+ }
@@ -1,28 +1,28 @@
1
1
  export namespace WasiIoStreams {
2
- export function read(this_: InputStream, len: bigint): [Uint8Array, StreamStatus];
3
- export function blockingRead(this_: InputStream, len: bigint): [Uint8Array, StreamStatus];
4
- export function dropInputStream(this_: InputStream): void;
5
- export function checkWrite(this_: OutputStream): bigint;
6
- export function write(this_: OutputStream, contents: Uint8Array): void;
7
- export function blockingWriteAndFlush(this_: OutputStream, contents: Uint8Array): void;
8
- export function blockingFlush(this_: OutputStream): void;
9
- export function dropOutputStream(this_: OutputStream): void;
2
+ export { InputStream };
3
+ export { OutputStream };
4
+ export { Error };
5
+ }
6
+ export type StreamError = StreamErrorLastOperationFailed | StreamErrorClosed;
7
+ export interface StreamErrorLastOperationFailed {
8
+ tag: 'last-operation-failed',
9
+ val: Error,
10
+ }
11
+ export interface StreamErrorClosed {
12
+ tag: 'closed',
13
+ }
14
+
15
+ export class InputStream {
16
+ read(len: bigint): Uint8Array;
17
+ blockingRead(len: bigint): Uint8Array;
18
+ }
19
+
20
+ export class OutputStream {
21
+ checkWrite(): bigint;
22
+ write(contents: Uint8Array): void;
23
+ blockingWriteAndFlush(contents: Uint8Array): void;
24
+ blockingFlush(): void;
25
+ }
26
+
27
+ export class Error {
10
28
  }
11
- export type InputStream = number;
12
- /**
13
- * # Variants
14
- *
15
- * ## `"open"`
16
- *
17
- * ## `"ended"`
18
- */
19
- export type StreamStatus = 'open' | 'ended';
20
- export type OutputStream = number;
21
- /**
22
- * # Variants
23
- *
24
- * ## `"last-operation-failed"`
25
- *
26
- * ## `"closed"`
27
- */
28
- export type WriteError = 'last-operation-failed' | 'closed';
@@ -1,2 +1,6 @@
1
1
  export namespace WasiSocketsTcp {
2
+ export { TcpSocket };
3
+ }
4
+
5
+ export class TcpSocket {
2
6
  }
@@ -60,6 +60,7 @@ import { WasiFilesystemPreopens } from './interfaces/wasi-filesystem-preopens';
60
60
  import { WasiFilesystemTypes } from './interfaces/wasi-filesystem-types';
61
61
  import { WasiIoStreams } from './interfaces/wasi-io-streams';
62
62
  import { WasiRandomRandom } from './interfaces/wasi-random-random';
63
+ import { WasiSocketsTcp } from './interfaces/wasi-sockets-tcp';
63
64
  export function generate(component: Uint8Array, options: GenerateOptions): Transpiled;
64
65
  export function generateTypes(name: string, options: TypeGenerationOptions): Files;
65
66