browserify / browserify/rustify

Should we register modules directly?

オープン
#4 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
enhancement
主要言語
JavaScript
スター
491
フォーク
6
PR マージ指標
30日以内にマージされた PR はありません

説明

I was thinking: perhaps it would make sense to register modules directly?

E.g. turn this:
```js
var rust = require('rustify')

var wasm = rust`
#[no_mangle]
pub fn add_one(x: i32) -> i32 {
x + 1
}
`

WebAssembly.instantiate(wasm, {})
.then(function (res) {
var addOne = res.instance.exports.add_one
console.log(addOne(41))
console.log(addOne(68))
}).catch(function (e) {
console.error('Creating WASM module failed', e)
})
```
Into this:
```js
var rust = require('rustify')

var wasm = rust`
#[no_mangle]
pub fn add_one(x: i32) -> i32 {
x + 1
}
`

wasm.then((mod) => {
console.log(mod.add_one(41))
console.log(mod.add_one(68))
}).catch((e) => console.error('WASM error', e))
```

The benefit is that there's way less code to remember (ugh, `res.instance.exports`). The downside is that we're no long just exposing a Uint8Array, so doing things like registering a function twice is not going to be possible.

Would this be worth it?

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

まず、issue にある現在の API 例と提案された API 例を比較し、rustify の変換エントリーポイントを調べます。payload にはファイルもテストも記載されておらず、プロジェクトがモジュールの直接登録を望ましいインターフェースとするかどうかを決定し、その動作を定義するまで、作業は完了しません。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, rust, wasm
領域
tooling
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。