@bytecodealliance/jco 0.7.0 → 0.9.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.
- package/LICENSE +220 -0
- package/README.md +38 -14
- package/lib/console.js +7 -0
- package/lib/wasi_snapshot_preview1.command.wasm +0 -0
- package/lib/wasi_snapshot_preview1.reactor.wasm +0 -0
- package/obj/imports/cli-base-environment.d.ts +3 -0
- package/obj/imports/cli-base-exit.d.ts +4 -0
- package/obj/imports/cli-base-preopens.d.ts +5 -0
- package/obj/imports/cli-base-stderr.d.ts +5 -0
- package/obj/imports/cli-base-stdin.d.ts +5 -0
- package/obj/imports/cli-base-stdout.d.ts +5 -0
- package/obj/imports/clocks-wall-clock.d.ts +6 -0
- package/obj/imports/environment.d.ts +3 -0
- package/obj/imports/exit.d.ts +4 -0
- package/obj/imports/filesystem-filesystem.d.ts +152 -0
- package/obj/imports/filesystem.d.ts +152 -0
- package/obj/imports/io-streams.d.ts +12 -0
- package/obj/imports/preopens.d.ts +5 -0
- package/obj/imports/random-random.d.ts +3 -0
- package/obj/imports/random.d.ts +3 -0
- package/obj/imports/stderr.d.ts +5 -0
- package/obj/imports/stdin.d.ts +5 -0
- package/obj/imports/stdout.d.ts +5 -0
- package/obj/imports/streams.d.ts +12 -0
- package/obj/imports/wall-clock.d.ts +6 -0
- package/obj/imports/wasi:cli-base/environment.d.ts +3 -0
- package/obj/imports/wasi:cli-base/exit.d.ts +4 -0
- package/obj/imports/wasi:cli-base/preopens.d.ts +5 -0
- package/obj/imports/wasi:cli-base/stderr.d.ts +5 -0
- package/obj/imports/wasi:cli-base/stdin.d.ts +5 -0
- package/obj/imports/wasi:cli-base/stdout.d.ts +5 -0
- package/obj/imports/wasi:clocks/wall-clock.d.ts +6 -0
- package/obj/imports/wasi:filesystem/filesystem.d.ts +152 -0
- package/obj/imports/wasi:io/streams.d.ts +12 -0
- package/obj/imports/wasi:random/random.d.ts +3 -0
- package/obj/js-component-bindgen-component.core.wasm +0 -0
- package/obj/js-component-bindgen-component.core2.wasm +0 -0
- package/obj/js-component-bindgen-component.d.ts +14 -0
- package/obj/js-component-bindgen-component.js +2036 -0
- package/obj/wasm-tools.core.wasm +0 -0
- package/obj/wasm-tools.core2.wasm +0 -0
- package/obj/wasm-tools.d.ts +19 -0
- package/obj/wasm-tools.js +2236 -0
- package/package.json +36 -6
- package/src/api.js +45 -0
- package/src/cmd/componentize.js +21 -0
- package/src/cmd/opt.js +151 -0
- package/src/cmd/transpile.js +366 -0
- package/src/cmd/wasm-tools.js +114 -0
- package/src/common.js +104 -0
- package/src/jco.js +129 -0
- package/api.d.ts +0 -109
- package/api.mjs +0 -44011
- package/cli.mjs +0 -47685
- package/js-component-bindgen-component.core.wasm +0 -0
- package/js-component-bindgen-component.core2.wasm +0 -0
- package/wasi_preview1_component_adapter.command.wasm +0 -0
- package/wasi_preview1_component_adapter.reactor.wasm +0 -0
- package/wasm-opt +0 -2
- package/wasm-tools.core.wasm +0 -0
- package/wasm-tools.core2.wasm +0 -0
- package/wasm2js +0 -2
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export namespace Streams {
|
|
2
|
+
export function read(this: InputStream, len: bigint): [Uint8Array | ArrayBuffer, boolean];
|
|
3
|
+
export function blockingRead(this: InputStream, len: bigint): [Uint8Array | ArrayBuffer, boolean];
|
|
4
|
+
export function dropInputStream(this: InputStream): void;
|
|
5
|
+
export function write(this: OutputStream, buf: Uint8Array): bigint;
|
|
6
|
+
export function blockingWrite(this: OutputStream, buf: Uint8Array): bigint;
|
|
7
|
+
export function dropOutputStream(this: OutputStream): void;
|
|
8
|
+
}
|
|
9
|
+
export type InputStream = number;
|
|
10
|
+
export interface StreamError {
|
|
11
|
+
}
|
|
12
|
+
export type OutputStream = number;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
export namespace Wasi:filesystemFilesystem {
|
|
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/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/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/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,12 @@
|
|
|
1
|
+
export namespace Wasi:ioStreams {
|
|
2
|
+
export function read(this: InputStream, len: bigint): [Uint8Array | ArrayBuffer, boolean];
|
|
3
|
+
export function blockingRead(this: InputStream, len: bigint): [Uint8Array | ArrayBuffer, boolean];
|
|
4
|
+
export function dropInputStream(this: InputStream): void;
|
|
5
|
+
export function write(this: OutputStream, buf: Uint8Array): bigint;
|
|
6
|
+
export function blockingWrite(this: OutputStream, buf: Uint8Array): bigint;
|
|
7
|
+
export function dropOutputStream(this: OutputStream): void;
|
|
8
|
+
}
|
|
9
|
+
export type InputStream = number;
|
|
10
|
+
export interface StreamError {
|
|
11
|
+
}
|
|
12
|
+
export type OutputStream = number;
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Environment as EnvironmentImports } from './imports/environment';
|
|
2
|
+
import { Exit as ExitImports } from './imports/exit';
|
|
3
|
+
import { Preopens as PreopensImports } from './imports/preopens';
|
|
4
|
+
import { Stderr as StderrImports } from './imports/stderr';
|
|
5
|
+
import { Stdin as StdinImports } from './imports/stdin';
|
|
6
|
+
import { Stdout as StdoutImports } from './imports/stdout';
|
|
7
|
+
import { WallClock as WallClockImports } from './imports/wall-clock';
|
|
8
|
+
import { Filesystem as FilesystemImports } from './imports/filesystem';
|
|
9
|
+
import { Streams as StreamsImports } from './imports/streams';
|
|
10
|
+
import { Random as RandomImports } from './imports/random';
|
|
11
|
+
export function generate(component: Uint8Array | ArrayBuffer, options: GenerateOptions): Transpiled;
|
|
12
|
+
export function generateTypes(name: string, options: TypeGenerationOptions): Files;
|
|
13
|
+
|
|
14
|
+
export const $init: Promise<void>;
|