@bytecodealliance/jco 0.10.3 → 0.11.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.
Files changed (66) hide show
  1. package/README.md +15 -2
  2. package/lib/wasi_snapshot_preview1.command.wasm +0 -0
  3. package/lib/wasi_snapshot_preview1.reactor.wasm +0 -0
  4. package/obj/exports/local-wasm-tools-tools.d.ts +43 -0
  5. package/obj/{interfaces/environment.d.ts → exports/wasi-cli-environment.d.ts} +1 -1
  6. package/obj/{interfaces/exit.d.ts → exports/wasi-cli-exit.d.ts} +1 -1
  7. package/obj/exports/wasi-cli-stderr.d.ts +5 -0
  8. package/obj/exports/wasi-cli-stdin.d.ts +5 -0
  9. package/obj/exports/wasi-cli-stdout.d.ts +5 -0
  10. package/obj/exports/wasi-cli-terminal-input.d.ts +4 -0
  11. package/obj/exports/wasi-cli-terminal-output.d.ts +4 -0
  12. package/obj/exports/wasi-cli-terminal-stderr.d.ts +5 -0
  13. package/obj/exports/wasi-cli-terminal-stdin.d.ts +5 -0
  14. package/obj/exports/wasi-cli-terminal-stdout.d.ts +5 -0
  15. package/obj/exports/wasi-filesystem-preopens.d.ts +5 -0
  16. package/obj/{interfaces/filesystem.d.ts → exports/wasi-filesystem-types.d.ts} +17 -16
  17. package/obj/exports/wasi-io-streams.d.ts +18 -0
  18. package/obj/imports/{wasi-cli-base-environment.d.ts → wasi-cli-environment.d.ts} +1 -1
  19. package/obj/{interfaces/wasi-cli-base-exit.d.ts → imports/wasi-cli-exit.d.ts} +1 -1
  20. package/obj/imports/{wasi-cli-base-stderr.d.ts → wasi-cli-stderr.d.ts} +1 -1
  21. package/obj/imports/{wasi-cli-base-stdin.d.ts → wasi-cli-stdin.d.ts} +1 -1
  22. package/obj/imports/{wasi-cli-base-stdout.d.ts → wasi-cli-stdout.d.ts} +1 -1
  23. package/obj/imports/wasi-cli-terminal-input.d.ts +4 -0
  24. package/obj/imports/wasi-cli-terminal-output.d.ts +4 -0
  25. package/obj/imports/wasi-cli-terminal-stderr.d.ts +5 -0
  26. package/obj/imports/wasi-cli-terminal-stdin.d.ts +5 -0
  27. package/obj/imports/wasi-cli-terminal-stdout.d.ts +5 -0
  28. package/obj/imports/wasi-filesystem-preopens.d.ts +5 -0
  29. package/obj/imports/{wasi-filesystem-filesystem.d.ts → wasi-filesystem-types.d.ts} +14 -13
  30. package/obj/imports/wasi-io-streams.d.ts +6 -9
  31. package/obj/js-component-bindgen-component.component.wasm +0 -0
  32. package/obj/js-component-bindgen-component.core.wasm +0 -0
  33. package/obj/js-component-bindgen-component.core2.wasm +0 -0
  34. package/obj/js-component-bindgen-component.d.ts +12 -7
  35. package/obj/js-component-bindgen-component.js +365 -117
  36. package/obj/wasm-tools.component.wasm +0 -0
  37. package/obj/wasm-tools.core.wasm +0 -0
  38. package/obj/wasm-tools.core2.wasm +0 -0
  39. package/obj/wasm-tools.d.ts +14 -48
  40. package/obj/wasm-tools.js +386 -127
  41. package/package.json +7 -4
  42. package/src/api.js +2 -1
  43. package/src/browser.js +3 -0
  44. package/src/cmd/opt.js +2 -1
  45. package/src/cmd/run.js +103 -0
  46. package/src/cmd/transpile.js +4 -3
  47. package/src/cmd/wasm-tools.js +10 -3
  48. package/src/jco.js +11 -1
  49. package/obj/imports/wasi-cli-base-exit.d.ts +0 -4
  50. package/obj/imports/wasi-cli-base-preopens.d.ts +0 -5
  51. package/obj/interfaces/preopens.d.ts +0 -5
  52. package/obj/interfaces/random.d.ts +0 -3
  53. package/obj/interfaces/stderr.d.ts +0 -5
  54. package/obj/interfaces/stdin.d.ts +0 -5
  55. package/obj/interfaces/stdout.d.ts +0 -5
  56. package/obj/interfaces/streams.d.ts +0 -21
  57. package/obj/interfaces/wall-clock.d.ts +0 -6
  58. package/obj/interfaces/wasi-cli-base-environment.d.ts +0 -3
  59. package/obj/interfaces/wasi-cli-base-preopens.d.ts +0 -5
  60. package/obj/interfaces/wasi-cli-base-stderr.d.ts +0 -5
  61. package/obj/interfaces/wasi-cli-base-stdin.d.ts +0 -5
  62. package/obj/interfaces/wasi-cli-base-stdout.d.ts +0 -5
  63. package/obj/interfaces/wasi-filesystem-filesystem.d.ts +0 -152
  64. package/obj/interfaces/wasi-io-streams.d.ts +0 -21
  65. /package/obj/{interfaces → exports}/wasi-clocks-wall-clock.d.ts +0 -0
  66. /package/obj/{interfaces → exports}/wasi-random-random.d.ts +0 -0
