@bytecodealliance/jco 0.13.0 → 0.13.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/obj/interfaces/wasi-cli-stderr.d.ts +1 -1
- package/obj/interfaces/wasi-cli-stdin.d.ts +1 -1
- package/obj/interfaces/wasi-cli-stdout.d.ts +1 -1
- package/obj/interfaces/wasi-cli-terminal-input.d.ts +4 -2
- package/obj/interfaces/wasi-cli-terminal-output.d.ts +4 -2
- package/obj/interfaces/wasi-cli-terminal-stderr.d.ts +1 -1
- package/obj/interfaces/wasi-cli-terminal-stdin.d.ts +1 -1
- package/obj/interfaces/wasi-cli-terminal-stdout.d.ts +1 -1
- package/obj/interfaces/wasi-filesystem-preopens.d.ts +1 -1
- package/obj/interfaces/wasi-filesystem-types.d.ts +24 -17
- package/obj/interfaces/wasi-io-streams.d.ts +26 -26
- package/obj/interfaces/wasi-sockets-tcp.d.ts +4 -0
- package/obj/js-component-bindgen-component.component.wasm +0 -0
- package/obj/js-component-bindgen-component.core.wasm +0 -0
- package/obj/js-component-bindgen-component.d.ts +16 -16
- package/obj/wasm-tools.d.ts +16 -16
- package/package.json +4 -4
- package/src/cmd/run.js +21 -27
- package/src/jco.js +1 -1
- package/obj/interfaces/wasi-cli-environment-0.2.0-rc-2023-11-05.d.ts +0 -3
- package/obj/interfaces/wasi-cli-exit-0.2.0-rc-2023-11-05.d.ts +0 -4
- package/obj/interfaces/wasi-cli-stderr-0.2.0-rc-2023-11-05.d.ts +0 -5
- package/obj/interfaces/wasi-cli-stdin-0.2.0-rc-2023-11-05.d.ts +0 -5
- package/obj/interfaces/wasi-cli-stdout-0.2.0-rc-2023-11-05.d.ts +0 -5
- package/obj/interfaces/wasi-cli-terminal-input-0.2.0-rc-2023-11-05.d.ts +0 -2
- package/obj/interfaces/wasi-cli-terminal-output-0.2.0-rc-2023-11-05.d.ts +0 -2
- package/obj/interfaces/wasi-cli-terminal-stderr-0.2.0-rc-2023-11-05.d.ts +0 -5
- package/obj/interfaces/wasi-cli-terminal-stdin-0.2.0-rc-2023-11-05.d.ts +0 -5
- package/obj/interfaces/wasi-cli-terminal-stdout-0.2.0-rc-2023-11-05.d.ts +0 -5
- package/obj/interfaces/wasi-clocks-wall-clock-0.2.0-rc-2023-11-05.d.ts +0 -6
- package/obj/interfaces/wasi-filesystem-preopens-0.2.0-rc-2023-11-05.d.ts +0 -5
- package/obj/interfaces/wasi-filesystem-types-0.2.0-rc-2023-11-05.d.ts +0 -156
- package/obj/interfaces/wasi-io-streams-0.2.0-rc-2023-11-05.d.ts +0 -24
- package/obj/interfaces/wasi-random-random-0.2.0-rc-2023-11-05.d.ts +0 -3
- package/obj/interfaces/wasi-sockets-tcp-0.2.0-rc-2023-11-05.d.ts +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export namespace WasiCliTerminalStderr {
|
|
2
2
|
export function getTerminalStderr(): TerminalOutput | undefined;
|
|
3
3
|
}
|
|
4
|
-
import type { TerminalOutput } from '../interfaces/wasi-cli-terminal-output';
|
|
4
|
+
import type { TerminalOutput } from '../interfaces/wasi-cli-terminal-output.js';
|
|
5
5
|
export { TerminalOutput };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export namespace WasiCliTerminalStdin {
|
|
2
2
|
export function getTerminalStdin(): TerminalInput | undefined;
|
|
3
3
|
}
|
|
4
|
-
import type { TerminalInput } from '../interfaces/wasi-cli-terminal-input';
|
|
4
|
+
import type { TerminalInput } from '../interfaces/wasi-cli-terminal-input.js';
|
|
5
5
|
export { TerminalInput };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export namespace WasiCliTerminalStdout {
|
|
2
2
|
export function getTerminalStdout(): TerminalOutput | undefined;
|
|
3
3
|
}
|
|
4
|
-
import type { TerminalOutput } from '../interfaces/wasi-cli-terminal-output';
|
|
4
|
+
import type { TerminalOutput } from '../interfaces/wasi-cli-terminal-output.js';
|
|
5
5
|
export { TerminalOutput };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export namespace WasiFilesystemPreopens {
|
|
2
2
|
export function getDirectories(): [Descriptor, string][];
|
|
3
3
|
}
|
|
4
|
-
import type { Descriptor } from '../interfaces/wasi-filesystem-types';
|
|
4
|
+
import type { Descriptor } from '../interfaces/wasi-filesystem-types.js';
|
|
5
5
|
export { Descriptor };
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
export namespace WasiFilesystemTypes {
|
|
2
|
-
export
|
|
3
|
-
export function
|
|
4
|
-
export
|
|
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
|
-
export function metadataHash(this_: Descriptor): MetadataHashValue;
|
|
2
|
+
export { Descriptor };
|
|
3
|
+
export function filesystemErrorCode(err: Error): ErrorCode | undefined;
|
|
4
|
+
export { DirectoryEntryStream };
|
|
11
5
|
}
|
|
12
|
-
export type Descriptor = number;
|
|
13
6
|
export type Filesize = bigint;
|
|
14
|
-
import type { InputStream } from '../interfaces/wasi-io-streams';
|
|
7
|
+
import type { InputStream } from '../interfaces/wasi-io-streams.js';
|
|
15
8
|
export { InputStream };
|
|
16
9
|
/**
|
|
17
10
|
* # Variants
|
|
@@ -91,7 +84,7 @@ export { InputStream };
|
|
|
91
84
|
* ## `"cross-device"`
|
|
92
85
|
*/
|
|
93
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';
|
|
94
|
-
import type { OutputStream } from '../interfaces/wasi-io-streams';
|
|
87
|
+
import type { OutputStream } from '../interfaces/wasi-io-streams.js';
|
|
95
88
|
export { OutputStream };
|
|
96
89
|
/**
|
|
97
90
|
* # Variants
|
|
@@ -114,15 +107,15 @@ export { OutputStream };
|
|
|
114
107
|
*/
|
|
115
108
|
export type DescriptorType = 'unknown' | 'block-device' | 'character-device' | 'directory' | 'fifo' | 'symbolic-link' | 'regular-file' | 'socket';
|
|
116
109
|
export type LinkCount = bigint;
|
|
117
|
-
import type { Datetime } from '../interfaces/wasi-clocks-wall-clock';
|
|
110
|
+
import type { Datetime } from '../interfaces/wasi-clocks-wall-clock.js';
|
|
118
111
|
export { Datetime };
|
|
119
112
|
export interface DescriptorStat {
|
|
120
113
|
type: DescriptorType,
|
|
121
114
|
linkCount: LinkCount,
|
|
122
115
|
size: Filesize,
|
|
123
|
-
dataAccessTimestamp
|
|
124
|
-
dataModificationTimestamp
|
|
125
|
-
statusChangeTimestamp
|
|
116
|
+
dataAccessTimestamp?: Datetime,
|
|
117
|
+
dataModificationTimestamp?: Datetime,
|
|
118
|
+
statusChangeTimestamp?: Datetime,
|
|
126
119
|
}
|
|
127
120
|
export interface PathFlags {
|
|
128
121
|
symlinkFollow?: boolean,
|
|
@@ -146,8 +139,22 @@ export interface Modes {
|
|
|
146
139
|
writable?: boolean,
|
|
147
140
|
executable?: boolean,
|
|
148
141
|
}
|
|
149
|
-
export type DirectoryEntryStream = number;
|
|
150
142
|
export interface MetadataHashValue {
|
|
151
143
|
lower: bigint,
|
|
152
144
|
upper: bigint,
|
|
153
145
|
}
|
|
146
|
+
import type { Error } from '../interfaces/wasi-io-streams.js';
|
|
147
|
+
export { Error };
|
|
148
|
+
|
|
149
|
+
export class Descriptor {
|
|
150
|
+
readViaStream(offset: Filesize): InputStream;
|
|
151
|
+
writeViaStream(offset: Filesize): OutputStream;
|
|
152
|
+
appendViaStream(): OutputStream;
|
|
153
|
+
getType(): DescriptorType;
|
|
154
|
+
stat(): DescriptorStat;
|
|
155
|
+
openAt(pathFlags: PathFlags, path: string, openFlags: OpenFlags, flags: DescriptorFlags, modes: Modes): Descriptor;
|
|
156
|
+
metadataHash(): MetadataHashValue;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export class DirectoryEntryStream {
|
|
160
|
+
}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
export namespace WasiIoStreams {
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
export { InputStream };
|
|
3
|
+
export { OutputStream };
|
|
4
|
+
export { Error };
|
|
5
|
+
}
|
|
6
|
+
export type StreamError = StreamErrorLastOperationFailed | StreamErrorClosed;
|
|
7
|
+
export interface StreamErrorLastOperationFailed {
|
|
8
|
+
tag: 'last-operation-failed',
|
|
9
|
+
val: Error,
|
|
10
|
+
}
|
|
11
|
+
export interface StreamErrorClosed {
|
|
12
|
+
tag: 'closed',
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export class Error {
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export class InputStream {
|
|
19
|
+
read(len: bigint): Uint8Array;
|
|
20
|
+
blockingRead(len: bigint): Uint8Array;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export class OutputStream {
|
|
24
|
+
checkWrite(): bigint;
|
|
25
|
+
write(contents: Uint8Array): void;
|
|
26
|
+
blockingWriteAndFlush(contents: Uint8Array): void;
|
|
27
|
+
blockingFlush(): void;
|
|
10
28
|
}
|
|
11
|
-
export type InputStream = number;
|
|
12
|
-
/**
|
|
13
|
-
* # Variants
|
|
14
|
-
*
|
|
15
|
-
* ## `"open"`
|
|
16
|
-
*
|
|
17
|
-
* ## `"ended"`
|
|
18
|
-
*/
|
|
19
|
-
export type StreamStatus = 'open' | 'ended';
|
|
20
|
-
export type OutputStream = number;
|
|
21
|
-
/**
|
|
22
|
-
* # Variants
|
|
23
|
-
*
|
|
24
|
-
* ## `"last-operation-failed"`
|
|
25
|
-
*
|
|
26
|
-
* ## `"closed"`
|
|
27
|
-
*/
|
|
28
|
-
export type WriteError = 'last-operation-failed' | 'closed';
|
|
Binary file
|
|
Binary file
|
|
@@ -45,22 +45,22 @@ export interface Transpiled {
|
|
|
45
45
|
imports: string[],
|
|
46
46
|
exports: [string, ExportType][],
|
|
47
47
|
}
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
58
|
-
import {
|
|
59
|
-
import {
|
|
60
|
-
import {
|
|
61
|
-
import {
|
|
62
|
-
import {
|
|
63
|
-
import {
|
|
48
|
+
import { WasiCliEnvironment } from './interfaces/wasi-cli-environment';
|
|
49
|
+
import { WasiCliExit } from './interfaces/wasi-cli-exit';
|
|
50
|
+
import { WasiCliStderr } from './interfaces/wasi-cli-stderr';
|
|
51
|
+
import { WasiCliStdin } from './interfaces/wasi-cli-stdin';
|
|
52
|
+
import { WasiCliStdout } from './interfaces/wasi-cli-stdout';
|
|
53
|
+
import { WasiCliTerminalInput } from './interfaces/wasi-cli-terminal-input';
|
|
54
|
+
import { WasiCliTerminalOutput } from './interfaces/wasi-cli-terminal-output';
|
|
55
|
+
import { WasiCliTerminalStderr } from './interfaces/wasi-cli-terminal-stderr';
|
|
56
|
+
import { WasiCliTerminalStdin } from './interfaces/wasi-cli-terminal-stdin';
|
|
57
|
+
import { WasiCliTerminalStdout } from './interfaces/wasi-cli-terminal-stdout';
|
|
58
|
+
import { WasiClocksWallClock } from './interfaces/wasi-clocks-wall-clock';
|
|
59
|
+
import { WasiFilesystemPreopens } from './interfaces/wasi-filesystem-preopens';
|
|
60
|
+
import { WasiFilesystemTypes } from './interfaces/wasi-filesystem-types';
|
|
61
|
+
import { WasiIoStreams } from './interfaces/wasi-io-streams';
|
|
62
|
+
import { WasiRandomRandom } from './interfaces/wasi-random-random';
|
|
63
|
+
import { WasiSocketsTcp } from './interfaces/wasi-sockets-tcp';
|
|
64
64
|
export function generate(component: Uint8Array, options: GenerateOptions): Transpiled;
|
|
65
65
|
export function generateTypes(name: string, options: TypeGenerationOptions): Files;
|
|
66
66
|
|
package/obj/wasm-tools.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
1
|
+
import { WasiCliEnvironment } from './interfaces/wasi-cli-environment';
|
|
2
|
+
import { WasiCliExit } from './interfaces/wasi-cli-exit';
|
|
3
|
+
import { WasiCliStderr } from './interfaces/wasi-cli-stderr';
|
|
4
|
+
import { WasiCliStdin } from './interfaces/wasi-cli-stdin';
|
|
5
|
+
import { WasiCliStdout } from './interfaces/wasi-cli-stdout';
|
|
6
|
+
import { WasiCliTerminalInput } from './interfaces/wasi-cli-terminal-input';
|
|
7
|
+
import { WasiCliTerminalOutput } from './interfaces/wasi-cli-terminal-output';
|
|
8
|
+
import { WasiCliTerminalStderr } from './interfaces/wasi-cli-terminal-stderr';
|
|
9
|
+
import { WasiCliTerminalStdin } from './interfaces/wasi-cli-terminal-stdin';
|
|
10
|
+
import { WasiCliTerminalStdout } from './interfaces/wasi-cli-terminal-stdout';
|
|
11
|
+
import { WasiClocksWallClock } from './interfaces/wasi-clocks-wall-clock';
|
|
12
|
+
import { WasiFilesystemPreopens } from './interfaces/wasi-filesystem-preopens';
|
|
13
|
+
import { WasiFilesystemTypes } from './interfaces/wasi-filesystem-types';
|
|
14
|
+
import { WasiIoStreams } from './interfaces/wasi-io-streams';
|
|
15
|
+
import { WasiRandomRandom } from './interfaces/wasi-random-random';
|
|
16
|
+
import { WasiSocketsTcp } from './interfaces/wasi-sockets-tcp';
|
|
17
17
|
import { LocalWasmToolsTools } from './interfaces/local-wasm-tools-tools';
|
|
18
18
|
export const tools: typeof LocalWasmToolsTools;
|
|
19
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bytecodealliance/jco",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.2",
|
|
4
4
|
"description": "JavaScript tooling for working with WebAssembly Components",
|
|
5
5
|
"author": "Guy Bedford",
|
|
6
6
|
"bin": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"type": "module",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@bytecodealliance/preview2-shim": "0.0.
|
|
21
|
+
"@bytecodealliance/preview2-shim": "0.0.20",
|
|
22
22
|
"binaryen": "^111.0.0",
|
|
23
23
|
"chalk-template": "^0.4.0",
|
|
24
24
|
"commander": "^9.4.1",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"terser": "^5.16.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@bytecodealliance/componentize-js": "^0.
|
|
30
|
+
"@bytecodealliance/componentize-js": "^0.4.0",
|
|
31
31
|
"@types/node": "^18.11.17",
|
|
32
32
|
"@typescript-eslint/eslint-plugin": "^5.41.0",
|
|
33
33
|
"@typescript-eslint/parser": "^5.41.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"homepage": "https://github.com/bytecodealliance/jco#readme",
|
|
53
53
|
"scripts": {
|
|
54
54
|
"build": "cargo xtask build workspace",
|
|
55
|
-
"build:types:preview2-shim": "cargo xtask
|
|
55
|
+
"build:types:preview2-shim": "cargo xtask generate wasi-types",
|
|
56
56
|
"lint": "eslint -c eslintrc.cjs lib/**/*.js packages/*/lib/**/*.js",
|
|
57
57
|
"test": "mocha -u tdd test/test.js --timeout 120000"
|
|
58
58
|
},
|
package/src/cmd/run.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { getTmpDir } from '../common.js';
|
|
2
2
|
import { transpile } from './transpile.js';
|
|
3
|
-
import { rm, stat, mkdir, writeFile, symlink
|
|
3
|
+
import { rm, stat, mkdir, writeFile, symlink } from 'node:fs/promises';
|
|
4
4
|
import { basename, resolve, extname } from 'node:path';
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
5
|
+
import { fork } from 'node:child_process';
|
|
6
|
+
import process from 'node:process';
|
|
7
7
|
import { fileURLToPath } from 'node:url';
|
|
8
8
|
import c from 'chalk-template';
|
|
9
9
|
|
|
10
10
|
export async function run (componentPath, args) {
|
|
11
|
+
// Ensure that `args` is an array
|
|
12
|
+
args = [...args];
|
|
13
|
+
|
|
11
14
|
const name = basename(componentPath.slice(0, -extname(componentPath).length || Infinity));
|
|
12
15
|
const outDir = await getTmpDir();
|
|
13
|
-
let cp;
|
|
14
16
|
try {
|
|
15
17
|
try {
|
|
16
18
|
await transpile(componentPath, {
|
|
@@ -22,11 +24,9 @@ export async function run (componentPath, args) {
|
|
|
22
24
|
});
|
|
23
25
|
}
|
|
24
26
|
catch (e) {
|
|
25
|
-
|
|
26
|
-
throw e;
|
|
27
|
+
throw new Error('Unable to transpile command for execution', { cause: e });
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
await mkdir(resolve(outDir, 'node_modules', '@bytecodealliance'), { recursive: true });
|
|
30
30
|
await writeFile(resolve(outDir, 'package.json'), JSON.stringify({ type: 'module' }));
|
|
31
31
|
|
|
32
32
|
let preview2ShimPath = fileURLToPath(new URL('../../node_modules/@bytecodealliance/preview2-shim', import.meta.url));
|
|
@@ -38,14 +38,15 @@ export async function run (componentPath, args) {
|
|
|
38
38
|
}
|
|
39
39
|
catch {}
|
|
40
40
|
let len = preview2ShimPath.length;
|
|
41
|
-
preview2ShimPath = resolve(preview2ShimPath, '
|
|
41
|
+
preview2ShimPath = resolve(preview2ShimPath, '..', '..', '..', 'node_modules', '@bytecodealliance', 'preview2-shim');
|
|
42
42
|
if (preview2ShimPath.length === len) {
|
|
43
|
-
|
|
44
|
-
return;
|
|
43
|
+
throw c`Unable to locate the {bold @bytecodealliance/preview2-shim} package, make sure it is installed.`;
|
|
45
44
|
}
|
|
46
45
|
}
|
|
47
46
|
|
|
48
|
-
|
|
47
|
+
const modulesDir = resolve(outDir, 'node_modules', '@bytecodealliance');
|
|
48
|
+
await mkdir(modulesDir, { recursive: true });
|
|
49
|
+
await symlink(preview2ShimPath, resolve(modulesDir, 'preview2-shim'), 'dir');
|
|
49
50
|
|
|
50
51
|
const runPath = resolve(outDir, '_run.js');
|
|
51
52
|
await writeFile(runPath, `
|
|
@@ -71,24 +72,17 @@ export async function run (componentPath, args) {
|
|
|
71
72
|
throw e;
|
|
72
73
|
}
|
|
73
74
|
`);
|
|
74
|
-
await chmod(runPath, 0o777);
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
process.exitCode = await new Promise((resolve, reject) => {
|
|
77
|
+
const cp = fork(runPath, args, { stdio: 'inherit' });
|
|
78
|
+
|
|
79
|
+
cp.on('error', reject);
|
|
80
|
+
cp.on('exit', resolve);
|
|
81
|
+
});
|
|
77
82
|
}
|
|
78
83
|
finally {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
} catch {}
|
|
83
|
-
}
|
|
84
|
+
try {
|
|
85
|
+
await rm(outDir, { recursive: true });
|
|
86
|
+
} catch {}
|
|
84
87
|
}
|
|
85
|
-
|
|
86
|
-
const exitCode = await new Promise((resolve, reject) => {
|
|
87
|
-
cp.on('error', reject);
|
|
88
|
-
cp.on('exit', resolve);
|
|
89
|
-
});
|
|
90
|
-
try {
|
|
91
|
-
await rm(outDir, { recursive: true });
|
|
92
|
-
} catch {}
|
|
93
|
-
exit(exitCode);
|
|
94
88
|
}
|
package/src/jco.js
CHANGED
|
@@ -11,7 +11,7 @@ program
|
|
|
11
11
|
.name('jco')
|
|
12
12
|
.description(c`{bold jco - WebAssembly JS Component Tools}\n JS Component Transpilation Bindgen & Wasm Tools for JS`)
|
|
13
13
|
.usage('<command> [options]')
|
|
14
|
-
.version('0.13.
|
|
14
|
+
.version('0.13.2');
|
|
15
15
|
|
|
16
16
|
function myParseInt(value) {
|
|
17
17
|
return parseInt(value, 10);
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
export namespace WasiFilesystemTypes020rc20231105 {
|
|
2
|
-
export { Descriptor };
|
|
3
|
-
export function filesystemErrorCode(err: Error): ErrorCode | undefined;
|
|
4
|
-
}
|
|
5
|
-
export type Filesize = bigint;
|
|
6
|
-
import type { InputStream } from '../interfaces/wasi-io-streams-0.2.0-rc-2023-11-05';
|
|
7
|
-
export { InputStream };
|
|
8
|
-
/**
|
|
9
|
-
* # Variants
|
|
10
|
-
*
|
|
11
|
-
* ## `"access"`
|
|
12
|
-
*
|
|
13
|
-
* ## `"would-block"`
|
|
14
|
-
*
|
|
15
|
-
* ## `"already"`
|
|
16
|
-
*
|
|
17
|
-
* ## `"bad-descriptor"`
|
|
18
|
-
*
|
|
19
|
-
* ## `"busy"`
|
|
20
|
-
*
|
|
21
|
-
* ## `"deadlock"`
|
|
22
|
-
*
|
|
23
|
-
* ## `"quota"`
|
|
24
|
-
*
|
|
25
|
-
* ## `"exist"`
|
|
26
|
-
*
|
|
27
|
-
* ## `"file-too-large"`
|
|
28
|
-
*
|
|
29
|
-
* ## `"illegal-byte-sequence"`
|
|
30
|
-
*
|
|
31
|
-
* ## `"in-progress"`
|
|
32
|
-
*
|
|
33
|
-
* ## `"interrupted"`
|
|
34
|
-
*
|
|
35
|
-
* ## `"invalid"`
|
|
36
|
-
*
|
|
37
|
-
* ## `"io"`
|
|
38
|
-
*
|
|
39
|
-
* ## `"is-directory"`
|
|
40
|
-
*
|
|
41
|
-
* ## `"loop"`
|
|
42
|
-
*
|
|
43
|
-
* ## `"too-many-links"`
|
|
44
|
-
*
|
|
45
|
-
* ## `"message-size"`
|
|
46
|
-
*
|
|
47
|
-
* ## `"name-too-long"`
|
|
48
|
-
*
|
|
49
|
-
* ## `"no-device"`
|
|
50
|
-
*
|
|
51
|
-
* ## `"no-entry"`
|
|
52
|
-
*
|
|
53
|
-
* ## `"no-lock"`
|
|
54
|
-
*
|
|
55
|
-
* ## `"insufficient-memory"`
|
|
56
|
-
*
|
|
57
|
-
* ## `"insufficient-space"`
|
|
58
|
-
*
|
|
59
|
-
* ## `"not-directory"`
|
|
60
|
-
*
|
|
61
|
-
* ## `"not-empty"`
|
|
62
|
-
*
|
|
63
|
-
* ## `"not-recoverable"`
|
|
64
|
-
*
|
|
65
|
-
* ## `"unsupported"`
|
|
66
|
-
*
|
|
67
|
-
* ## `"no-tty"`
|
|
68
|
-
*
|
|
69
|
-
* ## `"no-such-device"`
|
|
70
|
-
*
|
|
71
|
-
* ## `"overflow"`
|
|
72
|
-
*
|
|
73
|
-
* ## `"not-permitted"`
|
|
74
|
-
*
|
|
75
|
-
* ## `"pipe"`
|
|
76
|
-
*
|
|
77
|
-
* ## `"read-only"`
|
|
78
|
-
*
|
|
79
|
-
* ## `"invalid-seek"`
|
|
80
|
-
*
|
|
81
|
-
* ## `"text-file-busy"`
|
|
82
|
-
*
|
|
83
|
-
* ## `"cross-device"`
|
|
84
|
-
*/
|
|
85
|
-
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';
|
|
86
|
-
import type { OutputStream } from '../interfaces/wasi-io-streams-0.2.0-rc-2023-11-05';
|
|
87
|
-
export { OutputStream };
|
|
88
|
-
/**
|
|
89
|
-
* # Variants
|
|
90
|
-
*
|
|
91
|
-
* ## `"unknown"`
|
|
92
|
-
*
|
|
93
|
-
* ## `"block-device"`
|
|
94
|
-
*
|
|
95
|
-
* ## `"character-device"`
|
|
96
|
-
*
|
|
97
|
-
* ## `"directory"`
|
|
98
|
-
*
|
|
99
|
-
* ## `"fifo"`
|
|
100
|
-
*
|
|
101
|
-
* ## `"symbolic-link"`
|
|
102
|
-
*
|
|
103
|
-
* ## `"regular-file"`
|
|
104
|
-
*
|
|
105
|
-
* ## `"socket"`
|
|
106
|
-
*/
|
|
107
|
-
export type DescriptorType = 'unknown' | 'block-device' | 'character-device' | 'directory' | 'fifo' | 'symbolic-link' | 'regular-file' | 'socket';
|
|
108
|
-
export type LinkCount = bigint;
|
|
109
|
-
import type { Datetime } from '../interfaces/wasi-clocks-wall-clock-0.2.0-rc-2023-11-05';
|
|
110
|
-
export { Datetime };
|
|
111
|
-
export interface DescriptorStat {
|
|
112
|
-
type: DescriptorType,
|
|
113
|
-
linkCount: LinkCount,
|
|
114
|
-
size: Filesize,
|
|
115
|
-
dataAccessTimestamp?: Datetime,
|
|
116
|
-
dataModificationTimestamp?: Datetime,
|
|
117
|
-
statusChangeTimestamp?: Datetime,
|
|
118
|
-
}
|
|
119
|
-
export interface PathFlags {
|
|
120
|
-
symlinkFollow?: boolean,
|
|
121
|
-
}
|
|
122
|
-
export interface OpenFlags {
|
|
123
|
-
create?: boolean,
|
|
124
|
-
directory?: boolean,
|
|
125
|
-
exclusive?: boolean,
|
|
126
|
-
truncate?: boolean,
|
|
127
|
-
}
|
|
128
|
-
export interface DescriptorFlags {
|
|
129
|
-
read?: boolean,
|
|
130
|
-
write?: boolean,
|
|
131
|
-
fileIntegritySync?: boolean,
|
|
132
|
-
dataIntegritySync?: boolean,
|
|
133
|
-
requestedWriteSync?: boolean,
|
|
134
|
-
mutateDirectory?: boolean,
|
|
135
|
-
}
|
|
136
|
-
export interface Modes {
|
|
137
|
-
readable?: boolean,
|
|
138
|
-
writable?: boolean,
|
|
139
|
-
executable?: boolean,
|
|
140
|
-
}
|
|
141
|
-
export interface MetadataHashValue {
|
|
142
|
-
lower: bigint,
|
|
143
|
-
upper: bigint,
|
|
144
|
-
}
|
|
145
|
-
import type { Error } from '../interfaces/wasi-io-streams-0.2.0-rc-2023-11-05';
|
|
146
|
-
export { Error };
|
|
147
|
-
|
|
148
|
-
export class Descriptor {
|
|
149
|
-
readViaStream(offset: Filesize): InputStream;
|
|
150
|
-
writeViaStream(offset: Filesize): OutputStream;
|
|
151
|
-
appendViaStream(): OutputStream;
|
|
152
|
-
getType(): DescriptorType;
|
|
153
|
-
stat(): DescriptorStat;
|
|
154
|
-
openAt(pathFlags: PathFlags, path: string, openFlags: OpenFlags, flags: DescriptorFlags, modes: Modes): Descriptor;
|
|
155
|
-
metadataHash(): MetadataHashValue;
|
|
156
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export namespace WasiIoStreams020rc20231105 {
|
|
2
|
-
export { InputStream };
|
|
3
|
-
export { OutputStream };
|
|
4
|
-
}
|
|
5
|
-
export type StreamError = StreamErrorLastOperationFailed | StreamErrorClosed;
|
|
6
|
-
export interface StreamErrorLastOperationFailed {
|
|
7
|
-
tag: 'last-operation-failed',
|
|
8
|
-
val: Error,
|
|
9
|
-
}
|
|
10
|
-
export interface StreamErrorClosed {
|
|
11
|
-
tag: 'closed',
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export class InputStream {
|
|
15
|
-
read(len: bigint): Uint8Array;
|
|
16
|
-
blockingRead(len: bigint): Uint8Array;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export class OutputStream {
|
|
20
|
-
checkWrite(): bigint;
|
|
21
|
-
write(contents: Uint8Array): void;
|
|
22
|
-
blockingWriteAndFlush(contents: Uint8Array): void;
|
|
23
|
-
blockingFlush(): void;
|
|
24
|
-
}
|