@bytecodealliance/jco 1.9.1 → 1.10.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 (37) 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/interfaces/local-wasm-tools-tools.d.ts +9 -9
  4. package/obj/interfaces/wasi-cli-environment.d.ts +2 -3
  5. package/obj/interfaces/wasi-cli-exit.d.ts +2 -3
  6. package/obj/interfaces/wasi-cli-stderr.d.ts +3 -5
  7. package/obj/interfaces/wasi-cli-stdin.d.ts +3 -5
  8. package/obj/interfaces/wasi-cli-stdout.d.ts +3 -5
  9. package/obj/interfaces/wasi-cli-terminal-input.d.ts +5 -3
  10. package/obj/interfaces/wasi-cli-terminal-output.d.ts +5 -3
  11. package/obj/interfaces/wasi-cli-terminal-stderr.d.ts +3 -5
  12. package/obj/interfaces/wasi-cli-terminal-stdin.d.ts +3 -5
  13. package/obj/interfaces/wasi-cli-terminal-stdout.d.ts +3 -5
  14. package/obj/interfaces/wasi-clocks-wall-clock.d.ts +1 -2
  15. package/obj/interfaces/wasi-filesystem-preopens.d.ts +3 -5
  16. package/obj/interfaces/wasi-filesystem-types.d.ts +14 -13
  17. package/obj/interfaces/wasi-io-error.d.ts +5 -3
  18. package/obj/interfaces/wasi-io-streams.d.ts +10 -6
  19. package/obj/interfaces/wasi-random-random.d.ts +2 -3
  20. package/obj/js-component-bindgen-component.core.wasm +0 -0
  21. package/obj/js-component-bindgen-component.core2.wasm +0 -0
  22. package/obj/js-component-bindgen-component.d.ts +31 -16
  23. package/obj/js-component-bindgen-component.js +628 -502
  24. package/obj/wasm-tools.core.wasm +0 -0
  25. package/obj/wasm-tools.core2.wasm +0 -0
  26. package/obj/wasm-tools.d.ts +18 -18
  27. package/obj/wasm-tools.js +546 -489
  28. package/package.json +6 -6
  29. package/src/cmd/componentize.d.ts.map +1 -1
  30. package/src/cmd/opt.d.ts +7 -2
  31. package/src/cmd/opt.d.ts.map +1 -1
  32. package/src/cmd/opt.js +196 -82
  33. package/src/cmd/run.js +3 -3
  34. package/src/cmd/transpile.d.ts +15 -0
  35. package/src/cmd/transpile.d.ts.map +1 -1
  36. package/src/cmd/transpile.js +56 -0
  37. package/src/jco.js +12 -1
@@ -1,12 +1,11 @@
1
- export namespace LocalWasmToolsTools {
2
- export function parse(wat: string): Uint8Array;
3
- export function print(binary: Uint8Array): string;
4
- export function componentNew(binary: Uint8Array, adapters: Array<[string, Uint8Array]> | undefined): Uint8Array;
5
- export function componentWit(binary: Uint8Array): string;
6
- export function componentEmbed(embedOpts: EmbedOpts): Uint8Array;
7
- export function metadataShow(binary: Uint8Array): Array<ModuleMetadata>;
8
- export function metadataAdd(binary: Uint8Array, metadata: ProducersFields): Uint8Array;
9
- }
1
+ /** @module Interface local:wasm-tools/tools **/
2
+ export function parse(wat: string): Uint8Array;
3
+ export function print(binary: Uint8Array): string;
4
+ export function componentNew(binary: Uint8Array, adapters: Array<[string, Uint8Array]> | undefined): Uint8Array;
5
+ export function componentWit(binary: Uint8Array): string;
6
+ export function componentEmbed(embedOpts: EmbedOpts): Uint8Array;
7
+ export function metadataShow(binary: Uint8Array): Array<ModuleMetadata>;
8
+ export function metadataAdd(binary: Uint8Array, metadata: ProducersFields): Uint8Array;
10
9
  /**
11
10
  * # Variants
12
11
  *
@@ -45,6 +44,7 @@ export interface ModuleMetaTypeComponent {
45
44
  val: number,
46
45
  }
47
46
  export interface ModuleMetadata {
47
+ parentIndex?: number,
48
48
  name?: string,
49
49
  metaType: ModuleMetaType,
50
50
  range: [number, number],
@@ -1,3 +1,2 @@
1
- export namespace WasiCliEnvironment {
2
- export function getEnvironment(): Array<[string, string]>;
3
- }
1
+ /** @module Interface wasi:cli/environment@0.2.3 **/
2
+ export function getEnvironment(): Array<[string, string]>;
@@ -1,4 +1,3 @@
1
- export namespace WasiCliExit {
2
- export function exit(status: Result<void, void>): void;
3
- }
1
+ /** @module Interface wasi:cli/exit@0.2.3 **/
2
+ export function exit(status: Result<void, void>): void;
4
3
  export type Result<T, E> = { tag: 'ok', val: T } | { tag: 'err', val: E };
