Supporting a 'wasm:' prefix on imports

Đang mở
#297 23 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
javascript, wasm
Lĩnh vực
tooling

Hướng nghiên cứu

Bắt đầu bằng việc đọc phần thảo luận của issue ComponentizeJS và lần theo cách các JavaScript imports được hiển thị được xử lý, bao gồm cả những thay đổi được mô tả là nằm phía trên và phía dưới ComponentizeJS. Công việc chỉ hoàn tất sau khi cộng đồng thống nhất về một tiền tố và dạng được chọn hoạt động xuyên suốt cho các component imports của WASI hoặc WebAssembly.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

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:

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, 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.

Ngôn ngữ chính
Rust
Star
392
Fork
54
Merge trung bình
2 ngày 18 giờ
Pull request đã merge (30 ngày)
3

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của bytecodealliance/ComponentizeJS

Tất cả issue của bytecodealliance/ComponentizeJS

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.