@bytecodealliance/jco 0.10.2 → 0.10.3

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.
@@ -0,0 +1,3 @@
1
+ export namespace WasiCliBaseEnvironment {
2
+ export function getEnvironment(): [string, string][];
3
+ }
@@ -0,0 +1,4 @@
1
+ export namespace WasiCliBaseExit {
2
+ export function exit(status: Result<void, void>): void;
3
+ }
4
+ export type Result<T, E> = { tag: 'ok', val: T } | { tag: 'err', val: E };
@@ -0,0 +1,5 @@
1
+ export namespace WasiCliBasePreopens {
2
+ export function getDirectories(): [Descriptor, string][];
3
+ }
4
+ import type { Descriptor } from '../imports/wasi-filesystem-filesystem';
5
+ export { Descriptor };
@@ -0,0 +1,5 @@
1
+ export namespace WasiCliBaseStderr {
2
+ export function getStderr(): OutputStream;
3
+ }
4
+ import type { OutputStream } from '../imports/wasi-io-streams';
5
+ export { OutputStream };
@@ -0,0 +1,5 @@
1
+ export namespace WasiCliBaseStdin {
2
+ export function getStdin(): InputStream;
3
+ }
4
+ import type { InputStream } from '../imports/wasi-io-streams';
5
+ export { InputStream };
@@ -0,0 +1,5 @@
1
+ export namespace WasiCliBaseStdout {
2
+ export function getStdout(): OutputStream;
3
+ }
4
+ import type { OutputStream } from '../imports/wasi-io-streams';
5
+ export { OutputStream };
@@ -0,0 +1,6 @@
1
+ export namespace WasiClocksWallClock {
2
+ }
3
+ export interface Datetime {
4
+ seconds: bigint,
5
+ nanoseconds: number,
6
+ }
@@ -0,0 +1,152 @@
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;
10
+ }
11
+ export type Descriptor = number;
12
+ export type Filesize = bigint;
13
+ import type { InputStream } from '../imports/wasi-io-streams';
14
+ export { InputStream };
15
+ /**
16
+ * # Variants
17
+ *
18
+ * ## `"access"`
19
+ *
20
+ * ## `"would-block"`
21
+ *
22
+ * ## `"already"`
23
+ *
24
+ * ## `"bad-descriptor"`
25
+ *
26
+ * ## `"busy"`
27
+ *
28
+ * ## `"deadlock"`
29
+ *
30
+ * ## `"quota"`
31
+ *
32
+ * ## `"exist"`
33
+ *
34
+ * ## `"file-too-large"`
35
+ *
36
+ * ## `"illegal-byte-sequence"`
37
+ *
38
+ * ## `"in-progress"`
39
+ *
40
+ * ## `"interrupted"`
41
+ *
42
+ * ## `"invalid"`
43
+ *
44
+ * ## `"io"`
45
+ *
46
+ * ## `"is-directory"`
47
+ *
48
+ * ## `"loop"`
49
+ *
50
+ * ## `"too-many-links"`
51
+ *
52
+ * ## `"message-size"`
53
+ *
54
+ * ## `"name-too-long"`
55
+ *
56
+ * ## `"no-device"`
57
+ *
58
+ * ## `"no-entry"`
59
+ *
60
+ * ## `"no-lock"`
61
+ *
62
+ * ## `"insufficient-memory"`
63
+ *
64
+ * ## `"insufficient-space"`
65
+ *
66
+ * ## `"not-directory"`
67
+ *
68
+ * ## `"not-empty"`
69
+ *
70
+ * ## `"not-recoverable"`
71
+ *
72
+ * ## `"unsupported"`
73
+ *
74
+ * ## `"no-tty"`
75
+ *
76
+ * ## `"no-such-device"`
77
+ *
78
+ * ## `"overflow"`
79
+ *
80
+ * ## `"not-permitted"`
81
+ *
82
+ * ## `"pipe"`
83
+ *
84
+ * ## `"read-only"`
85
+ *
86
+ * ## `"invalid-seek"`
87
+ *
88
+ * ## `"text-file-busy"`
89
+ *
90
+ * ## `"cross-device"`
91
+ */
92
+ 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 '../imports/wasi-io-streams';
94
+ export { OutputStream };
95
+ /**
96
+ * # Variants
97
+ *
98
+ * ## `"unknown"`
99
+ *
100
+ * ## `"block-device"`
101
+ *
102
+ * ## `"character-device"`
103
+ *
104
+ * ## `"directory"`
105
+ *
106
+ * ## `"fifo"`
107
+ *
108
+ * ## `"symbolic-link"`
109
+ *
110
+ * ## `"regular-file"`
111
+ *
112
+ * ## `"socket"`
113
+ */
114
+ 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
+ export type LinkCount = bigint;
118
+ import type { Datetime } from '../imports/wasi-clocks-wall-clock';
119
+ export { Datetime };
120
+ export interface DescriptorStat {
121
+ device: Device,
122
+ inode: Inode,
123
+ type: DescriptorType,
124
+ linkCount: LinkCount,
125
+ size: Filesize,
126
+ dataAccessTimestamp: Datetime,
127
+ dataModificationTimestamp: Datetime,
128
+ statusChangeTimestamp: Datetime,
129
+ }
130
+ export interface PathFlags {
131
+ symlinkFollow?: boolean,
132
+ }
133
+ export interface OpenFlags {
134
+ create?: boolean,
135
+ directory?: boolean,
136
+ exclusive?: boolean,
137
+ truncate?: boolean,
138
+ }
139
+ export interface DescriptorFlags {
140
+ read?: boolean,
141
+ write?: boolean,
142
+ fileIntegritySync?: boolean,
143
+ dataIntegritySync?: boolean,
144
+ requestedWriteSync?: boolean,
145
+ mutateDirectory?: boolean,
146
+ }
147
+ export interface Modes {
148
+ readable?: boolean,
149
+ writable?: boolean,
150
+ executable?: boolean,
151
+ }
152
+ export type DirectoryEntryStream = number;
@@ -0,0 +1,21 @@
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;
8
+ }
9
+ export type InputStream = number;
10
+ /**
11
+ * # Variants
12
+ *
13
+ * ## `"open"`
14
+ *
15
+ * ## `"ended"`
16
+ */
17
+ export type StreamStatus = 'open' | 'ended';
18
+ export interface StreamError {
19
+ dummy: number,
20
+ }
21
+ export type OutputStream = number;
@@ -0,0 +1,3 @@
1
+ export namespace WasiRandomRandom {
2
+ export function getRandomBytes(len: bigint): Uint8Array | ArrayBuffer;
3
+ }
@@ -0,0 +1,3 @@
1
+ export namespace WasiCliBaseEnvironment {
2
+ export function getEnvironment(): [string, string][];
3
+ }
@@ -0,0 +1,4 @@
1
+ export namespace WasiCliBaseExit {
2
+ export function exit(status: Result<void, void>): void;
3
+ }
4
+ export type Result<T, E> = { tag: 'ok', val: T } | { tag: 'err', val: E };
@@ -0,0 +1,5 @@
1
+ export namespace WasiCliBasePreopens {
2
+ export function getDirectories(): [Descriptor, string][];
3
+ }
4
+ import type { Descriptor } from '../interfaces/wasi-filesystem-filesystem';
5
+ export { Descriptor };
@@ -0,0 +1,5 @@
1
+ export namespace WasiCliBaseStderr {
2
+ export function getStderr(): OutputStream;
3
+ }
4
+ import type { OutputStream } from '../interfaces/wasi-io-streams';
5
+ export { OutputStream };
@@ -0,0 +1,5 @@
1
+ export namespace WasiCliBaseStdin {
2
+ export function getStdin(): InputStream;
3
+ }
4
+ import type { InputStream } from '../interfaces/wasi-io-streams';
5
+ export { InputStream };
@@ -0,0 +1,5 @@
1
+ export namespace WasiCliBaseStdout {
2
+ export function getStdout(): OutputStream;
3
+ }
4
+ import type { OutputStream } from '../interfaces/wasi-io-streams';
5
+ export { OutputStream };
@@ -0,0 +1,6 @@
1
+ export namespace WasiClocksWallClock {
2
+ }
3
+ export interface Datetime {
4
+ seconds: bigint,
5
+ nanoseconds: number,
6
+ }
@@ -0,0 +1,152 @@
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;
10
+ }
11
+ export type Descriptor = number;
12
+ export type Filesize = bigint;
13
+ import type { InputStream } from '../interfaces/wasi-io-streams';
14
+ export { InputStream };
15
+ /**
16
+ * # Variants
17
+ *
18
+ * ## `"access"`
19
+ *
20
+ * ## `"would-block"`
21
+ *
22
+ * ## `"already"`
23
+ *
24
+ * ## `"bad-descriptor"`
25
+ *
26
+ * ## `"busy"`
27
+ *
28
+ * ## `"deadlock"`
29
+ *
30
+ * ## `"quota"`
31
+ *
32
+ * ## `"exist"`
33
+ *
34
+ * ## `"file-too-large"`
35
+ *
36
+ * ## `"illegal-byte-sequence"`
37
+ *
38
+ * ## `"in-progress"`
39
+ *
40
+ * ## `"interrupted"`
41
+ *
42
+ * ## `"invalid"`
43
+ *
44
+ * ## `"io"`
45
+ *
46
+ * ## `"is-directory"`
47
+ *
48
+ * ## `"loop"`
49
+ *
50
+ * ## `"too-many-links"`
51
+ *
52
+ * ## `"message-size"`
53
+ *
54
+ * ## `"name-too-long"`
55
+ *
56
+ * ## `"no-device"`
57
+ *
58
+ * ## `"no-entry"`
59
+ *
60
+ * ## `"no-lock"`
61
+ *
62
+ * ## `"insufficient-memory"`
63
+ *
64
+ * ## `"insufficient-space"`
65
+ *
66
+ * ## `"not-directory"`
67
+ *
68
+ * ## `"not-empty"`
69
+ *
70
+ * ## `"not-recoverable"`
71
+ *
72
+ * ## `"unsupported"`
73
+ *
74
+ * ## `"no-tty"`
75
+ *
76
+ * ## `"no-such-device"`
77
+ *
78
+ * ## `"overflow"`
79
+ *
80
+ * ## `"not-permitted"`
81
+ *
82
+ * ## `"pipe"`
83
+ *
84
+ * ## `"read-only"`
85
+ *
86
+ * ## `"invalid-seek"`
87
+ *
88
+ * ## `"text-file-busy"`
89
+ *
90
+ * ## `"cross-device"`
91
+ */
92
+ 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
+ export { OutputStream };
95
+ /**
96
+ * # Variants
97
+ *
98
+ * ## `"unknown"`
99
+ *
100
+ * ## `"block-device"`
101
+ *
102
+ * ## `"character-device"`
103
+ *
104
+ * ## `"directory"`
105
+ *
106
+ * ## `"fifo"`
107
+ *
108
+ * ## `"symbolic-link"`
109
+ *
110
+ * ## `"regular-file"`
111
+ *
112
+ * ## `"socket"`
113
+ */
114
+ 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
+ export type LinkCount = bigint;
118
+ import type { Datetime } from '../interfaces/wasi-clocks-wall-clock';
119
+ export { Datetime };
120
+ export interface DescriptorStat {
121
+ device: Device,
122
+ inode: Inode,
123
+ type: DescriptorType,
124
+ linkCount: LinkCount,
125
+ size: Filesize,
126
+ dataAccessTimestamp: Datetime,
127
+ dataModificationTimestamp: Datetime,
128
+ statusChangeTimestamp: Datetime,
129
+ }
130
+ export interface PathFlags {
131
+ symlinkFollow?: boolean,
132
+ }
133
+ export interface OpenFlags {
134
+ create?: boolean,
135
+ directory?: boolean,
136
+ exclusive?: boolean,
137
+ truncate?: boolean,
138
+ }
139
+ export interface DescriptorFlags {
140
+ read?: boolean,
141
+ write?: boolean,
142
+ fileIntegritySync?: boolean,
143
+ dataIntegritySync?: boolean,
144
+ requestedWriteSync?: boolean,
145
+ mutateDirectory?: boolean,
146
+ }
147
+ export interface Modes {
148
+ readable?: boolean,
149
+ writable?: boolean,
150
+ executable?: boolean,
151
+ }
152
+ export type DirectoryEntryStream = number;
@@ -0,0 +1,21 @@
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): [bigint, StreamStatus];
6
+ export function blockingWrite(this: OutputStream, buf: Uint8Array): [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 interface StreamError {
19
+ dummy: number,
20
+ }
21
+ export type OutputStream = number;
@@ -0,0 +1,3 @@
1
+ export namespace WasiRandomRandom {
2
+ export function getRandomBytes(len: bigint): Uint8Array;
3
+ }
@@ -44,16 +44,16 @@ export interface Transpiled {
44
44
  imports: string[],
45
45
  exports: [string, ExportType][],
46
46
  }
47
- import { Environment } from './interfaces/environment';
48
- import { Exit } from './interfaces/exit';
49
- import { Preopens } from './interfaces/preopens';
50
- import { Stderr } from './interfaces/stderr';
51
- import { Stdin } from './interfaces/stdin';
52
- import { Stdout } from './interfaces/stdout';
53
- import { WallClock } from './interfaces/wall-clock';
54
- import { Filesystem } from './interfaces/filesystem';
55
- import { Streams } from './interfaces/streams';
56
- import { Random } from './interfaces/random';
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';
53
+ import { WasiClocksWallClock } from './imports/wasi-clocks-wall-clock';
54
+ import { WasiFilesystemFilesystem } from './imports/wasi-filesystem-filesystem';
55
+ import { WasiIoStreams } from './imports/wasi-io-streams';
56
+ import { WasiRandomRandom } from './imports/wasi-random-random';
57
57
  export function generate(component: Uint8Array | ArrayBuffer, options: GenerateOptions): Transpiled;
58
58
  export function generateTypes(name: string, options: TypeGenerationOptions): Files;
59
59
 
@@ -32,16 +32,16 @@ export interface ModuleMetadata {
32
32
  range: [number, number],
33
33
  producers: ProducersFields,
34
34
  }
35
- import { Environment } from './interfaces/environment';
36
- import { Exit } from './interfaces/exit';
37
- import { Preopens } from './interfaces/preopens';
38
- import { Stderr } from './interfaces/stderr';
39
- import { Stdin } from './interfaces/stdin';
40
- import { Stdout } from './interfaces/stdout';
41
- import { WallClock } from './interfaces/wall-clock';
42
- import { Filesystem } from './interfaces/filesystem';
43
- import { Streams } from './interfaces/streams';
44
- import { Random } from './interfaces/random';
35
+ import { WasiCliBaseEnvironment } from './imports/wasi-cli-base-environment';
36
+ import { WasiCliBaseExit } from './imports/wasi-cli-base-exit';
37
+ import { WasiCliBasePreopens } from './imports/wasi-cli-base-preopens';
38
+ import { WasiCliBaseStderr } from './imports/wasi-cli-base-stderr';
39
+ import { WasiCliBaseStdin } from './imports/wasi-cli-base-stdin';
40
+ import { WasiCliBaseStdout } from './imports/wasi-cli-base-stdout';
41
+ import { WasiClocksWallClock } from './imports/wasi-clocks-wall-clock';
42
+ import { WasiFilesystemFilesystem } from './imports/wasi-filesystem-filesystem';
43
+ import { WasiIoStreams } from './imports/wasi-io-streams';
44
+ import { WasiRandomRandom } from './imports/wasi-random-random';
45
45
  export function parse(wat: string): Uint8Array;
46
46
  export function print(binary: Uint8Array | ArrayBuffer): string;
47
47
  export function componentNew(binary: Uint8Array | ArrayBuffer, adapters: [string, Uint8Array | ArrayBuffer][] | null): Uint8Array;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytecodealliance/jco",
3
- "version": "0.10.2",
3
+ "version": "0.10.3",
4
4
  "description": "JavaScript tooling for working with WebAssembly Components",
5
5
  "author": "Guy Bedford",
6
6
  "bin": {
package/src/jco.js CHANGED
@@ -10,7 +10,7 @@ program
10
10
  .name('jco')
11
11
  .description(c`{bold jco - WebAssembly JS Component Tools}\n JS Component Transpilation Bindgen & Wasm Tools for JS`)
12
12
  .usage('<command> [options]')
13
- .version('0.10.2');
13
+ .version('0.10.3');
14
14
 
15
15
  function myParseInt(value) {
16
16
  return parseInt(value, 10);