@@ -1,5 +1,3 @@
1
- export namespace WasiCliStderr {
2
- export function getStderr(): OutputStream;
3
- }
4
- import type { OutputStream } from './wasi-io-streams.js';
5
- export { OutputStream };
1
+ /** @module Interface wasi:cli/stderr@0.2.3 **/
2
+ export function getStderr(): OutputStream;
3
+ export type OutputStream = import('./wasi-io-streams.js').OutputStream;
@@ -1,5 +1,3 @@
1
- export namespace WasiCliStdin {
2
- export function getStdin(): InputStream;
3
- }
4
- import type { InputStream } from './wasi-io-streams.js';
5
- export { InputStream };
1
+ /** @module Interface wasi:cli/stdin@0.2.3 **/
2
+ export function getStdin(): InputStream;
3
+ export type InputStream = import('./wasi-io-streams.js').InputStream;
@@ -1,5 +1,3 @@
1
- export namespace WasiCliStdout {
2
- export function getStdout(): OutputStream;
3
- }
4
- import type { OutputStream } from './wasi-io-streams.js';
5
- export { OutputStream };
1
+ /** @module Interface wasi:cli/stdout@0.2.3 **/
2
+ export function getStdout(): OutputStream;
3
+ export type OutputStream = import('./wasi-io-streams.js').OutputStream;
@@ -1,6 +1,8 @@
1
- export namespace WasiCliTerminalInput {
2
- export { TerminalInput };
3
- }
1
+ /** @module Interface wasi:cli/terminal-input@0.2.3 **/
4
2
 
5
3
  export class TerminalInput {
4
+ /**
5
+ * This type does not have a public constructor.
6
+ */
7
+ private constructor();
6
8
  }
@@ -1,6 +1,8 @@
1
- export namespace WasiCliTerminalOutput {
2
- export { TerminalOutput };
3
- }
1
+ /** @module Interface wasi:cli/terminal-output@0.2.3 **/
4
2
 
5
3
  export class TerminalOutput {
4
+ /**
5
+ * This type does not have a public constructor.
6
+ */
7
+ private constructor();
6
8
  }
