@ruby/head-wasm-wasi 2.5.1 → 2.5.2
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/dist/browser.script.iife.js +183 -68
- package/dist/browser.script.umd.js +181 -66
- package/dist/browser.umd.js +181 -66
- package/dist/component/interfaces/ruby-js-js-runtime.d.ts +45 -0
- package/dist/component/interfaces/ruby-js-ruby-runtime.d.ts +31 -0
- package/dist/component/interfaces/wasi-cli-environment.d.ts +3 -0
- package/dist/component/interfaces/wasi-cli-exit.d.ts +4 -0
- package/dist/component/interfaces/wasi-cli-stderr.d.ts +5 -0
- package/dist/component/interfaces/wasi-cli-stdin.d.ts +5 -0
- package/dist/component/interfaces/wasi-cli-stdout.d.ts +5 -0
- package/dist/component/interfaces/wasi-cli-terminal-input.d.ts +6 -0
- package/dist/component/interfaces/wasi-cli-terminal-output.d.ts +6 -0
- package/dist/component/interfaces/wasi-cli-terminal-stderr.d.ts +5 -0
- package/dist/component/interfaces/wasi-cli-terminal-stdin.d.ts +5 -0
- package/dist/component/interfaces/wasi-cli-terminal-stdout.d.ts +5 -0
- package/dist/component/interfaces/wasi-clocks-monotonic-clock.d.ts +10 -0
- package/dist/component/interfaces/wasi-clocks-wall-clock.d.ts +8 -0
- package/dist/component/interfaces/wasi-filesystem-preopens.d.ts +5 -0
- package/dist/component/interfaces/wasi-filesystem-types.d.ts +205 -0
- package/dist/component/interfaces/wasi-io-error.d.ts +6 -0
- package/dist/component/interfaces/wasi-io-poll.d.ts +7 -0
- package/dist/component/interfaces/wasi-io-streams.d.ts +30 -0
- package/dist/component/interfaces/wasi-random-random.d.ts +3 -0
- package/dist/component/package.json +1 -0
- package/dist/component/ruby.component.core.wasm +0 -0
- package/dist/component/ruby.component.core2.wasm +0 -0
- package/dist/component/ruby.component.core3.wasm +0 -0
- package/dist/component/ruby.component.core4.wasm +0 -0
- package/dist/component/ruby.component.d.ts +71 -0
- package/dist/component/ruby.component.js +7523 -0
- package/dist/index.umd.js +169 -63
- package/dist/ruby+stdlib.wasm +0 -0
- package/dist/ruby.debug+stdlib.wasm +0 -0
- package/dist/ruby.wasm +0 -0
- package/package.json +2 -2
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export namespace WasiClocksMonotonicClock {
|
|
2
|
+
export function now(): Instant;
|
|
3
|
+
export function resolution(): Duration;
|
|
4
|
+
export function subscribeInstant(when: Instant): Pollable;
|
|
5
|
+
export function subscribeDuration(when: Duration): Pollable;
|
|
6
|
+
}
|
|
7
|
+
export type Instant = bigint;
|
|
8
|
+
export type Duration = bigint;
|
|
9
|
+
import type { Pollable } from './wasi-io-poll.js';
|
|
10
|
+
export { Pollable };
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
export namespace WasiFilesystemTypes {
|
|
2
|
+
export { Descriptor };
|
|
3
|
+
export { DirectoryEntryStream };
|
|
4
|
+
export function filesystemErrorCode(err: Error): ErrorCode | undefined;
|
|
5
|
+
}
|
|
6
|
+
export type Filesize = bigint;
|
|
7
|
+
import type { InputStream } from './wasi-io-streams.js';
|
|
8
|
+
export { InputStream };
|
|
9
|
+
/**
|
|
10
|
+
* # Variants
|
|
11
|
+
*
|
|
12
|
+
* ## `"access"`
|
|
13
|
+
*
|
|
14
|
+
* ## `"would-block"`
|
|
15
|
+
*
|
|
16
|
+
* ## `"already"`
|
|
17
|
+
*
|
|
18
|
+
* ## `"bad-descriptor"`
|
|
19
|
+
*
|
|
20
|
+
* ## `"busy"`
|
|
21
|
+
*
|
|
22
|
+
* ## `"deadlock"`
|
|
23
|
+
*
|
|
24
|
+
* ## `"quota"`
|
|
25
|
+
*
|
|
26
|
+
* ## `"exist"`
|
|
27
|
+
*
|
|
28
|
+
* ## `"file-too-large"`
|
|
29
|
+
*
|
|
30
|
+
* ## `"illegal-byte-sequence"`
|
|
31
|
+
*
|
|
32
|
+
* ## `"in-progress"`
|
|
33
|
+
*
|
|
34
|
+
* ## `"interrupted"`
|
|
35
|
+
*
|
|
36
|
+
* ## `"invalid"`
|
|
37
|
+
*
|
|
38
|
+
* ## `"io"`
|
|
39
|
+
*
|
|
40
|
+
* ## `"is-directory"`
|
|
41
|
+
*
|
|
42
|
+
* ## `"loop"`
|
|
43
|
+
*
|
|
44
|
+
* ## `"too-many-links"`
|
|
45
|
+
*
|
|
46
|
+
* ## `"message-size"`
|
|
47
|
+
*
|
|
48
|
+
* ## `"name-too-long"`
|
|
49
|
+
*
|
|
50
|
+
* ## `"no-device"`
|
|
51
|
+
*
|
|
52
|
+
* ## `"no-entry"`
|
|
53
|
+
*
|
|
54
|
+
* ## `"no-lock"`
|
|
55
|
+
*
|
|
56
|
+
* ## `"insufficient-memory"`
|
|
57
|
+
*
|
|
58
|
+
* ## `"insufficient-space"`
|
|
59
|
+
*
|
|
60
|
+
* ## `"not-directory"`
|
|
61
|
+
*
|
|
62
|
+
* ## `"not-empty"`
|
|
63
|
+
*
|
|
64
|
+
* ## `"not-recoverable"`
|
|
65
|
+
*
|
|
66
|
+
* ## `"unsupported"`
|
|
67
|
+
*
|
|
68
|
+
* ## `"no-tty"`
|
|
69
|
+
*
|
|
70
|
+
* ## `"no-such-device"`
|
|
71
|
+
*
|
|
72
|
+
* ## `"overflow"`
|
|
73
|
+
*
|
|
74
|
+
* ## `"not-permitted"`
|
|
75
|
+
*
|
|
76
|
+
* ## `"pipe"`
|
|
77
|
+
*
|
|
78
|
+
* ## `"read-only"`
|
|
79
|
+
*
|
|
80
|
+
* ## `"invalid-seek"`
|
|
81
|
+
*
|
|
82
|
+
* ## `"text-file-busy"`
|
|
83
|
+
*
|
|
84
|
+
* ## `"cross-device"`
|
|
85
|
+
*/
|
|
86
|
+
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 };
|
|
89
|
+
/**
|
|
90
|
+
* # Variants
|
|
91
|
+
*
|
|
92
|
+
* ## `"normal"`
|
|
93
|
+
*
|
|
94
|
+
* ## `"sequential"`
|
|
95
|
+
*
|
|
96
|
+
* ## `"random"`
|
|
97
|
+
*
|
|
98
|
+
* ## `"will-need"`
|
|
99
|
+
*
|
|
100
|
+
* ## `"dont-need"`
|
|
101
|
+
*
|
|
102
|
+
* ## `"no-reuse"`
|
|
103
|
+
*/
|
|
104
|
+
export type Advice = 'normal' | 'sequential' | 'random' | 'will-need' | 'dont-need' | 'no-reuse';
|
|
105
|
+
export interface DescriptorFlags {
|
|
106
|
+
read?: boolean,
|
|
107
|
+
write?: boolean,
|
|
108
|
+
fileIntegritySync?: boolean,
|
|
109
|
+
dataIntegritySync?: boolean,
|
|
110
|
+
requestedWriteSync?: boolean,
|
|
111
|
+
mutateDirectory?: boolean,
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* # Variants
|
|
115
|
+
*
|
|
116
|
+
* ## `"unknown"`
|
|
117
|
+
*
|
|
118
|
+
* ## `"block-device"`
|
|
119
|
+
*
|
|
120
|
+
* ## `"character-device"`
|
|
121
|
+
*
|
|
122
|
+
* ## `"directory"`
|
|
123
|
+
*
|
|
124
|
+
* ## `"fifo"`
|
|
125
|
+
*
|
|
126
|
+
* ## `"symbolic-link"`
|
|
127
|
+
*
|
|
128
|
+
* ## `"regular-file"`
|
|
129
|
+
*
|
|
130
|
+
* ## `"socket"`
|
|
131
|
+
*/
|
|
132
|
+
export type DescriptorType = 'unknown' | 'block-device' | 'character-device' | 'directory' | 'fifo' | 'symbolic-link' | 'regular-file' | 'socket';
|
|
133
|
+
export type LinkCount = bigint;
|
|
134
|
+
import type { Datetime } from './wasi-clocks-wall-clock.js';
|
|
135
|
+
export { Datetime };
|
|
136
|
+
export interface DescriptorStat {
|
|
137
|
+
type: DescriptorType,
|
|
138
|
+
linkCount: LinkCount,
|
|
139
|
+
size: Filesize,
|
|
140
|
+
dataAccessTimestamp?: Datetime,
|
|
141
|
+
dataModificationTimestamp?: Datetime,
|
|
142
|
+
statusChangeTimestamp?: Datetime,
|
|
143
|
+
}
|
|
144
|
+
export interface PathFlags {
|
|
145
|
+
symlinkFollow?: boolean,
|
|
146
|
+
}
|
|
147
|
+
export type NewTimestamp = NewTimestampNoChange | NewTimestampNow | NewTimestampTimestamp;
|
|
148
|
+
export interface NewTimestampNoChange {
|
|
149
|
+
tag: 'no-change',
|
|
150
|
+
}
|
|
151
|
+
export interface NewTimestampNow {
|
|
152
|
+
tag: 'now',
|
|
153
|
+
}
|
|
154
|
+
export interface NewTimestampTimestamp {
|
|
155
|
+
tag: 'timestamp',
|
|
156
|
+
val: Datetime,
|
|
157
|
+
}
|
|
158
|
+
export interface OpenFlags {
|
|
159
|
+
create?: boolean,
|
|
160
|
+
directory?: boolean,
|
|
161
|
+
exclusive?: boolean,
|
|
162
|
+
truncate?: boolean,
|
|
163
|
+
}
|
|
164
|
+
export interface MetadataHashValue {
|
|
165
|
+
lower: bigint,
|
|
166
|
+
upper: bigint,
|
|
167
|
+
}
|
|
168
|
+
export interface DirectoryEntry {
|
|
169
|
+
type: DescriptorType,
|
|
170
|
+
name: string,
|
|
171
|
+
}
|
|
172
|
+
import type { Error } from './wasi-io-streams.js';
|
|
173
|
+
export { Error };
|
|
174
|
+
|
|
175
|
+
export class Descriptor {
|
|
176
|
+
readViaStream(offset: Filesize): InputStream;
|
|
177
|
+
writeViaStream(offset: Filesize): OutputStream;
|
|
178
|
+
appendViaStream(): OutputStream;
|
|
179
|
+
advise(offset: Filesize, length: Filesize, advice: Advice): void;
|
|
180
|
+
syncData(): void;
|
|
181
|
+
getFlags(): DescriptorFlags;
|
|
182
|
+
getType(): DescriptorType;
|
|
183
|
+
setSize(size: Filesize): void;
|
|
184
|
+
read(length: Filesize, offset: Filesize): [Uint8Array, boolean];
|
|
185
|
+
write(buffer: Uint8Array, offset: Filesize): Filesize;
|
|
186
|
+
readDirectory(): DirectoryEntryStream;
|
|
187
|
+
sync(): void;
|
|
188
|
+
createDirectoryAt(path: string): void;
|
|
189
|
+
stat(): DescriptorStat;
|
|
190
|
+
statAt(pathFlags: PathFlags, path: string): DescriptorStat;
|
|
191
|
+
setTimesAt(pathFlags: PathFlags, path: string, dataAccessTimestamp: NewTimestamp, dataModificationTimestamp: NewTimestamp): void;
|
|
192
|
+
linkAt(oldPathFlags: PathFlags, oldPath: string, newDescriptor: Descriptor, newPath: string): void;
|
|
193
|
+
openAt(pathFlags: PathFlags, path: string, openFlags: OpenFlags, flags: DescriptorFlags): Descriptor;
|
|
194
|
+
readlinkAt(path: string): string;
|
|
195
|
+
removeDirectoryAt(path: string): void;
|
|
196
|
+
renameAt(oldPath: string, newDescriptor: Descriptor, newPath: string): void;
|
|
197
|
+
symlinkAt(oldPath: string, newPath: string): void;
|
|
198
|
+
unlinkFileAt(path: string): void;
|
|
199
|
+
metadataHash(): MetadataHashValue;
|
|
200
|
+
metadataHashAt(pathFlags: PathFlags, path: string): MetadataHashValue;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export class DirectoryEntryStream {
|
|
204
|
+
readDirectoryEntry(): DirectoryEntry | undefined;
|
|
205
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export namespace WasiIoStreams {
|
|
2
|
+
export { InputStream };
|
|
3
|
+
export { OutputStream };
|
|
4
|
+
}
|
|
5
|
+
import type { Error } from './wasi-io-error.js';
|
|
6
|
+
export { Error };
|
|
7
|
+
export type StreamError = StreamErrorLastOperationFailed | StreamErrorClosed;
|
|
8
|
+
export interface StreamErrorLastOperationFailed {
|
|
9
|
+
tag: 'last-operation-failed',
|
|
10
|
+
val: Error,
|
|
11
|
+
}
|
|
12
|
+
export interface StreamErrorClosed {
|
|
13
|
+
tag: 'closed',
|
|
14
|
+
}
|
|
15
|
+
import type { Pollable } from './wasi-io-poll.js';
|
|
16
|
+
export { Pollable };
|
|
17
|
+
|
|
18
|
+
export class InputStream {
|
|
19
|
+
read(len: bigint): Uint8Array;
|
|
20
|
+
blockingRead(len: bigint): Uint8Array;
|
|
21
|
+
subscribe(): Pollable;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export class OutputStream {
|
|
25
|
+
checkWrite(): bigint;
|
|
26
|
+
write(contents: Uint8Array): void;
|
|
27
|
+
blockingWriteAndFlush(contents: Uint8Array): void;
|
|
28
|
+
blockingFlush(): void;
|
|
29
|
+
subscribe(): Pollable;
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "type": "module" }
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { RubyJsJsRuntime } from './interfaces/ruby-js-js-runtime.js';
|
|
2
|
+
import { WasiCliEnvironment } from './interfaces/wasi-cli-environment.js';
|
|
3
|
+
import { WasiCliExit } from './interfaces/wasi-cli-exit.js';
|
|
4
|
+
import { WasiCliStderr } from './interfaces/wasi-cli-stderr.js';
|
|
5
|
+
import { WasiCliStdin } from './interfaces/wasi-cli-stdin.js';
|
|
6
|
+
import { WasiCliStdout } from './interfaces/wasi-cli-stdout.js';
|
|
7
|
+
import { WasiCliTerminalInput } from './interfaces/wasi-cli-terminal-input.js';
|
|
8
|
+
import { WasiCliTerminalOutput } from './interfaces/wasi-cli-terminal-output.js';
|
|
9
|
+
import { WasiCliTerminalStderr } from './interfaces/wasi-cli-terminal-stderr.js';
|
|
10
|
+
import { WasiCliTerminalStdin } from './interfaces/wasi-cli-terminal-stdin.js';
|
|
11
|
+
import { WasiCliTerminalStdout } from './interfaces/wasi-cli-terminal-stdout.js';
|
|
12
|
+
import { WasiClocksMonotonicClock } from './interfaces/wasi-clocks-monotonic-clock.js';
|
|
13
|
+
import { WasiClocksWallClock } from './interfaces/wasi-clocks-wall-clock.js';
|
|
14
|
+
import { WasiFilesystemPreopens } from './interfaces/wasi-filesystem-preopens.js';
|
|
15
|
+
import { WasiFilesystemTypes } from './interfaces/wasi-filesystem-types.js';
|
|
16
|
+
import { WasiIoError } from './interfaces/wasi-io-error.js';
|
|
17
|
+
import { WasiIoPoll } from './interfaces/wasi-io-poll.js';
|
|
18
|
+
import { WasiIoStreams } from './interfaces/wasi-io-streams.js';
|
|
19
|
+
import { WasiRandomRandom } from './interfaces/wasi-random-random.js';
|
|
20
|
+
import { RubyJsRubyRuntime } from './interfaces/ruby-js-ruby-runtime.js';
|
|
21
|
+
export interface ImportObject {
|
|
22
|
+
'ruby:js/js-runtime': typeof RubyJsJsRuntime,
|
|
23
|
+
'wasi:cli/environment@0.2.0': typeof WasiCliEnvironment,
|
|
24
|
+
'wasi:cli/exit@0.2.0': typeof WasiCliExit,
|
|
25
|
+
'wasi:cli/stderr@0.2.0': typeof WasiCliStderr,
|
|
26
|
+
'wasi:cli/stdin@0.2.0': typeof WasiCliStdin,
|
|
27
|
+
'wasi:cli/stdout@0.2.0': typeof WasiCliStdout,
|
|
28
|
+
'wasi:cli/terminal-input@0.2.0': typeof WasiCliTerminalInput,
|
|
29
|
+
'wasi:cli/terminal-output@0.2.0': typeof WasiCliTerminalOutput,
|
|
30
|
+
'wasi:cli/terminal-stderr@0.2.0': typeof WasiCliTerminalStderr,
|
|
31
|
+
'wasi:cli/terminal-stdin@0.2.0': typeof WasiCliTerminalStdin,
|
|
32
|
+
'wasi:cli/terminal-stdout@0.2.0': typeof WasiCliTerminalStdout,
|
|
33
|
+
'wasi:clocks/monotonic-clock@0.2.0': typeof WasiClocksMonotonicClock,
|
|
34
|
+
'wasi:clocks/wall-clock@0.2.0': typeof WasiClocksWallClock,
|
|
35
|
+
'wasi:filesystem/preopens@0.2.0': typeof WasiFilesystemPreopens,
|
|
36
|
+
'wasi:filesystem/types@0.2.0': typeof WasiFilesystemTypes,
|
|
37
|
+
'wasi:io/error@0.2.0': typeof WasiIoError,
|
|
38
|
+
'wasi:io/poll@0.2.0': typeof WasiIoPoll,
|
|
39
|
+
'wasi:io/streams@0.2.0': typeof WasiIoStreams,
|
|
40
|
+
'wasi:random/random@0.2.0': typeof WasiRandomRandom,
|
|
41
|
+
}
|
|
42
|
+
export interface Root {
|
|
43
|
+
'ruby:js/ruby-runtime': typeof RubyJsRubyRuntime,
|
|
44
|
+
rubyRuntime: typeof RubyJsRubyRuntime,
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Instantiates this component with the provided imports and
|
|
49
|
+
* returns a map of all the exports of the component.
|
|
50
|
+
*
|
|
51
|
+
* This function is intended to be similar to the
|
|
52
|
+
* `WebAssembly.instantiate` function. The second `imports`
|
|
53
|
+
* argument is the "import object" for wasm, except here it
|
|
54
|
+
* uses component-model-layer types instead of core wasm
|
|
55
|
+
* integers/numbers/etc.
|
|
56
|
+
*
|
|
57
|
+
* The first argument to this function, `getCoreModule`, is
|
|
58
|
+
* used to compile core wasm modules within the component.
|
|
59
|
+
* Components are composed of core wasm modules and this callback
|
|
60
|
+
* will be invoked per core wasm module. The caller of this
|
|
61
|
+
* function is responsible for reading the core wasm module
|
|
62
|
+
* identified by `path` and returning its compiled
|
|
63
|
+
* `WebAssembly.Module` object. This would use `compileStreaming`
|
|
64
|
+
* on the web, for example.
|
|
65
|
+
*/
|
|
66
|
+
export function instantiate(
|
|
67
|
+
getCoreModule: (path: string) => Promise<WebAssembly.Module>,
|
|
68
|
+
imports: ImportObject,
|
|
69
|
+
instantiateCore?: (module: WebAssembly.Module, imports: Record<string, any>) => Promise<WebAssembly.Instance>
|
|
70
|
+
): Promise<Root>;
|
|
71
|
+
|