Skip to content

Decide on --target deno package structure for JSR #1454

Open
@SebastienGllmt

Description

@SebastienGllmt

💡 Feature description

Deno support was added by #1117. Currently, if you use wasm-pack build --target deno, it will generate the following files

project-name.wasm
project-name.wasm.d.ts
project-name.js
project-name.d.ts

However, 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:

  1. project-name.wasm (generated the same way as before)
  2. jsr.json
  3. (maybe?) some extra glue for non-numeric types

Defining the JSR format for this case

For the JSR file, I think the only content required is this:

{
  "name": "@my-namespace/my-project",
  "version": "1.0.0",
  "exports": {
    ".": "./project-name.wasm"
  },
  "publish": {
    "include": [
      "project-name.wasm",
      "jsr.json"
    ]
  }
}

but I opened an issue on JSR (jsr-io/jsr#858) to make sure there is agreement on what this jsr.json should look like

Clarity 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions