bytecodealliance / bytecodealliance/ComponentizeJS

Supporting a 'wasm:' prefix on imports

Aberta
#297 23 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
Rust
Estrelas
391
Forks
53
Merge médio
3d 5h
PRs com merge (30d)
1

Descrição

Right now, code that uses imports via WASI look like regular imports, with the package name being the first indicator:

```js
import { someFn } from "ns:pkg/iface@0.1.0";

export const run = {
run() { ... }
}
```

This works, but I think going forward life for embedders and tooling/ecosystem projects will be *much* easier if we prefix these imports with `wasi:` (or something similar) to note them/control how the imports are done.

The idea is that the above code would turn into:

```js
import { someFn } from "wasi:ns:pkg/iface@0.1.0";

export const run = {
run() { ... }
}
```

There are other ways to indicate the type of an import/control (i.e. [import attributes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import/with), for example) , but prefixing with `wasi:` is incredibly simple and offers a point of leverage -- being able to easily tell which imports are "wasi"/underlying paltform imports. This mirrors the convention of `node:` as an import prefix which is used in more modern code bases (i.e. `from "node:fs"` rather than `from "fs"`).

Changes may be required "below" *and* "above" componentize JS to make this work, but I figure that ComponentizeJS is a good place to discuss and eventually start this work.

[EDIT] I changed the title to `wasm` since `wasi` is clearly not the right prefix -- `wasm:`, `wit:`, `component:` or something else are clearly more correct, though it's not *exactly* clear which is best.

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Direção de pesquisa

Comece lendo a discussão da issue do ComponentizeJS e acompanhando como os imports de JavaScript mostrados são tratados, incluindo as alterações descritas como estando acima e abaixo do ComponentizeJS. O trabalho só estará concluído quando a comunidade concordar com um prefixo e a forma escolhida funcionar de ponta a ponta para imports de componentes WASI ou WebAssembly.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
javascript, wasm
Domínio
tooling
Tipo de issue
Funcionalidade
Dificuldade
5/5
Tempo estimado
Mais de uma semana
Status de atividade
Estagnada
Clareza
Precisa de esclarecimento
Facilidade para iniciantes
25/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.