-
Notifications
You must be signed in to change notification settings - Fork 412
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
Decide on --target deno
package structure for JSR
#1454
Comments
This depends on rustwasm/wasm-bindgen#4287 |
--target deno
pack & publish--target deno
package structure for JSR
@dsherret thanks! I updated this issue to be more scoped on the the JSR question to avoid duplication of the discussion in the wasm-bindgen repo 👍 |
I don't think the files that get generated are the problem. IIRC, wasm-bindgen can do some nice translation of types from WASM types to JS types, like IMO the main bug here is that
const wasm_url = new URL('wasm_box_bg.wasm', import.meta.url);
let wasmCode = '';
switch (wasm_url.protocol) {
case 'file:':
wasmCode = await Deno.readFile(wasm_url);
break
case 'https:':
case 'http:':
wasmCode = await (await fetch(wasm_url)).arrayBuffer();
break
default:
throw new Error(`Unsupported protocol: ${wasm_url.protocol}`);
} … which will require But import * as wasm from "./wasm_box_bg.wasm"; As a workaround, until |
💡 Feature description
Deno support was added by #1117. Currently, if you use
wasm-pack build --target deno
, it will generate the following filesHowever, as of Deno 2.1, you can now run
.wasm
files directly (and get type safety for them as well), so these files are possibly redundant (depending on if/how Deno adds support for non-numeric types coming from WASM)This leads to a question: what files do we need, and how should they be structured to be published on a package manager (notably JSR)
💻 Basic example
I think probably the only code that needs to be generated now are three things:
project-name.wasm
(generated the same way as before)jsr.json
Defining the JSR format for this case
For the JSR file, I think the only content required is this:
but I opened an issue on JSR (jsr-io/jsr#858) to make sure there is agreement on what this
jsr.json
should look likeClarity around non-numeric types
This issue is primarily around package generation, but you can find the related issue around binding generation here: rustwasm/wasm-bindgen#4287
The text was updated successfully, but these errors were encountered: