@bytecodealliance/jco 0.11.2 → 0.12.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.
Files changed (50) hide show
  1. package/lib/wasi_snapshot_preview1.command.wasm +0 -0
  2. package/lib/wasi_snapshot_preview1.reactor.wasm +0 -0
  3. package/obj/{exports → interfaces}/local-wasm-tools-tools.d.ts +5 -5
  4. package/obj/{imports → interfaces}/wasi-cli-stderr.d.ts +1 -1
  5. package/obj/{exports → interfaces}/wasi-cli-stdin.d.ts +1 -1
  6. package/obj/{exports → interfaces}/wasi-cli-stdout.d.ts +1 -1
  7. package/obj/interfaces/wasi-cli-terminal-stderr.d.ts +5 -0
  8. package/obj/interfaces/wasi-cli-terminal-stdin.d.ts +5 -0
  9. package/obj/interfaces/wasi-cli-terminal-stdout.d.ts +5 -0
  10. package/obj/{exports → interfaces}/wasi-filesystem-preopens.d.ts +1 -1
  11. package/obj/{exports → interfaces}/wasi-filesystem-types.d.ts +3 -3
  12. package/obj/{exports → interfaces}/wasi-io-streams.d.ts +12 -2
  13. package/obj/js-component-bindgen-component.component.wasm +0 -0
  14. package/obj/js-component-bindgen-component.core.wasm +0 -0
  15. package/obj/js-component-bindgen-component.core2.wasm +0 -0
  16. package/obj/js-component-bindgen-component.d.ts +17 -16
  17. package/obj/js-component-bindgen-component.js +263 -162
  18. package/obj/wasm-tools.component.wasm +0 -0
  19. package/obj/wasm-tools.core.wasm +0 -0
  20. package/obj/wasm-tools.core2.wasm +0 -0
  21. package/obj/wasm-tools.d.ts +16 -16
  22. package/obj/wasm-tools.js +208 -115
  23. package/package.json +3 -3
  24. package/src/cmd/transpile.js +3 -1
  25. package/src/cmd/wasm-tools.js +1 -1
  26. package/src/jco.js +2 -1
  27. package/obj/exports/wasi-cli-stderr.d.ts +0 -5
  28. package/obj/exports/wasi-cli-terminal-stderr.d.ts +0 -5
  29. package/obj/exports/wasi-cli-terminal-stdin.d.ts +0 -5
  30. package/obj/exports/wasi-cli-terminal-stdout.d.ts +0 -5
  31. package/obj/imports/wasi-cli-environment.d.ts +0 -3
  32. package/obj/imports/wasi-cli-exit.d.ts +0 -4
  33. package/obj/imports/wasi-cli-stdin.d.ts +0 -5
  34. package/obj/imports/wasi-cli-stdout.d.ts +0 -5
  35. package/obj/imports/wasi-cli-terminal-input.d.ts +0 -4
  36. package/obj/imports/wasi-cli-terminal-output.d.ts +0 -4
  37. package/obj/imports/wasi-cli-terminal-stderr.d.ts +0 -5
  38. package/obj/imports/wasi-cli-terminal-stdin.d.ts +0 -5
  39. package/obj/imports/wasi-cli-terminal-stdout.d.ts +0 -5
  40. package/obj/imports/wasi-clocks-wall-clock.d.ts +0 -6
  41. package/obj/imports/wasi-filesystem-preopens.d.ts +0 -5
  42. package/obj/imports/wasi-filesystem-types.d.ts +0 -153
  43. package/obj/imports/wasi-io-streams.d.ts +0 -18
  44. package/obj/imports/wasi-random-random.d.ts +0 -3
  45. /package/obj/{exports → interfaces}/wasi-cli-environment.d.ts +0 -0
  46. /package/obj/{exports → interfaces}/wasi-cli-exit.d.ts +0 -0
  47. /package/obj/{exports → interfaces}/wasi-cli-terminal-input.d.ts +0 -0
  48. /package/obj/{exports → interfaces}/wasi-cli-terminal-output.d.ts +0 -0
  49. /package/obj/{exports → interfaces}/wasi-clocks-wall-clock.d.ts +0 -0
  50. /package/obj/{exports → interfaces}/wasi-random-random.d.ts +0 -0
@@ -1,11 +1,11 @@
1
1
  export namespace LocalWasmToolsTools {
2
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;
3
+ export function print(binary: Uint8Array): string;
4
+ export function componentNew(binary: Uint8Array, adapters: [string, Uint8Array][] | undefined): Uint8Array;
5
+ export function componentWit(binary: Uint8Array): string;
6
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;
7
+ export function metadataShow(binary: Uint8Array): ModuleMetadata[];
8
+ export function metadataAdd(binary: Uint8Array, metadata: ProducersFields): Uint8Array;
9
9
  }
