Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[RFC]: add `@stdlib/wasm/instantiate`

Aperta
#14,208 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@0PrashantYadav0 ci sta già lavorando.

Dal 12/8/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

Accepted Feature RFC WebAssembly
Description

This RFC proposes to add @stdlib/wasm/instantiate

Findings

@stdlib/wasm/module-wrapper still calls platform globals for compilation and instantiation. Async paths use WebAssembly.instantiate; sync paths use WebAssembly.Module and WebAssembly.Instance. Those TODOs point at @stdlib/wasm/instantiate (and related packages).

The existing @stdlib/wasm/memory package is the right pattern: feature-detect with @stdlib/assert/has-wasm-support, export a strict native alias when supported, otherwise a polyfill that throws not implemented. @stdlib/wasm/instantiate should follow that same shape, except the export is a function (not a constructor).

@stdlib/promise/ctor (with polyfill) already under review in #14140 and will be used by module-wrapper for initialize(). That item is done and is not part of this work.

WebAssembly.instantiate and new WebAssembly.Instance(...) are different APIs. The TODOs map both names to @stdlib/wasm/instantiate, but they should stay separate: instantiate for the async function, and a later @stdlib/wasm/instance for the sync constructor (same idea as memory / module).

Native instantiate has two overloads that must pass through unchanged:

  • bytes → Promise<{ module, instance }>
  • compiled module → Promise<Instance>

Future plan

  1. Ship @stdlib/wasm/instantiate as a thin alias of WebAssembly.instantiate (package, tests, docs, namespace export). Done.
  2. Add @stdlib/wasm/module for WebAssembly.Module.
  3. Add @stdlib/wasm/instance for WebAssembly.Instance.
  4. Update module-wrapper to use the new packages and remove the remaining TODOs.
  5. Optionally extract PAGE_SIZE to @stdlib/constants/wasm/page-size.
Related Issues

Related PR #14140

Questions

No.

Other

No.

Checklist
  • I have read and understood the Code of Conduct.
  • Searched for existing issues and pull requests.
  • The issue name begins with RFC:.
Lingua principale
JavaScript
Stelle
6k
Fork
1.3k
Merge medio
1g 3h
PR unite (30g)
585

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di stdlib-js/stdlib

Tutte le issue di stdlib-js/stdlib

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.