package/README.md CHANGED
@@ -54,6 +54,7 @@ Options:
54
54
  Commands:
55
55
  componentize [options] <js-source> Create a component from a JavaScript module
56
56
  transpile [options] <component-path> Transpile a WebAssembly Component to JS + core Wasm for JavaScript execution
57
+ run <command> [args...] Run a WebAssembly Command component
57
58
  opt [options] <component-file> optimizes a Wasm component, including running wasm-opt Binaryen optimizations
58
59
  wit [options] <component-path> extract the WIT from a WebAssembly Component [wasm-tools component wit]
59
60
  print [options] <input> print the WebAssembly WAT text for a binary file [wasm-tools print]
@@ -98,7 +99,7 @@ Options include:
98
99
  * `--js`: Converts core Wasm files to JavaScript for environments that don't even support core Wasm.
99
100
  * `--base64-cutoff=<number>`: Sets the maximum number of bytes for inlining Wasm files into the JS using base64 encoding. Set to zero to disable base64 inlining entirely.
100
101
  * `--no-wasi-shim`: Disable the WASI shim mapping to `@bytecodealliance/preview2-shim`.
101
- * `--map`: Provide custom mappings for world imports. Supports both wildcard mappings (`*` similarly as in the package.json "exports" field) as well as `#` mappings for targetting exported interfaces. For example, the WASI mappings are internally defined with mappings like `--map wasi:filesystem/*=@bytecodealliance/preview2-shim/filesystem#*` to map `import as * filesystem from 'wasi:filesystem/filesystem'` to `import { filesystem } from '@bytecodealliance/preview2-shim/filesystem`.
102
+ * `--map`: Provide custom mappings for world imports. Supports both wildcard mappings (`*` similarly as in the package.json "exports" field) as well as `#` mappings for targetting exported interfaces. For example, the WASI mappings are internally defined with mappings like `--map wasi:filesystem/*=@bytecodealliance/preview2-shim/filesystem#*` to map `import as * filesystem from 'wasi:filesystem/types'` to `import { types } from '@bytecodealliance/preview2-shim/filesystem`.
102
103
  * `--no-nodejs-compat`: Disables Node.js compat in the output to load core Wasm with FS methods.
103
104
  * `--instantiation`: Instead of a direct ES module, export an `instantiate` function which can take the imports as an argument instead of implicit imports.
104
105
  * `--valid-lifting-optimization`: Internal validations are removed assuming that core Wasm binaries are valid components, providing a minor output size saving.
