@bytecodealliance/jco 0.9.4 → 0.9.5
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/README.md +4 -0
- package/obj/{imports → interfaces}/environment.d.ts +1 -1
- package/obj/{imports → interfaces}/exit.d.ts +1 -1
- package/obj/{imports → interfaces}/filesystem.d.ts +4 -4
- package/obj/interfaces/preopens.d.ts +5 -0
- package/obj/{imports → interfaces}/random.d.ts +1 -1
- package/obj/interfaces/stderr.d.ts +5 -0
- package/obj/interfaces/stdin.d.ts +5 -0
- package/obj/interfaces/stdout.d.ts +5 -0
- package/obj/{imports → interfaces}/streams.d.ts +1 -1
- package/obj/{imports → interfaces}/wall-clock.d.ts +1 -1
- package/obj/js-component-bindgen-component.core.wasm +0 -0
- package/obj/js-component-bindgen-component.d.ts +10 -10
- package/obj/wasm-tools.core.wasm +0 -0
- package/obj/wasm-tools.d.ts +10 -10
- package/package.json +1 -1
- package/src/cmd/transpile.js +1 -1
- package/obj/exports/test.d.ts +0 -3
- package/obj/imports/preopens.d.ts +0 -5
- package/obj/imports/stderr.d.ts +0 -5
- package/obj/imports/stdin.d.ts +0 -5
- package/obj/imports/stdout.d.ts +0 -5
package/README.md
CHANGED
|
@@ -103,6 +103,10 @@ Options include:
|
|
|
103
103
|
* `--instantiation`: Instead of a direct ES module, export an `instantiate` function which can take the imports as an argument instead of implicit imports.
|
|
104
104
|
* `--valid-lifting-optimization`: Internal validations are removed assuming that core Wasm binaries are valid components, providing a minor output size saving.
|
|
105
105
|
|
|
106
|
+
#### Bindgen Crate
|
|
107
|
+
|
|
108
|
+
To directly call into the transpilation in Rust, the bindgen used in jco is also available on crates.io as [js-component-bindgen](https://crates.io/crates/js-component-bindgen).
|
|
109
|
+
|
|
106
110
|
### Componentize
|
|
107
111
|
|
|
108
112
|
To componentize a JS file run:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export namespace
|
|
1
|
+
export namespace Filesystem {
|
|
2
2
|
export function readViaStream(this: Descriptor, offset: Filesize): InputStream;
|
|
3
3
|
export function writeViaStream(this: Descriptor, offset: Filesize): OutputStream;
|
|
4
4
|
export function appendViaStream(this: Descriptor): OutputStream;
|
|
@@ -10,7 +10,7 @@ export namespace ImportsFilesystem {
|
|
|
10
10
|
}
|
|
11
11
|
export type Descriptor = number;
|
|
12
12
|
export type Filesize = bigint;
|
|
13
|
-
import type { InputStream } from '../
|
|
13
|
+
import type { InputStream } from '../interfaces/wasi-io-streams';
|
|
14
14
|
export { InputStream };
|
|
15
15
|
/**
|
|
16
16
|
* # Variants
|
|
@@ -90,7 +90,7 @@ export { InputStream };
|
|
|
90
90
|
* ## `"cross-device"`
|
|
91
91
|
*/
|
|
92
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 '../
|
|
93
|
+
import type { OutputStream } from '../interfaces/wasi-io-streams';
|
|
94
94
|
export { OutputStream };
|
|
95
95
|
/**
|
|
96
96
|
* # Variants
|
|
@@ -115,7 +115,7 @@ export type DescriptorType = 'unknown' | 'block-device' | 'character-device' | '
|
|
|
115
115
|
export type Device = bigint;
|
|
116
116
|
export type Inode = bigint;
|
|
117
117
|
export type LinkCount = bigint;
|
|
118
|
-
import type { Datetime } from '../
|
|
118
|
+
import type { Datetime } from '../interfaces/wasi-clocks-wall-clock';
|
|
119
119
|
export { Datetime };
|
|
120
120
|
export interface DescriptorStat {
|
|
121
121
|
device: Device,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export namespace
|
|
1
|
+
export namespace Streams {
|
|
2
2
|
export function read(this: InputStream, len: bigint): [Uint8Array | ArrayBuffer, boolean];
|
|
3
3
|
export function blockingRead(this: InputStream, len: bigint): [Uint8Array | ArrayBuffer, boolean];
|
|
4
4
|
export function dropInputStream(this: InputStream): void;
|
|
Binary file
|
|
@@ -44,16 +44,16 @@ export interface Transpiled {
|
|
|
44
44
|
imports: string[],
|
|
45
45
|
exports: [string, ExportType][],
|
|
46
46
|
}
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
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';
|
|
57
57
|
export function generate(component: Uint8Array | ArrayBuffer, options: GenerateOptions): Transpiled;
|
|
58
58
|
export function generateTypes(name: string, options: TypeGenerationOptions): Files;
|
|
59
59
|
|
package/obj/wasm-tools.core.wasm
CHANGED
|
Binary file
|
package/obj/wasm-tools.d.ts
CHANGED
|
@@ -32,16 +32,16 @@ export interface EmbedOpts {
|
|
|
32
32
|
world?: string,
|
|
33
33
|
metadata?: ProducersFields,
|
|
34
34
|
}
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
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';
|
|
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
package/src/cmd/transpile.js
CHANGED
|
@@ -79,7 +79,7 @@ async function wasm2Js (source) {
|
|
|
79
79
|
*/
|
|
80
80
|
export async function transpileComponent (component, opts = {}) {
|
|
81
81
|
await $init;
|
|
82
|
-
if (opts.noWasiShim) opts.wasiShim = false;
|
|
82
|
+
if (opts.noWasiShim || opts.instantiation) opts.wasiShim = false;
|
|
83
83
|
|
|
84
84
|
let spinner;
|
|
85
85
|
const showSpinner = getShowSpinner();
|
package/obj/exports/test.d.ts
DELETED
package/obj/imports/stderr.d.ts
DELETED
package/obj/imports/stdin.d.ts
DELETED