10
10
  /**
11
11
  * # Variants
@@ -1,5 +1,5 @@
1
1
  export namespace WasiCliStderr {
2
2
  export function getStderr(): OutputStream;
3
3
  }
4
- import type { OutputStream } from '../imports/wasi-io-streams';
4
+ import type { OutputStream } from '../interfaces/wasi-io-streams';
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 '../exports/wasi-io-streams';
4
+ import type { InputStream } from '../interfaces/wasi-io-streams';
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 '../exports/wasi-io-streams';
4
+ import type { OutputStream } from '../interfaces/wasi-io-streams';
5
5
  export { OutputStream };
@@ -0,0 +1,5 @@
1
+ export namespace WasiCliTerminalStderr {
2
+ export function getTerminalStderr(): TerminalOutput | undefined;
3
+ }
4
+ import type { TerminalOutput } from '../interfaces/wasi-cli-terminal-output';
5
+ export { TerminalOutput };
@@ -0,0 +1,5 @@
1
+ export namespace WasiCliTerminalStdin {
2
+ export function getTerminalStdin(): TerminalInput | undefined;
3
+ }
4
+ import type { TerminalInput } from '../interfaces/wasi-cli-terminal-input';
5
+ export { TerminalInput };
@@ -0,0 +1,5 @@
1
+ export namespace WasiCliTerminalStdout {
2
+ export function getTerminalStdout(): TerminalOutput | undefined;
3
+ }
4
+ import type { TerminalOutput } from '../interfaces/wasi-cli-terminal-output';
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 '../exports/wasi-filesystem-types';
4
+ import type { Descriptor } from '../interfaces/wasi-filesystem-types';
5
5
  export { Descriptor };
@@ -11,7 +11,7 @@ export namespace WasiFilesystemTypes {
11
11
  }
12
12
  export type Descriptor = number;
13
13
  export type Filesize = bigint;
14
- import type { InputStream } from '../exports/wasi-io-streams';
14
+ import type { InputStream } from '../interfaces/wasi-io-streams';
15
15
  export { InputStream };
16
16
  /**
17
17
  * # Variants
@@ -91,7 +91,7 @@ export { InputStream };
91
91
  * ## `"cross-device"`
92
92
  */
93
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';
94
- import type { OutputStream } from '../exports/wasi-io-streams';
94
+ import type { OutputStream } from '../interfaces/wasi-io-streams';
95
95
  export { OutputStream };
96
96
  /**
97
97
  * # Variants
@@ -114,7 +114,7 @@ export { OutputStream };
114
114
  */
115
115
  export type DescriptorType = 'unknown' | 'block-device' | 'character-device' | 'directory' | 'fifo' | 'symbolic-link' | 'regular-file' | 'socket';
116
116
  export type LinkCount = bigint;
117
- import type { Datetime } from '../exports/wasi-clocks-wall-clock';
117
+ import type { Datetime } from '../interfaces/wasi-clocks-wall-clock';
118
118
  export { Datetime };
119
119
  export interface DescriptorStat {
120
120
  type: DescriptorType,
@@ -2,8 +2,10 @@ export namespace WasiIoStreams {
2
2
  export function read(this_: InputStream, len: bigint): [Uint8Array, StreamStatus];
3
3
  export function blockingRead(this_: InputStream, len: bigint): [Uint8Array, StreamStatus];
4
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];
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;
7
9
  export function dropOutputStream(this_: OutputStream): void;
8
10
  }
9
11
  export type InputStream = number;
@@ -16,3 +18,11 @@ export type InputStream = number;
16
18
  */
17
19
  export type StreamStatus = 'open' | 'ended';
18
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';
@@ -10,6 +10,7 @@ export interface GenerateOptions {
10
10
  base64Cutoff?: number,
11
11
  tlaCompat?: boolean,
12
12
  validLiftingOptimization?: boolean,
13
+ tracing?: boolean,
13
14
  }
14
15
  export type Wit = WitSource | WitBinary | WitPath;
15
16
  export interface WitSource {
@@ -44,22 +45,22 @@ export interface Transpiled {
44
45
  imports: string[],
45
46
  exports: [string, ExportType][],
46
47
  }
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';
57
- import { WasiClocksWallClock } from './imports/wasi-clocks-wall-clock';
58
- import { WasiFilesystemPreopens } from './imports/wasi-filesystem-preopens';
59
- import { WasiFilesystemTypes } from './imports/wasi-filesystem-types';
60
- import { WasiIoStreams } from './imports/wasi-io-streams';
61
- import { WasiRandomRandom } from './imports/wasi-random-random';
62
- export function generate(component: Uint8Array | ArrayBuffer, options: GenerateOptions): Transpiled;
48
+ import { WasiCliEnvironment } from './interfaces/wasi-cli-environment';
49
+ import { WasiCliExit } from './interfaces/wasi-cli-exit';
50
+ import { WasiCliStderr } from './interfaces/wasi-cli-stderr';
51
+ import { WasiCliStdin } from './interfaces/wasi-cli-stdin';
52
+ import { WasiCliStdout } from './interfaces/wasi-cli-stdout';
53
+ import { WasiCliTerminalInput } from './interfaces/wasi-cli-terminal-input';
54
+ import { WasiCliTerminalOutput } from './interfaces/wasi-cli-terminal-output';
55
+ import { WasiCliTerminalStderr } from './interfaces/wasi-cli-terminal-stderr';
56
+ import { WasiCliTerminalStdin } from './interfaces/wasi-cli-terminal-stdin';
57
+ import { WasiCliTerminalStdout } from './interfaces/wasi-cli-terminal-stdout';
58
+ import { WasiClocksWallClock } from './interfaces/wasi-clocks-wall-clock';
59
+ import { WasiFilesystemPreopens } from './interfaces/wasi-filesystem-preopens';
60
+ import { WasiFilesystemTypes } from './interfaces/wasi-filesystem-types';
61
+ import { WasiIoStreams } from './interfaces/wasi-io-streams';
62
+ import { WasiRandomRandom } from './interfaces/wasi-random-random';
63
+ export function generate(component: Uint8Array, options: GenerateOptions): Transpiled;
63
64
  export function generateTypes(name: string, options: TypeGenerationOptions): Files;
64
65
 
65
66
  export const $init: Promise<void>;