Closed Michael-F-Bryan closed 2 years ago
I've updated this to use the wasmer/wabt
package from wapm.io on my computer, but it looks like I've lost write access to the repo. @syrusakbary can you add me to the repo again?
Also, how do I test this?
npm run test
should test things locally @Michael-F-Bryan
It currently fails:
➜ vscode-wasm git:(generated-bindings) npm run test
> vscode-wasm@1.3.1 test
> npm run compile && node ./node_modules/vscode/bin/test
> vscode-wasm@1.3.1 compile
> tsc -p ./
node_modules/@wasmer/wabt/src/bindings/bindings/bindings.d.ts:22:13 - error TS2503: Cannot find namespace 'WebAssembly'.
22 instance: WebAssembly.Instance;
~~~~~~~~~~~
node_modules/@wasmer/wabt/src/bindings/bindings/bindings.d.ts:79:11 - error TS2503: Cannot find namespace 'WebAssembly'.
79 module: WebAssembly.Module | BufferSource | Promise<Response> | Response | WebAssembly.Instance,
~~~~~~~~~~~
node_modules/@wasmer/wabt/src/bindings/bindings/bindings.d.ts:79:32 - error TS2304: Cannot find name 'BufferSource'.
79 module: WebAssembly.Module | BufferSource | Promise<Response> | Response | WebAssembly.Instance,
~~~~~~~~~~~~
node_modules/@wasmer/wabt/src/bindings/bindings/bindings.d.ts:79:55 - error TS2304: Cannot find name 'Response'.
79 module: WebAssembly.Module | BufferSource | Promise<Response> | Response | WebAssembly.Instance,
~~~~~~~~
node_modules/@wasmer/wabt/src/bindings/bindings/bindings.d.ts:79:67 - error TS2304: Cannot find name 'Response'.
79 module: WebAssembly.Module | BufferSource | Promise<Response> | Response | WebAssembly.Instance,
~~~~~~~~
node_modules/@wasmer/wabt/src/bindings/bindings/bindings.d.ts:79:78 - error TS2503: Cannot find namespace 'WebAssembly'.
79 module: WebAssembly.Module | BufferSource | Promise<Response> | Response | WebAssembly.Instance,
~~~~~~~~~~~
node_modules/@wasmer/wabt/src/bindings/index.d.ts:3:10 - error TS2440: Import declaration conflicts with local declaration of 'Bindings'.
3 import { Bindings } from "./bindings/bindings";
~~~~~~~~
node_modules/@wasmer/wabt/src/bindings/index.d.ts:3:10 - error TS2652: Merged declaration 'Bindings' cannot include a default export declaration. Consider adding a separate 'export default Bindings' declaration instead.
3 import { Bindings } from "./bindings/bindings";
~~~~~~~~
node_modules/@wasmer/wabt/src/bindings/index.d.ts:10:14 - error TS2503: Cannot find namespace 'WebAssembly'.
10 imports: WebAssembly.Imports,
~~~~~~~~~~~
node_modules/@wasmer/wabt/src/bindings/index.d.ts:15:13 - error TS2503: Cannot find namespace 'WebAssembly'.
15 module: WebAssembly.Module,
~~~~~~~~~~~
node_modules/@wasmer/wabt/src/bindings/index.d.ts:25:22 - error TS2652: Merged declaration 'Bindings' cannot include a default export declaration. Consider adding a separate 'export default Bindings' declaration instead.
25 export default class Bindings {
~~~~~~~~
node_modules/@wasmer/wabt/src/index.d.ts:14:29 - error TS2503: Cannot find namespace 'WebAssembly'.
14 imports: Record<string, WebAssembly.ModuleImports>,
~~~~~~~~~~~
node_modules/@wasmer/wabt/src/index.d.ts:19:13 - error TS2503: Cannot find namespace 'WebAssembly'.
19 module: WebAssembly.Module,
~~~~~~~~~~~
Found 13 errors.
I've added the "dom" lib to the lib
field inside of tsconfig.json
.
And then we got other error:
➜ vscode-wasm git:(generated-bindings) npm run test
> vscode-wasm@1.3.1 test
> npm run compile && node ./node_modules/vscode/bin/test
> vscode-wasm@1.3.1 compile
> tsc -p ./
node_modules/@wasmer/wabt/src/bindings/index.d.ts:3:10 - error TS2440: Import declaration conflicts with local declaration of 'Bindings'.
3 import { Bindings } from "./bindings/bindings";
~~~~~~~~
node_modules/@wasmer/wabt/src/bindings/index.d.ts:3:10 - error TS2652: Merged declaration 'Bindings' cannot include a default export declaration. Consider adding a separate 'export default Bindings' declaration instead.
3 import { Bindings } from "./bindings/bindings";
~~~~~~~~
node_modules/@wasmer/wabt/src/bindings/index.d.ts:25:22 - error TS2652: Merged declaration 'Bindings' cannot include a default export declaration. Consider adding a separate 'export default Bindings' declaration instead.
25 export default class Bindings {
~~~~~~~~
Found 3 errors.
After fixing the file manually importing Bindings as BaseBindings
I got things compiling:
// @ts-ignore
import { Wasi } from "@wasmer/wasi";
import { Bindings as BaseBindings } from "./bindings/bindings";
/**
* Options used when initializing the bindings.
*/
export type LoadOptions = {
/** Additional imports to be provided to the WebAssembly module */
imports: WebAssembly.Imports,
/**
* A user-specified WebAssembly module to use instead of the one bundled
* with this package.
*/
module: WebAssembly.Module,
};
/**
* Extended options used when loading a WASI library.
*/
export type WasiLoadOptions = LoadOptions & {
/** An initialized `@wasmer/wasi` object. */
wasi: Wasi,
};
export default class Bindings {
bindings(options?: Partial<WasiLoadOptions>): Promise<BaseBindings>;
}
The npm run test
command currently fails because we've got no test/
directory. I'm assuming that just means someone deleted the repo's tests in the past. I'm inclined to merge this as it is now because everything builds, and I'll fix #41 in a separate PR.
This is waiting on https://github.com/wasmerio/wapm.io-backend/issues/240.