@bytecodealliance/jco 1.10.2 → 1.11.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/package.json +18 -6
- package/src/cmd/componentize.js +64 -18
- package/src/cmd/opt.js +233 -202
- package/src/cmd/run.js +117 -73
- package/src/cmd/transpile.js +643 -530
- package/src/cmd/wasm-tools.js +130 -95
- package/src/jco.js +5 -1
- package/obj/interfaces/local-wasm-tools-tools.d.ts +0 -52
- package/obj/interfaces/wasi-cli-environment.d.ts +0 -2
- package/obj/interfaces/wasi-cli-exit.d.ts +0 -3
- package/obj/interfaces/wasi-cli-stderr.d.ts +0 -3
- package/obj/interfaces/wasi-cli-stdin.d.ts +0 -3
- package/obj/interfaces/wasi-cli-stdout.d.ts +0 -3
- package/obj/interfaces/wasi-cli-terminal-input.d.ts +0 -8
- package/obj/interfaces/wasi-cli-terminal-output.d.ts +0 -8
- package/obj/interfaces/wasi-cli-terminal-stderr.d.ts +0 -3
- package/obj/interfaces/wasi-cli-terminal-stdin.d.ts +0 -3
- package/obj/interfaces/wasi-cli-terminal-stdout.d.ts +0 -3
- package/obj/interfaces/wasi-clocks-wall-clock.d.ts +0 -5
- package/obj/interfaces/wasi-filesystem-preopens.d.ts +0 -3
- package/obj/interfaces/wasi-filesystem-types.d.ts +0 -164
- package/obj/interfaces/wasi-io-error.d.ts +0 -8
- package/obj/interfaces/wasi-io-streams.d.ts +0 -30
- package/obj/interfaces/wasi-random-random.d.ts +0 -2
- 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 +0 -116
- package/obj/js-component-bindgen-component.js +0 -4302
- package/obj/wasm-tools.core.wasm +0 -0
- package/obj/wasm-tools.core2.wasm +0 -0
- package/obj/wasm-tools.d.ts +0 -20
- package/obj/wasm-tools.js +0 -4369
- package/src/api.d.ts +0 -42
- package/src/api.d.ts.map +0 -1
- package/src/browser.d.ts +0 -4
- package/src/browser.d.ts.map +0 -1
- package/src/cmd/componentize.d.ts +0 -2
- package/src/cmd/componentize.d.ts.map +0 -1
- package/src/cmd/opt.d.ts +0 -20
- package/src/cmd/opt.d.ts.map +0 -1
- package/src/cmd/run.d.ts +0 -3
- package/src/cmd/run.d.ts.map +0 -1
- package/src/cmd/transpile.d.ts +0 -89
- package/src/cmd/transpile.d.ts.map +0 -1
- package/src/cmd/wasm-tools.d.ts +0 -8
- package/src/cmd/wasm-tools.d.ts.map +0 -1
- package/src/common.d.ts +0 -16
- package/src/common.d.ts.map +0 -1
- package/src/jco.d.ts +0 -3
- package/src/jco.d.ts.map +0 -1
- package/src/ora-shim.d.ts +0 -7
- package/src/ora-shim.d.ts.map +0 -1
package/src/cmd/wasm-tools.js
CHANGED
|
@@ -1,121 +1,156 @@
|
|
|
1
|
-
import { writeFile } from
|
|
1
|
+
import { writeFile } from 'node:fs/promises';
|
|
2
2
|
import { readFile, isWindows } from '../common.js';
|
|
3
|
-
import { $init, tools } from
|
|
4
|
-
const {
|
|
3
|
+
import { $init, tools } from '../../obj/wasm-tools.js';
|
|
4
|
+
const {
|
|
5
|
+
print: printFn,
|
|
6
|
+
parse: parseFn,
|
|
7
|
+
componentWit: componentWitFn,
|
|
8
|
+
componentNew: componentNewFn,
|
|
9
|
+
componentEmbed: componentEmbedFn,
|
|
10
|
+
metadataAdd: metadataAddFn,
|
|
11
|
+
metadataShow: metadataShowFn,
|
|
12
|
+
} = tools;
|
|
5
13
|
import { resolve, basename, extname } from 'node:path';
|
|
6
14
|
import c from 'chalk-template';
|
|
7
15
|
|
|
8
16
|
export async function parse(file, opts) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
17
|
+
await $init;
|
|
18
|
+
const source = (await readFile(file)).toString();
|
|
19
|
+
const output = parseFn(source);
|
|
20
|
+
await writeFile(opts.output, output);
|
|
13
21
|
}
|
|
14
22
|
|
|
15
23
|
export async function print(file, opts) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
await $init;
|
|
25
|
+
const source = await readFile(file);
|
|
26
|
+
const output = printFn(source);
|
|
27
|
+
if (opts.output) {
|
|
28
|
+
await writeFile(opts.output, output);
|
|
29
|
+
} else {
|
|
30
|
+
console.log(output);
|
|
31
|
+
}
|
|
24
32
|
}
|
|
25
33
|
|
|
26
34
|
export async function componentWit(file, opts) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
await $init;
|
|
36
|
+
const source = await readFile(file);
|
|
37
|
+
const output = componentWitFn(source, opts.document);
|
|
38
|
+
if (opts.output) {
|
|
39
|
+
await writeFile(opts.output, output);
|
|
40
|
+
} else {
|
|
41
|
+
console.log(output);
|
|
42
|
+
}
|
|
35
43
|
}
|
|
36
44
|
|
|
37
45
|
export async function componentNew(file, opts) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
46
|
+
await $init;
|
|
47
|
+
const source = file ? await readFile(file) : null;
|
|
48
|
+
let adapters = [];
|
|
49
|
+
if (opts.wasiReactor && opts.wasiCommand)
|
|
50
|
+
throw new Error('Must select one of --wasi-command or --wasi-reactor');
|
|
51
|
+
if (opts.wasiReactor)
|
|
52
|
+
adapters = [
|
|
53
|
+
[
|
|
54
|
+
'wasi_snapshot_preview1',
|
|
55
|
+
(
|
|
56
|
+
await readFile(
|
|
57
|
+
new URL(
|
|
58
|
+
'../../lib/wasi_snapshot_preview1.reactor.wasm',
|
|
59
|
+
import.meta.url
|
|
60
|
+
)
|
|
61
|
+
)
|
|
62
|
+
).buffer,
|
|
63
|
+
],
|
|
64
|
+
];
|
|
65
|
+
else if (opts.wasiCommand)
|
|
66
|
+
adapters = [
|
|
67
|
+
[
|
|
68
|
+
'wasi_snapshot_preview1',
|
|
69
|
+
(
|
|
70
|
+
await readFile(
|
|
71
|
+
new URL(
|
|
72
|
+
'../../lib/wasi_snapshot_preview1.command.wasm',
|
|
73
|
+
import.meta.url
|
|
74
|
+
)
|
|
75
|
+
)
|
|
76
|
+
).buffer,
|
|
77
|
+
],
|
|
78
|
+
];
|
|
79
|
+
if (opts.adapt)
|
|
80
|
+
adapters = adapters.concat(
|
|
81
|
+
await Promise.all(
|
|
82
|
+
opts.adapt.map(async (adapt) => {
|
|
83
|
+
let adapter;
|
|
84
|
+
if (adapt.includes('=')) adapter = adapt.split('=');
|
|
85
|
+
else
|
|
86
|
+
adapter = [
|
|
87
|
+
basename(adapt).slice(0, -extname(adapt).length),
|
|
88
|
+
adapt,
|
|
89
|
+
];
|
|
90
|
+
adapter[1] = await readFile(adapter[1]);
|
|
91
|
+
return adapter;
|
|
92
|
+
})
|
|
93
|
+
)
|
|
94
|
+
);
|
|
95
|
+
const output = componentNewFn(source, adapters);
|
|
96
|
+
await writeFile(opts.output, output);
|
|
59
97
|
}
|
|
60
98
|
|
|
61
99
|
export async function componentEmbed(file, opts) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
100
|
+
await $init;
|
|
101
|
+
if (opts.metadata)
|
|
102
|
+
opts.metadata = opts.metadata.map((meta) => {
|
|
103
|
+
const [field, data = ''] = meta.split('=');
|
|
104
|
+
const [name, version = ''] = data.split('@');
|
|
105
|
+
return [field, [[name, version]]];
|
|
106
|
+
});
|
|
107
|
+
const source = file ? await readFile(file) : null;
|
|
108
|
+
opts.binary = source;
|
|
109
|
+
opts.witPath = (isWindows ? '//?/' : '') + resolve(opts.wit);
|
|
110
|
+
const output = componentEmbedFn(opts);
|
|
111
|
+
await writeFile(opts.output, output);
|
|
74
112
|
}
|
|
75
113
|
|
|
76
114
|
export async function metadataAdd(file, opts) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
115
|
+
await $init;
|
|
116
|
+
const metadata = opts.metadata.map((meta) => {
|
|
117
|
+
const [field, data = ''] = meta.split('=');
|
|
118
|
+
const [name, version = ''] = data.split('@');
|
|
119
|
+
return [field, [[name, version]]];
|
|
120
|
+
});
|
|
121
|
+
const source = await readFile(file);
|
|
122
|
+
const output = metadataAddFn(source, metadata);
|
|
123
|
+
await writeFile(opts.output, output);
|
|
86
124
|
}
|
|
87
125
|
|
|
88
126
|
export async function metadataShow(file, opts) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
127
|
+
await $init;
|
|
128
|
+
const source = await readFile(file);
|
|
129
|
+
let output = '',
|
|
130
|
+
stack = [1];
|
|
131
|
+
const meta = metadataShowFn(source);
|
|
132
|
+
if (opts.json) {
|
|
133
|
+
console.log(JSON.stringify(meta, null, 2));
|
|
134
|
+
} else {
|
|
135
|
+
for (const { name, metaType, producers } of meta) {
|
|
136
|
+
output += ' '.repeat(stack.length - 1);
|
|
137
|
+
const indent = ' '.repeat(stack.length);
|
|
138
|
+
if (metaType.tag === 'component') {
|
|
139
|
+
output += c`{bold [component${name ? ' ' + name : ''}]}\n`;
|
|
140
|
+
if (metaType.val > 0) stack.push(metaType.val);
|
|
141
|
+
} else {
|
|
142
|
+
output += c`{bold [module${name ? ' ' + name : ''}]}\n`;
|
|
143
|
+
}
|
|
144
|
+
if (producers.length === 0) output += `${indent}(no metadata)\n`;
|
|
145
|
+
for (const [field, items] of producers) {
|
|
146
|
+
for (const [name, version] of items) {
|
|
147
|
+
output += `${indent}${(field + ':').padEnd(13, ' ')} ${name}${version ? c`{cyan ${version}}` : ''}\n`;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
output += '\n';
|
|
151
|
+
if (stack[stack.length - 1] === 0) stack.pop();
|
|
152
|
+
stack[stack.length - 1]--;
|
|
112
153
|
}
|
|
113
|
-
|
|
114
|
-
output += '\n';
|
|
115
|
-
if (stack[stack.length - 1] === 0)
|
|
116
|
-
stack.pop();
|
|
117
|
-
stack[stack.length - 1]--;
|
|
154
|
+
process.stdout.write(output);
|
|
118
155
|
}
|
|
119
|
-
process.stdout.write(output);
|
|
120
|
-
}
|
|
121
156
|
}
|
package/src/jco.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import c from 'chalk-template';
|
|
2
4
|
import { program, Option } from 'commander';
|
|
5
|
+
|
|
3
6
|
import { opt } from './cmd/opt.js';
|
|
4
7
|
import { transpile, types, guestTypes } from './cmd/transpile.js';
|
|
5
8
|
import { run as runCmd, serve as serveCmd } from './cmd/run.js';
|
|
6
9
|
import { parse, print, componentNew, componentEmbed, metadataAdd, metadataShow, componentWit } from './cmd/wasm-tools.js';
|
|
7
10
|
import { componentize } from './cmd/componentize.js';
|
|
8
|
-
import c from 'chalk-template';
|
|
9
11
|
|
|
10
12
|
program
|
|
11
13
|
.name('jco')
|
|
@@ -34,10 +36,12 @@ program.command('componentize')
|
|
|
34
36
|
.requiredOption('-w, --wit <path>', 'WIT path to build with')
|
|
35
37
|
.option('-n, --world-name <name>', 'WIT world to build')
|
|
36
38
|
.option('--aot', 'Enable Weval AOT compilation of JS')
|
|
39
|
+
.option('--aot-min-stack-size-bytes <number>', 'Set the min stack size to be used during AOT')
|
|
37
40
|
.option('--weval-bin <path>', 'Specify a custom weval binary to use')
|
|
38
41
|
.addOption(new Option('-d, --disable <feature...>', 'disable WASI features').choices(['clocks', 'http', 'random', 'stdio', 'all']))
|
|
39
42
|
// .addOption(new Option('-e, --enable <feature...>', 'enable WASI features').choices(['http']))
|
|
40
43
|
.option('--preview2-adapter <adapter>', 'provide a custom preview2 adapter path')
|
|
44
|
+
.option('--debug-starlingmonkey-build', 'use a debug build of StarlingMonkey')
|
|
41
45
|
.requiredOption('-o, --out <out>', 'output component file')
|
|
42
46
|
.action(asyncAction(componentize));
|
|
43
47
|
|
|
@@ -1,52 +0,0 @@
|
|
|
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;
|
|
9
|
-
/**
|
|
10
|
-
* # Variants
|
|
11
|
-
*
|
|
12
|
-
* ## `"utf8"`
|
|
13
|
-
*
|
|
14
|
-
* ## `"utf16"`
|
|
15
|
-
*
|
|
16
|
-
* ## `"compact-utf16"`
|
|
17
|
-
*/
|
|
18
|
-
export type StringEncoding = 'utf8' | 'utf16' | 'compact-utf16';
|
|
19
|
-
export type ProducersFields = Array<[string, Array<[string, string]>]>;
|
|
20
|
-
export type EnabledFeatureSet = EnabledFeatureSetList | EnabledFeatureSetAll;
|
|
21
|
-
export interface EnabledFeatureSetList {
|
|
22
|
-
tag: 'list',
|
|
23
|
-
val: Array<string>,
|
|
24
|
-
}
|
|
25
|
-
export interface EnabledFeatureSetAll {
|
|
26
|
-
tag: 'all',
|
|
27
|
-
}
|
|
28
|
-
export interface EmbedOpts {
|
|
29
|
-
binary?: Uint8Array,
|
|
30
|
-
witSource?: string,
|
|
31
|
-
witPath?: string,
|
|
32
|
-
stringEncoding?: StringEncoding,
|
|
33
|
-
dummy?: boolean,
|
|
34
|
-
world?: string,
|
|
35
|
-
metadata?: ProducersFields,
|
|
36
|
-
features?: EnabledFeatureSet,
|
|
37
|
-
}
|
|
38
|
-
export type ModuleMetaType = ModuleMetaTypeModule | ModuleMetaTypeComponent;
|
|
39
|
-
export interface ModuleMetaTypeModule {
|
|
40
|
-
tag: 'module',
|
|
41
|
-
}
|
|
42
|
-
export interface ModuleMetaTypeComponent {
|
|
43
|
-
tag: 'component',
|
|
44
|
-
val: number,
|
|
45
|
-
}
|
|
46
|
-
export interface ModuleMetadata {
|
|
47
|
-
parentIndex?: number,
|
|
48
|
-
name?: string,
|
|
49
|
-
metaType: ModuleMetaType,
|
|
50
|
-
range: [number, number],
|
|
51
|
-
producers: ProducersFields,
|
|
52
|
-
}
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
/** @module Interface wasi:filesystem/types@0.2.3 **/
|
|
2
|
-
export function filesystemErrorCode(err: Error): ErrorCode | undefined;
|
|
3
|
-
export type Filesize = bigint;
|
|
4
|
-
export type InputStream = import('./wasi-io-streams.js').InputStream;
|
|
5
|
-
/**
|
|
6
|
-
* # Variants
|
|
7
|
-
*
|
|
8
|
-
* ## `"access"`
|
|
9
|
-
*
|
|
10
|
-
* ## `"would-block"`
|
|
11
|
-
*
|
|
12
|
-
* ## `"already"`
|
|
13
|
-
*
|
|
14
|
-
* ## `"bad-descriptor"`
|
|
15
|
-
*
|
|
16
|
-
* ## `"busy"`
|
|
17
|
-
*
|
|
18
|
-
* ## `"deadlock"`
|
|
19
|
-
*
|
|
20
|
-
* ## `"quota"`
|
|
21
|
-
*
|
|
22
|
-
* ## `"exist"`
|
|
23
|
-
*
|
|
24
|
-
* ## `"file-too-large"`
|
|
25
|
-
*
|
|
26
|
-
* ## `"illegal-byte-sequence"`
|
|
27
|
-
*
|
|
28
|
-
* ## `"in-progress"`
|
|
29
|
-
*
|
|
30
|
-
* ## `"interrupted"`
|
|
31
|
-
*
|
|
32
|
-
* ## `"invalid"`
|
|
33
|
-
*
|
|
34
|
-
* ## `"io"`
|
|
35
|
-
*
|
|
36
|
-
* ## `"is-directory"`
|
|
37
|
-
*
|
|
38
|
-
* ## `"loop"`
|
|
39
|
-
*
|
|
40
|
-
* ## `"too-many-links"`
|
|
41
|
-
*
|
|
42
|
-
* ## `"message-size"`
|
|
43
|
-
*
|
|
44
|
-
* ## `"name-too-long"`
|
|
45
|
-
*
|
|
46
|
-
* ## `"no-device"`
|
|
47
|
-
*
|
|
48
|
-
* ## `"no-entry"`
|
|
49
|
-
*
|
|
50
|
-
* ## `"no-lock"`
|
|
51
|
-
*
|
|
52
|
-
* ## `"insufficient-memory"`
|
|
53
|
-
*
|
|
54
|
-
* ## `"insufficient-space"`
|
|
55
|
-
*
|
|
56
|
-
* ## `"not-directory"`
|
|
57
|
-
*
|
|
58
|
-
* ## `"not-empty"`
|
|
59
|
-
*
|
|
60
|
-
* ## `"not-recoverable"`
|
|
61
|
-
*
|
|
62
|
-
* ## `"unsupported"`
|
|
63
|
-
*
|
|
64
|
-
* ## `"no-tty"`
|
|
65
|
-
*
|
|
66
|
-
* ## `"no-such-device"`
|
|
67
|
-
*
|
|
68
|
-
* ## `"overflow"`
|
|
69
|
-
*
|
|
70
|
-
* ## `"not-permitted"`
|
|
71
|
-
*
|
|
72
|
-
* ## `"pipe"`
|
|
73
|
-
*
|
|
74
|
-
* ## `"read-only"`
|
|
75
|
-
*
|
|
76
|
-
* ## `"invalid-seek"`
|
|
77
|
-
*
|
|
78
|
-
* ## `"text-file-busy"`
|
|
79
|
-
*
|
|
80
|
-
* ## `"cross-device"`
|
|
81
|
-
*/
|
|
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';
|
|
83
|
-
export type OutputStream = import('./wasi-io-streams.js').OutputStream;
|
|
84
|
-
/**
|
|
85
|
-
* # Variants
|
|
86
|
-
*
|
|
87
|
-
* ## `"unknown"`
|
|
88
|
-
*
|
|
89
|
-
* ## `"block-device"`
|
|
90
|
-
*
|
|
91
|
-
* ## `"character-device"`
|
|
92
|
-
*
|
|
93
|
-
* ## `"directory"`
|
|
94
|
-
*
|
|
95
|
-
* ## `"fifo"`
|
|
96
|
-
*
|
|
97
|
-
* ## `"symbolic-link"`
|
|
98
|
-
*
|
|
99
|
-
* ## `"regular-file"`
|
|
100
|
-
*
|
|
101
|
-
* ## `"socket"`
|
|
102
|
-
*/
|
|
103
|
-
export type DescriptorType = 'unknown' | 'block-device' | 'character-device' | 'directory' | 'fifo' | 'symbolic-link' | 'regular-file' | 'socket';
|
|
104
|
-
export type LinkCount = bigint;
|
|
105
|
-
export type Datetime = import('./wasi-clocks-wall-clock.js').Datetime;
|
|
106
|
-
export interface DescriptorStat {
|
|
107
|
-
type: DescriptorType,
|
|
108
|
-
linkCount: LinkCount,
|
|
109
|
-
size: Filesize,
|
|
110
|
-
dataAccessTimestamp?: Datetime,
|
|
111
|
-
dataModificationTimestamp?: Datetime,
|
|
112
|
-
statusChangeTimestamp?: Datetime,
|
|
113
|
-
}
|
|
114
|
-
export interface PathFlags {
|
|
115
|
-
symlinkFollow?: boolean,
|
|
116
|
-
}
|
|
117
|
-
export interface OpenFlags {
|
|
118
|
-
create?: boolean,
|
|
119
|
-
directory?: boolean,
|
|
120
|
-
exclusive?: boolean,
|
|
121
|
-
truncate?: boolean,
|
|
122
|
-
}
|
|
123
|
-
export interface DescriptorFlags {
|
|
124
|
-
read?: boolean,
|
|
125
|
-
write?: boolean,
|
|
126
|
-
fileIntegritySync?: boolean,
|
|
127
|
-
dataIntegritySync?: boolean,
|
|
128
|
-
requestedWriteSync?: boolean,
|
|
129
|
-
mutateDirectory?: boolean,
|
|
130
|
-
}
|
|
131
|
-
export interface MetadataHashValue {
|
|
132
|
-
lower: bigint,
|
|
133
|
-
upper: bigint,
|
|
134
|
-
}
|
|
135
|
-
export interface DirectoryEntry {
|
|
136
|
-
type: DescriptorType,
|
|
137
|
-
name: string,
|
|
138
|
-
}
|
|
139
|
-
export type Error = import('./wasi-io-streams.js').Error;
|
|
140
|
-
|
|
141
|
-
export class Descriptor {
|
|
142
|
-
/**
|
|
143
|
-
* This type does not have a public constructor.
|
|
144
|
-
*/
|
|
145
|
-
private constructor();
|
|
146
|
-
readViaStream(offset: Filesize): InputStream;
|
|
147
|
-
writeViaStream(offset: Filesize): OutputStream;
|
|
148
|
-
appendViaStream(): OutputStream;
|
|
149
|
-
getType(): DescriptorType;
|
|
150
|
-
readDirectory(): DirectoryEntryStream;
|
|
151
|
-
stat(): DescriptorStat;
|
|
152
|
-
statAt(pathFlags: PathFlags, path: string): DescriptorStat;
|
|
153
|
-
openAt(pathFlags: PathFlags, path: string, openFlags: OpenFlags, flags: DescriptorFlags): Descriptor;
|
|
154
|
-
metadataHash(): MetadataHashValue;
|
|
155
|
-
metadataHashAt(pathFlags: PathFlags, path: string): MetadataHashValue;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export class DirectoryEntryStream {
|
|
159
|
-
/**
|
|
160
|
-
* This type does not have a public constructor.
|
|
161
|
-
*/
|
|
162
|
-
private constructor();
|
|
163
|
-
readDirectoryEntry(): DirectoryEntry | undefined;
|
|
164
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/** @module Interface wasi:io/streams@0.2.3 **/
|
|
2
|
-
export type Error = import('./wasi-io-error.js').Error;
|
|
3
|
-
export type StreamError = StreamErrorLastOperationFailed | StreamErrorClosed;
|
|
4
|
-
export interface StreamErrorLastOperationFailed {
|
|
5
|
-
tag: 'last-operation-failed',
|
|
6
|
-
val: Error,
|
|
7
|
-
}
|
|
8
|
-
export interface StreamErrorClosed {
|
|
9
|
-
tag: 'closed',
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export class InputStream {
|
|
13
|
-
/**
|
|
14
|
-
* This type does not have a public constructor.
|
|
15
|
-
*/
|
|
16
|
-
private constructor();
|
|
17
|
-
read(len: bigint): Uint8Array;
|
|
18
|
-
blockingRead(len: bigint): Uint8Array;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export class OutputStream {
|
|
22
|
-
/**
|
|
23
|
-
* This type does not have a public constructor.
|
|
24
|
-
*/
|
|
25
|
-
private constructor();
|
|
26
|
-
checkWrite(): bigint;
|
|
27
|
-
write(contents: Uint8Array): void;
|
|
28
|
-
blockingWriteAndFlush(contents: Uint8Array): void;
|
|
29
|
-
blockingFlush(): void;
|
|
30
|
-
}
|
|
Binary file
|
|
Binary file
|