@@ -123,6 +124,18 @@ See [ComponentizeJS](https://github.com/bytecodealliance/componentize-js) for mo
123
124
 
124
125
  > Additional engines may be supported in future via an `--engine` field or otherwise.
125
126
 
127
+ ### Run
128
+
129
+ For Wasm components that implement the WASI Command world, a `jco run` utility is provided to run these applications in Node.js:
130
+
131
+ ```
132
+ jco run cowasy.component.wasm hello
133
+ ```
134
+
135
+ Using the preview2-shim WASI implementation, full access to the underlying system primitives is provided, including filesystem and environment variable permissions.
136
+
137
+ > Since [preview2-shim](packages/preview2-shim) is an experimental work-in-progress implementation, there will likely be bugs.
138
+
126
139
  ## API
127
140
 
128
141
  #### `transpile(component: Uint8Array, opts?): Promise<{ files: Record<string, Uint8Array> }>`
@@ -178,4 +191,4 @@ See [LICENSE](LICENSE) for more details.
178
191
 
179
192
  Unless you explicitly state otherwise, any contribution intentionally submitted
180
193
  for inclusion in this project by you, as defined in the Apache-2.0 license,
181
- shall be licensed as above, without any additional terms or conditions.
194
+ shall be licensed as above, without any additional terms or conditions.
@@ -0,0 +1,43 @@
1
+ export namespace LocalWasmToolsTools {
2
+ export function parse(wat: string): Uint8Array;
3
+ export function print(binary: Uint8Array | ArrayBuffer): string;
4
+ export function componentNew(binary: Uint8Array | ArrayBuffer, adapters: [string, Uint8Array | ArrayBuffer][] | null): Uint8Array;
5
+ export function componentWit(binary: Uint8Array | ArrayBuffer): string;
6
+ export function componentEmbed(embedOpts: EmbedOpts): Uint8Array;
7
+ export function metadataShow(binary: Uint8Array | ArrayBuffer): ModuleMetadata[];
8
+ export function metadataAdd(binary: Uint8Array | ArrayBuffer, metadata: ProducersFields): Uint8Array;
9
+ }
10
+ /**
11
+ * # Variants
12
+ *
13
+ * ## `"utf8"`
14
+ *
15
+ * ## `"utf16"`
16
+ *
17
+ * ## `"compact-utf16"`
18
+ */
19
+ export type StringEncoding = 'utf8' | 'utf16' | 'compact-utf16';
20
+ export type ProducersFields = [string, [string, string][]][];
21
+ export interface EmbedOpts {
22
+ binary?: Uint8Array,
23
+ witSource?: string,
24
+ witPath?: string,
25
+ stringEncoding?: StringEncoding,
26
+ dummy?: boolean,
27
+ world?: string,
28
+ metadata?: ProducersFields,
29
+ }
30
+ export type ModuleMetaType = ModuleMetaTypeModule | ModuleMetaTypeComponent;
31
+ export interface ModuleMetaTypeModule {
32
+ tag: 'module',
33
+ }
34
+ export interface ModuleMetaTypeComponent {
35
+ tag: 'component',
36
+ val: number,
37
+ }
38
+ export interface ModuleMetadata {
39
+ name?: string,
40
+ metaType: ModuleMetaType,
41
+ range: [number, number],
42
+ producers: ProducersFields,
43
+ }
@@ -1,3 +1,3 @@
1
- export namespace Environment {
1
+ export namespace WasiCliEnvironment {
2
2
  export function getEnvironment(): [string, string][];
3
3
  }
@@ -1,4 +1,4 @@
1
- export namespace Exit {
1
+ export namespace WasiCliExit {
2
2
  export function exit(status: Result<void, void>): void;
3
3
  }
4
4
  export type Result<T, E> = { tag: 'ok', val: T } | { tag: 'err', val: E };
@@ -0,0 +1,5 @@
1
+ export namespace WasiCliStderr {
2
+ export function getStderr(): OutputStream;
3
+ }
4
+ import type { OutputStream } from '../exports/wasi-io-streams';
5
+ export { OutputStream };
@@ -0,0 +1,5 @@
1
+ export namespace WasiCliStdin {
2
+ export function getStdin(): InputStream;
3
+ }
4
+ import type { InputStream } from '../exports/wasi-io-streams';
5
+ export { InputStream };
@@ -0,0 +1,5 @@
1
+ export namespace WasiCliStdout {
2
+ export function getStdout(): OutputStream;
3
+ }
4
+ import type { OutputStream } from '../exports/wasi-io-streams';
5
+ export { OutputStream };
@@ -0,0 +1,4 @@
1
+ export namespace WasiCliTerminalInput {
2
+ export function dropTerminalInput(this_: TerminalInput): void;
3
+ }
4
+ export type TerminalInput = number;
@@ -0,0 +1,4 @@
1
+ export namespace WasiCliTerminalOutput {
2
+ export function dropTerminalOutput(this_: TerminalOutput): void;
3
+ }
4
+ export type TerminalOutput = number;
@@ -0,0 +1,5 @@
1
+ export namespace WasiCliTerminalStderr {
2
+ export function getTerminalStderr(): TerminalOutput | null;
3
+ }
4
+ import type { TerminalOutput } from '../exports/wasi-cli-terminal-output';
5
+ export { TerminalOutput };
@@ -0,0 +1,5 @@
1
+ export namespace WasiCliTerminalStdin {
2
+ export function getTerminalStdin(): TerminalInput | null;
3
+ }
4
+ import type { TerminalInput } from '../exports/wasi-cli-terminal-input';
5
+ export { TerminalInput };
@@ -0,0 +1,5 @@
1
+ export namespace WasiCliTerminalStdout {
2
+ export function getTerminalStdout(): TerminalOutput | null;
3
+ }
4
+ import type { TerminalOutput } from '../exports/wasi-cli-terminal-output';
5
+ export { TerminalOutput };
@@ -0,0 +1,5 @@
1
+ export namespace WasiFilesystemPreopens {
2
+ export function getDirectories(): [Descriptor, string][];
3
+ }
4
+ import type { Descriptor } from '../exports/wasi-filesystem-types';
5
+ export { Descriptor };
@@ -1,16 +1,17 @@
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 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;
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;
10
11
  }
11
12
  export type Descriptor = number;
12
13
  export type Filesize = bigint;
13
- import type { InputStream } from '../interfaces/wasi-io-streams';
14
+ import type { InputStream } from '../exports/wasi-io-streams';
14
15
  export { InputStream };
15
16
  /**
16
17
  * # Variants
@@ -90,7 +91,7 @@ export { InputStream };
90
91
  * ## `"cross-device"`
91
92
  */
92
93
  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';
93
- import type { OutputStream } from '../interfaces/wasi-io-streams';
94
+ import type { OutputStream } from '../exports/wasi-io-streams';
94
95
  export { OutputStream };
95
96
  /**
96
97
  * # Variants
@@ -112,14 +113,10 @@ export { OutputStream };
112
113
  * ## `"socket"`
113
114
  */
114
115
  export type DescriptorType = 'unknown' | 'block-device' | 'character-device' | 'directory' | 'fifo' | 'symbolic-link' | 'regular-file' | 'socket';
115
- export type Device = bigint;
116
- export type Inode = bigint;
117
116
  export type LinkCount = bigint;
118
- import type { Datetime } from '../interfaces/wasi-clocks-wall-clock';
117
+ import type { Datetime } from '../exports/wasi-clocks-wall-clock';
119
118
  export { Datetime };
120
119
  export interface DescriptorStat {
121
- device: Device,
122
- inode: Inode,
123
120
  type: DescriptorType,
124
121
  linkCount: LinkCount,
125
122
  size: Filesize,
@@ -150,3 +147,7 @@ export interface Modes {
150
147
  executable?: boolean,
151
148
  }
152
149
  export type DirectoryEntryStream = number;
150
+ export interface MetadataHashValue {
151
+ lower: bigint,
152
+ upper: bigint,
153
+ }
@@ -0,0 +1,18 @@
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 write(this_: OutputStream, buf: Uint8Array | ArrayBuffer): [bigint, StreamStatus];
6
+ export function blockingWrite(this_: OutputStream, buf: Uint8Array | ArrayBuffer): [bigint, StreamStatus];
7
+ export function dropOutputStream(this_: OutputStream): void;
8
+ }
9
+ export type InputStream = number;
10
+ /**
11
+ * # Variants
12
+ *
13
+ * ## `"open"`
14
+ *
15
+ * ## `"ended"`
16
+ */
17
+ export type StreamStatus = 'open' | 'ended';
18
+ export type OutputStream = number;
@@ -1,3 +1,3 @@
1
- export namespace WasiCliBaseEnvironment {
1
+ export namespace WasiCliEnvironment {
2
2
  export function getEnvironment(): [string, string][];
3
3
  }
@@ -1,4 +1,4 @@
1
- export namespace WasiCliBaseExit {
1
+ export namespace WasiCliExit {
2
2
  export function exit(status: Result<void, void>): void;
3
3
  }
4
4
  export type Result<T, E> = { tag: 'ok', val: T } | { tag: 'err', val: E };
@@ -1,4 +1,4 @@
1
- export namespace WasiCliBaseStderr {
1
+ export namespace WasiCliStderr {
2
2
  export function getStderr(): OutputStream;
3
3
  }
4
4
  import type { OutputStream } from '../imports/wasi-io-streams';
@@ -1,4 +1,4 @@
1
- export namespace WasiCliBaseStdin {
1
+ export namespace WasiCliStdin {
2
2
  export function getStdin(): InputStream;
3
3
  }
4
4
  import type { InputStream } from '../imports/wasi-io-streams';
@@ -1,4 +1,4 @@
1
- export namespace WasiCliBaseStdout {
1
+ export namespace WasiCliStdout {
2
2
  export function getStdout(): OutputStream;
3
3
  }
4
4
  import type { OutputStream } from '../imports/wasi-io-streams';
@@ -0,0 +1,4 @@
1
+ export namespace WasiCliTerminalInput {
2
+ export function dropTerminalInput(this_: TerminalInput): void;
3
+ }
4
+ export type TerminalInput = number;
@@ -0,0 +1,4 @@
1
+ export namespace WasiCliTerminalOutput {
2
+ export function dropTerminalOutput(this_: TerminalOutput): void;
3
+ }
4
+ export type TerminalOutput = number;
@@ -0,0 +1,5 @@
1
+ export namespace WasiCliTerminalStderr {
2
+ export function getTerminalStderr(): TerminalOutput | null;
3
+ }
4
+ import type { TerminalOutput } from '../imports/wasi-cli-terminal-output';
5
+ export { TerminalOutput };
@@ -0,0 +1,5 @@
1
+ export namespace WasiCliTerminalStdin {
2
+ export function getTerminalStdin(): TerminalInput | null;
3
+ }
4
+ import type { TerminalInput } from '../imports/wasi-cli-terminal-input';
5
+ export { TerminalInput };
@@ -0,0 +1,5 @@
1
+ export namespace WasiCliTerminalStdout {
2
+ export function getTerminalStdout(): TerminalOutput | null;
3
+ }
4
+ import type { TerminalOutput } from '../imports/wasi-cli-terminal-output';
5
+ export { TerminalOutput };
@@ -0,0 +1,5 @@
1
+ export namespace WasiFilesystemPreopens {
2
+ export function getDirectories(): [Descriptor, string][];
3
+ }
4
+ import type { Descriptor } from '../imports/wasi-filesystem-types';
5
+ export { Descriptor };
@@ -1,12 +1,13 @@
1
- export namespace WasiFilesystemFilesystem {
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;
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;
10
11
  }
11
12
  export type Descriptor = number;
12
13
  export type Filesize = bigint;
@@ -112,14 +113,10 @@ export { OutputStream };
112
113
  * ## `"socket"`
113
114
  */
114
115
  export type DescriptorType = 'unknown' | 'block-device' | 'character-device' | 'directory' | 'fifo' | 'symbolic-link' | 'regular-file' | 'socket';
115
- export type Device = bigint;
116
- export type Inode = bigint;
117
116
  export type LinkCount = bigint;
118
117
  import type { Datetime } from '../imports/wasi-clocks-wall-clock';
119
118
  export { Datetime };
120
119
  export interface DescriptorStat {
121
- device: Device,
122
- inode: Inode,
123
120
  type: DescriptorType,
124
121
  linkCount: LinkCount,
125
122
  size: Filesize,
@@ -150,3 +147,7 @@ export interface Modes {
150
147
  executable?: boolean,
151
148
  }
152
149
  export type DirectoryEntryStream = number;
150
+ export interface MetadataHashValue {
151
+ lower: bigint,
152
+ upper: bigint,
153
+ }
@@ -1,10 +1,10 @@
1
1
  export namespace WasiIoStreams {
2
- export function read(this: InputStream, len: bigint): [Uint8Array | ArrayBuffer, StreamStatus];
3
- export function blockingRead(this: InputStream, len: bigint): [Uint8Array | ArrayBuffer, StreamStatus];
4
- export function dropInputStream(this: InputStream): void;
5
- export function write(this: OutputStream, buf: Uint8Array): [bigint, StreamStatus];
6
- export function blockingWrite(this: OutputStream, buf: Uint8Array): [bigint, StreamStatus];
7
- export function dropOutputStream(this: OutputStream): void;
2
+ export function read(this_: InputStream, len: bigint): [Uint8Array | ArrayBuffer, StreamStatus];
3
+ export function blockingRead(this_: InputStream, len: bigint): [Uint8Array | ArrayBuffer, StreamStatus];
4
+ export function dropInputStream(this_: InputStream): void;
5
+ export function write(this_: OutputStream, buf: Uint8Array): [bigint, StreamStatus];
6
+ export function blockingWrite(this_: OutputStream, buf: Uint8Array): [bigint, StreamStatus];
7
+ export function dropOutputStream(this_: OutputStream): void;
8
8
  }
9
9
  export type InputStream = number;
10
10
  /**
@@ -15,7 +15,4 @@ export type InputStream = number;
15
15
  * ## `"ended"`
16
16
  */
17
17
  export type StreamStatus = 'open' | 'ended';
18
- export interface StreamError {
19
- dummy: number,
20
- }
21
18
  export type OutputStream = number;
@@ -44,14 +44,19 @@ export interface Transpiled {
44
44
  imports: string[],
45
45
  exports: [string, ExportType][],
46
46
  }
47
- import { WasiCliBaseEnvironment } from './imports/wasi-cli-base-environment';
48
- import { WasiCliBaseExit } from './imports/wasi-cli-base-exit';
49
- import { WasiCliBasePreopens } from './imports/wasi-cli-base-preopens';
50
- import { WasiCliBaseStderr } from './imports/wasi-cli-base-stderr';
51
- import { WasiCliBaseStdin } from './imports/wasi-cli-base-stdin';
52
- import { WasiCliBaseStdout } from './imports/wasi-cli-base-stdout';
47
+ import { WasiCliEnvironment } from './imports/wasi-cli-environment';
48
+ import { WasiCliExit } from './imports/wasi-cli-exit';
49
+ import { WasiCliStderr } from './imports/wasi-cli-stderr';
50
+ import { WasiCliStdin } from './imports/wasi-cli-stdin';
51
+ import { WasiCliStdout } from './imports/wasi-cli-stdout';
52
+ import { WasiCliTerminalInput } from './imports/wasi-cli-terminal-input';
53
+ import { WasiCliTerminalOutput } from './imports/wasi-cli-terminal-output';
54
+ import { WasiCliTerminalStderr } from './imports/wasi-cli-terminal-stderr';
55
+ import { WasiCliTerminalStdin } from './imports/wasi-cli-terminal-stdin';
56
+ import { WasiCliTerminalStdout } from './imports/wasi-cli-terminal-stdout';
53
57
  import { WasiClocksWallClock } from './imports/wasi-clocks-wall-clock';
54
- import { WasiFilesystemFilesystem } from './imports/wasi-filesystem-filesystem';
58
+ import { WasiFilesystemPreopens } from './imports/wasi-filesystem-preopens';
59
+ import { WasiFilesystemTypes } from './imports/wasi-filesystem-types';
55
60
  import { WasiIoStreams } from './imports/wasi-io-streams';
56
61
  import { WasiRandomRandom } from './imports/wasi-random-random';
57
62
  export function generate(component: Uint8Array | ArrayBuffer, options: GenerateOptions): Transpiled;