Skip to content

Commit

Permalink
Merge pull request wasmerio#299 from wasmerio/wasmer-3
Browse files Browse the repository at this point in the history
Adapted API to Wasmer 3.0
  • Loading branch information
syrusakbary authored Aug 30, 2022
2 parents f25d523 + e5bc2fc commit 259e9e9
Show file tree
Hide file tree
Showing 9 changed files with 783 additions and 509 deletions.
363 changes: 228 additions & 135 deletions Cargo.lock

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ crate-type = ["cdylib"]
[dependencies]
js-sys = "0.3.55"
wasm-bindgen = "0.2.73"
wasm-bindgen-futures = "0.4.28"
wasmer = { path = "../wasmer/lib/api", default-features = false, features = ["js-default"] }
wasmer = { path = "../wasmer/lib/api", default-features = false, features = ["js", "std"] }
wasmer-wasi = { path = "../wasmer/lib/wasi", default-features = false, features = ["js"] }
wasmer-vfs = { path = "../wasmer/lib/vfs", default-features = false, features = ["mem-fs"] }

[profile.release]
lto = true
opt-level = 'z'
39 changes: 23 additions & 16 deletions pkg/wasmer_wasi_js.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,23 @@ export class WASI {
*/
constructor(config: any);
/**
* @param {WebAssembly.Module} module
* @returns {object}
*/
get_imports(module: WebAssembly.Module): object;
/**
* @param {any} module
* @param {object} imports
* @param {object | undefined} imports
* @returns {WebAssembly.Instance}
*/
instantiate(module: any, imports: object): WebAssembly.Instance;
instantiate(module: any, imports?: object): WebAssembly.Instance;
/**
* Start the WASI Instance, it returns the status code when calling the start
* function
* @param {WebAssembly.Instance} instance
* @returns {number}
*/
start(): number;
start(instance: WebAssembly.Instance): number;
/**
* Get the stdout buffer
* Note: this method flushes the stdout
Expand Down Expand Up @@ -163,6 +169,19 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl

export interface InitOutput {
readonly memory: WebAssembly.Memory;
readonly __wbg_wasmerruntimeerror_free: (a: number) => void;
readonly __wbg_wasi_free: (a: number) => void;
readonly wasi_new: (a: number) => number;
readonly wasi_fs: (a: number) => number;
readonly wasi_get_imports: (a: number, b: number) => number;
readonly wasi_instantiate: (a: number, b: number, c: number) => number;
readonly wasi_start: (a: number, b: number) => number;
readonly wasi_getStdoutBuffer: (a: number, b: number) => void;
readonly wasi_getStdoutString: (a: number, b: number) => void;
readonly wasi_getStderrBuffer: (a: number, b: number) => void;
readonly wasi_getStderrString: (a: number, b: number) => void;
readonly wasi_setStdinBuffer: (a: number, b: number, c: number) => void;
readonly wasi_setStdinString: (a: number, b: number, c: number) => void;
readonly __wbg_memfs_free: (a: number) => void;
readonly memfs_new: () => number;
readonly memfs_readDir: (a: number, b: number, c: number) => number;
Expand All @@ -184,24 +203,12 @@ export interface InitOutput {
readonly jsvirtualfile_writeString: (a: number, b: number, c: number) => number;
readonly jsvirtualfile_flush: (a: number) => void;
readonly jsvirtualfile_seek: (a: number, b: number) => number;
readonly __wbg_wasi_free: (a: number) => void;
readonly wasi_new: (a: number) => number;
readonly wasi_fs: (a: number) => number;
readonly wasi_instantiate: (a: number, b: number, c: number) => number;
readonly wasi_start: (a: number) => number;
readonly wasi_getStdoutBuffer: (a: number, b: number) => void;
readonly wasi_getStdoutString: (a: number, b: number) => void;
readonly wasi_getStderrBuffer: (a: number, b: number) => void;
readonly wasi_getStderrString: (a: number, b: number) => void;
readonly wasi_setStdinBuffer: (a: number, b: number, c: number) => void;
readonly wasi_setStdinString: (a: number, b: number, c: number) => void;
readonly __wbg_wasmerruntimeerror_free: (a: number) => void;
readonly __wbindgen_malloc: (a: number) => number;
readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
readonly __wbindgen_export_2: WebAssembly.Table;
readonly __wbindgen_exn_store: (a: number) => void;
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
readonly __wbindgen_free: (a: number, b: number) => void;
readonly __wbindgen_exn_store: (a: number) => void;
}

/**
Expand Down
Loading

0 comments on commit 259e9e9

Please sign in to comment.