Skip to content

Commit

Permalink
0.11.1
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Sep 4, 2023
1 parent 6c6f681 commit 85c9568
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 53 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bytecodealliance/jco",
"version": "0.11.0",
"version": "0.11.1",
"description": "JavaScript tooling for working with WebAssembly Components",
"author": "Guy Bedford",
"bin": {
Expand All @@ -18,7 +18,7 @@
},
"type": "module",
"dependencies": {
"@bytecodealliance/preview2-shim": "0.0.13",
"@bytecodealliance/preview2-shim": "0.0.14",
"binaryen": "^111.0.0",
"chalk-template": "^0.4.0",
"commander": "^9.4.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/preview2-shim/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bytecodealliance/preview2-shim",
"version": "0.0.13",
"version": "0.0.14",
"description": "WASI Preview2 shim for JS environments",
"author": "Guy Bedford, Eduardo Rodrigues<16357187+eduardomourar@users.noreply.github.com>",
"type": "module",
Expand Down
52 changes: 27 additions & 25 deletions packages/preview2-shim/types/exports/wasi-poll-poll.d.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,39 @@
export namespace WasiPollPoll {
export { Pollable };
/**
* Dispose of the specified `pollable`, after which it may no longer
* be used.
*/
export function dropPollable(this_: Pollable): void;
/**
* Poll for completion on a set of pollables.
*
* This function takes a list of pollables, which identify I/O sources of
* interest, and waits until one or more of the events is ready for I/O.
*
* The result `list<bool>` is the same length as the argument
* `list<pollable>`, and indicates the readiness of each corresponding
* element in that list, with true indicating ready. A single call can
* return multiple true elements.
*
* A timeout can be implemented by adding a pollable from the
* wasi-clocks API to the list.
*
* This function does not return a `result`; polling in itself does not
* do any I/O so it doesn't fail. If any of the I/O sources identified by
* the pollables has an error, it is indicated by marking the source as
* ready in the `list<bool>`.
*
* The "oneoff" in the name refers to the fact that this function must do a
* linear scan through the entire list of subscriptions, which may be
* inefficient if the number is large and the same subscriptions are used
* many times. In the future, this is expected to be obsoleted by the
* component model async proposal, which will include a scalable waiting
* facility.
*
* The result list<bool> is the same length as the argument
* list<pollable>, and indicates the readiness of each corresponding
* element in that / list, with true indicating ready.
*/
export function pollOneoff(in_: Pollable[]): boolean[];
}

export class Pollable {
constructor(init: Uint8Array | ArrayBuffer)
write(bytes: Uint8Array | ArrayBuffer): void;
read(n: number): Uint8Array;
static merge(lhs: Pollable, rhs: Pollable): Pollable;
export function pollOneoff(in_: Uint32Array): boolean[];
}
/**
* A "pollable" handle.
*
* This is conceptually represents a `stream<_, _>`, or in other words,
* a stream that one can wait on, repeatedly, but which does not itself
* produce any data. It's temporary scaffolding until component-model's
* async features are ready.
*
* And at present, it is a `u32` instead of being an actual handle, until
* the wit-bindgen implementation of handles and resources is ready.
*
* `pollable` lifetimes are not automatically managed. Users must ensure
* that they do not outlive the resource they reference.
*
* This [represents a resource](https://github.com/WebAssembly/WASI/blob/main/docs/WitInWasi.md#Resources).
*/
export type Pollable = number;
52 changes: 27 additions & 25 deletions packages/preview2-shim/types/imports/wasi-poll-poll.d.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,39 @@
export namespace WasiPollPoll {
export { Pollable };
/**
* Dispose of the specified `pollable`, after which it may no longer
* be used.
*/
export function dropPollable(this_: Pollable): void;
/**
* Poll for completion on a set of pollables.
*
* This function takes a list of pollables, which identify I/O sources of
* interest, and waits until one or more of the events is ready for I/O.
*
* The result `list<bool>` is the same length as the argument
* `list<pollable>`, and indicates the readiness of each corresponding
* element in that list, with true indicating ready. A single call can
* return multiple true elements.
*
* A timeout can be implemented by adding a pollable from the
* wasi-clocks API to the list.
*
* This function does not return a `result`; polling in itself does not
* do any I/O so it doesn't fail. If any of the I/O sources identified by
* the pollables has an error, it is indicated by marking the source as
* ready in the `list<bool>`.
*
* The "oneoff" in the name refers to the fact that this function must do a
* linear scan through the entire list of subscriptions, which may be
* inefficient if the number is large and the same subscriptions are used
* many times. In the future, this is expected to be obsoleted by the
* component model async proposal, which will include a scalable waiting
* facility.
*
* The result list<bool> is the same length as the argument
* list<pollable>, and indicates the readiness of each corresponding
* element in that / list, with true indicating ready.
*/
export function pollOneoff(in_: Pollable[]): boolean[];
}

export class Pollable {
constructor(init: Uint8Array)
write(bytes: Uint8Array): void;
read(n: number): Uint8Array | ArrayBuffer;
static merge(lhs: Pollable, rhs: Pollable): Pollable;
export function pollOneoff(in_: Uint32Array): boolean[];
}
/**
* A "pollable" handle.
*
* This is conceptually represents a `stream<_, _>`, or in other words,
* a stream that one can wait on, repeatedly, but which does not itself
* produce any data. It's temporary scaffolding until component-model's
* async features are ready.
*
* And at present, it is a `u32` instead of being an actual handle, until