-
Notifications
You must be signed in to change notification settings - Fork 252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Npm package support #1522
Comments
Thanks for the report! I think it would be reasonable to have this, but I suspect that most folks working on wasm-tools probably don't have a lot of experience doing this. What I might recommend architecture-wise is perhaps a dog-food of jco where jco is used to create the JS package to publish. That being said I don't really know how best to do that myself. Would be nice to have though! |
Thanks for the reply, first time I heard about the jco project, but after taking a look, I found that it doesn't meet my needs. The brower api of jco is different from the node api. I need a parse api that can be consistent on node and web, like this: import { parse } from '@xwat/wasm-tools';
import { expect, test } from 'vitest';
import { code } from '../src/code';
test('parse', () => {
const buffer = parse(code);
const wasmModule = new WebAssembly.Module(buffer);
const instance = new WebAssembly.Instance(wasmModule);
const { add } = instance.exports as any;
expect(add(1, 2)).toBe(3);
}); |
Oh sure yeah, it's not necessarily required to use jco, but I think that using jco would work well in conjunction with the In any case if you've already got something working I think that's a great start! Would you be interested in sending a PR with your work? |
I need a tool that converts wat to wasm with full platform support, and am looking for alternative libraries since it's more rust oriented. jco's current web api exports only two functions export async function transpile () {
await $init;
return generate.apply(this, arguments);
}
export async function generateTypes () {
await $init;
return _generateTypes.apply(this, arguments);
} I haven't figured out the best practices yet, such as the distinction between synchronous and asynchronous api's, and how to handle wasm-pack output.
I don't need the wasi functionality at the moment, so jco is a bit too heavy for me, thanks for recommending jco, a lot of stuff in there is very inspiring to me! |
Oh I apologize I think I may have caused some confusion. I forgot that jco actually largely does what this issue reports, providing JS bindings to the library functionality in this repository. I was actually talking about a different part of jco, which is where there's some confusion. Let me try to clarify.
So if you'd like I think it'd be best to open an issue on jco's issue tracker for better running on the web? |
I've posted bytecodealliance/jco#435 here. It would be nice to provide a better wrapping I agree, although at this point it would likely be a major change so we should make this in the next major. |
It seems to be done bytecodealliance/jco#435 . Thanks, guys |
Would you consider releasing npm packages?
Similar to https://www.npmjs.com/package/wabt
The text was updated successfully, but these errors were encountered: