bytecodealliance / ComponentizeJS

JS -> WebAssembly Component
Apache License 2.0
242 stars 32 forks source link

Documentation disagrees with itself #97

Closed whitequark closed 7 months ago

whitequark commented 8 months ago

In the Usage section, componentize is a 3-argument function.

In the API section, componentize is a 2-argument function.

In the example, componentize is a 2-argument function but the types are different from the previous case.

Also it looks like enableStdout might no longer exist?

guybedford commented 8 months ago

All three are correct believe it or not, thanks to the magic of JavaScript. Signatures are:

function componentize(source: string, opts: ComponentizeOptions)
function componentize(source: string, witWorld: string, opts: ComponentizeOptions)
function componentize(source: string, witWorld: string)

We should certainly add a TypeScript type at some point if it would be useful.

Yes enableStdout was replaced with disableFeatures: ['stdio'] is it still referenced somewhere?

whitequark commented 8 months ago

All three are correct believe it or not, thanks to the magic of JavaScript.

I think the complete signature or signatures should be referenced at least somewhere.

We should certainly add a TypeScript type at some point if it would be useful.

Yeah, I use TypeScript.

Yes enableStdout was replaced with disableFeatures: ['stdio'] is it still referenced somewhere?

In the Usage section, yes.

guybedford commented 8 months ago

Thanks for calling this out, added an update in https://github.com/bytecodealliance/ComponentizeJS/pull/98.