@@ -1,5 +1,3 @@
1
- export namespace WasiCliTerminalStderr {
2
- export function getTerminalStderr(): TerminalOutput | undefined;
3
- }
4
- import type { TerminalOutput } from './wasi-cli-terminal-output.js';
5
- export { TerminalOutput };
1
+ /** @module Interface wasi:cli/terminal-stderr@0.2.3 **/
2
+ export function getTerminalStderr(): TerminalOutput | undefined;
3
+ export type TerminalOutput = import('./wasi-cli-terminal-output.js').TerminalOutput;
@@ -1,5 +1,3 @@
1
- export namespace WasiCliTerminalStdin {
2
- export function getTerminalStdin(): TerminalInput | undefined;
3
- }
4
- import type { TerminalInput } from './wasi-cli-terminal-input.js';
5
- export { TerminalInput };
1
+ /** @module Interface wasi:cli/terminal-stdin@0.2.3 **/
2
+ export function getTerminalStdin(): TerminalInput | undefined;
3
+ export type TerminalInput = import('./wasi-cli-terminal-input.js').TerminalInput;
@@ -1,5 +1,3 @@
1
- export namespace WasiCliTerminalStdout {
2
- export function getTerminalStdout(): TerminalOutput | undefined;
3
- }
4
- import type { TerminalOutput } from './wasi-cli-terminal-output.js';
5
- export { TerminalOutput };
1
+ /** @module Interface wasi:cli/terminal-stdout@0.2.3 **/
2
+ export function getTerminalStdout(): TerminalOutput | undefined;
3
+ export type TerminalOutput = import('./wasi-cli-terminal-output.js').TerminalOutput;
@@ -1,5 +1,4 @@
1
- export namespace WasiClocksWallClock {
2
- }
1
+ /** @module Interface wasi:clocks/wall-clock@0.2.3 **/
3
2
  export interface Datetime {
4
3
  seconds: bigint,
5
4
  nanoseconds: number,
@@ -1,5 +1,3 @@
1
- export namespace WasiFilesystemPreopens {
2
- export function getDirectories(): Array<[Descriptor, string]>;
3
- }
4
- import type { Descriptor } from './wasi-filesystem-types.js';
5
- export { Descriptor };
1
+ /** @module Interface wasi:filesystem/preopens@0.2.3 **/
2
+ export function getDirectories(): Array<[Descriptor, string]>;
3
+ export type Descriptor = import('./wasi-filesystem-types.js').Descriptor;
@@ -1,11 +1,7 @@
1
- export namespace WasiFilesystemTypes {
2
- export { Descriptor };
3
- export { DirectoryEntryStream };
4
- export function filesystemErrorCode(err: Error): ErrorCode | undefined;
5
- }
1
+ /** @module Interface wasi:filesystem/types@0.2.3 **/
2
+ export function filesystemErrorCode(err: Error): ErrorCode | undefined;
6
3
  export type Filesize = bigint;
7
- import type { InputStream } from './wasi-io-streams.js';
8
- export { InputStream };
4
+ export type InputStream = import('./wasi-io-streams.js').InputStream;
9
5
  /**
10
6
  * # Variants
11
7
  *
@@ -84,8 +80,7 @@ export { InputStream };
84
80
  * ## `"cross-device"`
85
81
  */
86
82
  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';
87
- import type { OutputStream } from './wasi-io-streams.js';
88
- export { OutputStream };
83
+ export type OutputStream = import('./wasi-io-streams.js').OutputStream;
89
84
  /**
90
85
  * # Variants
91
86
  *
@@ -107,8 +102,7 @@ export { OutputStream };
107
102
  */
108
103
  export type DescriptorType = 'unknown' | 'block-device' | 'character-device' | 'directory' | 'fifo' | 'symbolic-link' | 'regular-file' | 'socket';
109
104
  export type LinkCount = bigint;
110
- import type { Datetime } from './wasi-clocks-wall-clock.js';
111
- export { Datetime };
105
+ export type Datetime = import('./wasi-clocks-wall-clock.js').Datetime;
112
106
  export interface DescriptorStat {
113
107
  type: DescriptorType,
114
108
  linkCount: LinkCount,
@@ -142,10 +136,13 @@ export interface DirectoryEntry {
142
136
  type: DescriptorType,
143
137
  name: string,
144
138
  }
145
- import type { Error } from './wasi-io-streams.js';
146
- export { Error };
139
+ export type Error = import('./wasi-io-streams.js').Error;
147
140
 
148
141
  export class Descriptor {
142
+ /**
143
+ * This type does not have a public constructor.
144
+ */
145
+ private constructor();
149
146
  readViaStream(offset: Filesize): InputStream;
150
147
  writeViaStream(offset: Filesize): OutputStream;
151
148
  appendViaStream(): OutputStream;
@@ -159,5 +156,9 @@ export class Descriptor {
159
156
  }
160
157
 
161
158
  export class DirectoryEntryStream {
159
+ /**
160
+ * This type does not have a public constructor.
161
+ */
162
+ private constructor();
162
163
  readDirectoryEntry(): DirectoryEntry | undefined;
163
164
  }
@@ -1,6 +1,8 @@
1
- export namespace WasiIoError {
2
- export { Error };
3
- }
1
+ /** @module Interface wasi:io/error@0.2.3 **/
4
2
 
5
3
  export class Error {
4
+ /**
5
+ * This type does not have a public constructor.
6
+ */
7
+ private constructor();
6
8
  }
@@ -1,9 +1,5 @@
1
- export namespace WasiIoStreams {
2
- export { InputStream };
3
- export { OutputStream };
4
- }
5
- import type { Error } from './wasi-io-error.js';
6
- export { Error };
1
+ /** @module Interface wasi:io/streams@0.2.3 **/
2
+ export type Error = import('./wasi-io-error.js').Error;
7
3
  export type StreamError = StreamErrorLastOperationFailed | StreamErrorClosed;
8
4
  export interface StreamErrorLastOperationFailed {
9
5
  tag: 'last-operation-failed',
@@ -14,11 +10,19 @@ export interface StreamErrorClosed {
14
10
  }
15
11
 
16
12
  export class InputStream {
13
+ /**
14
+ * This type does not have a public constructor.
15
+ */
16
+ private constructor();
17
17
  read(len: bigint): Uint8Array;
18
18
  blockingRead(len: bigint): Uint8Array;
19
19
  }
20
20
 
21
21
  export class OutputStream {
22
+ /**
23
+ * This type does not have a public constructor.
24
+ */
25
+ private constructor();
22
26
  checkWrite(): bigint;
23
27
  write(contents: Uint8Array): void;
24
28
  blockingWriteAndFlush(contents: Uint8Array): void;
@@ -1,3 +1,2 @@
1
- export namespace WasiRandomRandom {
2
- export function getRandomBytes(len: bigint): Uint8Array;
3
- }
1
+ /** @module Interface wasi:random/random@0.2.3 **/
2
+ export function getRandomBytes(len: bigint): Uint8Array;
@@ -1,3 +1,4 @@
1
+ // world root:component/root
1
2
  export type Files = Array<[string, Uint8Array]>;
2
3
  export type Maps = Array<[string, string]>;
3
4
  export type InstantiationMode = InstantiationModeAsync | InstantiationModeSync;
@@ -20,6 +21,18 @@ export interface BindingsModeOptimized {
20
21
  export interface BindingsModeDirectOptimized {
21
22
  tag: 'direct-optimized',
22
23
  }
24
+ export interface AsyncImportsExports {
25
+ imports: Array<string>,
26
+ exports: Array<string>,
27
+ }
28
+ export type AsyncMode = AsyncModeSync | AsyncModeJspi;
29
+ export interface AsyncModeSync {
30
+ tag: 'sync',
31
+ }
32
+ export interface AsyncModeJspi {
33
+ tag: 'jspi',
34
+ val: AsyncImportsExports,
35
+ }
23
36
  export interface GenerateOptions {
24
37
  name: string,
25
38
  noTypescript?: boolean,
@@ -35,6 +48,7 @@ export interface GenerateOptions {
35
48
  noNamespacedExports?: boolean,
36
49
  guest?: boolean,
37
50
  multiMemory?: boolean,
51
+ asyncMode?: AsyncMode,
38
52
  }
39
53
  export type Wit = WitSource | WitBinary | WitPath;
40
54
  export interface WitSource {
@@ -65,6 +79,7 @@ export interface TypeGenerationOptions {
65
79
  map?: Maps,
66
80
  features?: EnabledFeatureSet,
67
81
  guest?: boolean,
82
+ asyncMode?: AsyncMode,
68
83
  }
69
84
  /**
70
85
  * # Variants
@@ -79,22 +94,22 @@ export interface Transpiled {
79
94
  imports: Array<string>,
80
95
  exports: Array<[string, ExportType]>,
81
96
  }
82
- import { WasiCliEnvironment } from './interfaces/wasi-cli-environment.js';
83
- import { WasiCliExit } from './interfaces/wasi-cli-exit.js';
84
- import { WasiCliStderr } from './interfaces/wasi-cli-stderr.js';
85
- import { WasiCliStdin } from './interfaces/wasi-cli-stdin.js';
86
- import { WasiCliStdout } from './interfaces/wasi-cli-stdout.js';
87
- import { WasiCliTerminalInput } from './interfaces/wasi-cli-terminal-input.js';
88
- import { WasiCliTerminalOutput } from './interfaces/wasi-cli-terminal-output.js';
89
- import { WasiCliTerminalStderr } from './interfaces/wasi-cli-terminal-stderr.js';
90
- import { WasiCliTerminalStdin } from './interfaces/wasi-cli-terminal-stdin.js';
91
- import { WasiCliTerminalStdout } from './interfaces/wasi-cli-terminal-stdout.js';
92
- declare const WasiClocksWallClock: {};
93
- import { WasiFilesystemPreopens } from './interfaces/wasi-filesystem-preopens.js';
94
- import { WasiFilesystemTypes } from './interfaces/wasi-filesystem-types.js';
95
- import { WasiIoError } from './interfaces/wasi-io-error.js';
96
- import { WasiIoStreams } from './interfaces/wasi-io-streams.js';
97
- import { WasiRandomRandom } from './interfaces/wasi-random-random.js';
97
+ export type * as WasiCliEnvironment023 from './interfaces/wasi-cli-environment.js'; // import wasi:cli/environment@0.2.3
98
+ export type * as WasiCliExit023 from './interfaces/wasi-cli-exit.js'; // import wasi:cli/exit@0.2.3
99
+ export type * as WasiCliStderr023 from './interfaces/wasi-cli-stderr.js'; // import wasi:cli/stderr@0.2.3
100
+ export type * as WasiCliStdin023 from './interfaces/wasi-cli-stdin.js'; // import wasi:cli/stdin@0.2.3
101
+ export type * as WasiCliStdout023 from './interfaces/wasi-cli-stdout.js'; // import wasi:cli/stdout@0.2.3
102
+ export type * as WasiCliTerminalInput023 from './interfaces/wasi-cli-terminal-input.js'; // import wasi:cli/terminal-input@0.2.3
103
+ export type * as WasiCliTerminalOutput023 from './interfaces/wasi-cli-terminal-output.js'; // import wasi:cli/terminal-output@0.2.3
104
+ export type * as WasiCliTerminalStderr023 from './interfaces/wasi-cli-terminal-stderr.js'; // import wasi:cli/terminal-stderr@0.2.3
105
+ export type * as WasiCliTerminalStdin023 from './interfaces/wasi-cli-terminal-stdin.js'; // import wasi:cli/terminal-stdin@0.2.3
106
+ export type * as WasiCliTerminalStdout023 from './interfaces/wasi-cli-terminal-stdout.js'; // import wasi:cli/terminal-stdout@0.2.3
107
+ export type * as WasiClocksWallClock023 from './interfaces/wasi-clocks-wall-clock.js'; // import wasi:clocks/wall-clock@0.2.3
108
+ export type * as WasiFilesystemPreopens023 from './interfaces/wasi-filesystem-preopens.js'; // import wasi:filesystem/preopens@0.2.3
109
+ export type * as WasiFilesystemTypes023 from './interfaces/wasi-filesystem-types.js'; // import wasi:filesystem/types@0.2.3
110
+ export type * as WasiIoError023 from './interfaces/wasi-io-error.js'; // import wasi:io/error@0.2.3
111
+ export type * as WasiIoStreams023 from './interfaces/wasi-io-streams.js'; // import wasi:io/streams@0.2.3
112
+ export type * as WasiRandomRandom023 from './interfaces/wasi-random-random.js'; // import wasi:random/random@0.2.3
98
113
  export function generate(component: Uint8Array, options: GenerateOptions): Transpiled;
99
114
  export function generateTypes(name: string, options: TypeGenerationOptions): Files;
100
115