Compile JavaScript to WASM with no networking involved - just reading STDIN and writing to STDOUT

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

Maintainer thường phản hồi trong vòng 1 ngày

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
30/100
Loại issue
Tài liệu
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Ít trao đổi
Công nghệ
javascript, wasm
Lĩnh vực
cli, compilers

Hướng nghiên cứu

Bắt đầu bằng cách đọc tài liệu StarlingMonkey và các entry point của starling.wasm và starling-raw.wasm, sau đó theo dõi cách WIT và đầu vào/đầu ra tiêu chuẩn được exposed. Hoàn tất nghĩa là đã tài liệu hóa các interface I/O được triển khai, WIT tối thiểu và một đường dẫn biên dịch không cần mạng cho JavaScript tổng quát; issue không nêu test hay tệp nguồn nào.

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

Mô tả

I've built Native Messaging hosts using several JavaScript to WASM toolchains, or just executed the WASM inside of the JavaScript engine compiled to WASM in the case of QuickJS.

Here's the protocol and documentation published by Chrome, MDN, Edge, Opera, Safari https://github.com/guest271314/NativeMessagingHosts#native-messaging-documentation. In pertinent part

Chrome starts each native messaging host in a separate process and communicates with it using standard input (stdin) and standard output (stdout). The same format is used to send messages in both directions; each message is serialized using JSON, UTF-8 encoded and is preceded with 32-bit message length in native byte order. The maximum size of a single message from the native messaging host is 1 MB, mainly to protect Chrome from misbehaving native applications. The maximum size of the message sent to the native messaging host is 64 MiB.

Note, that the IPC communication is not a TTY.

Several examples of JavaScript compiled to WASM and/or embedded and executed within a JavaScript engine compiled to WASM can be found here

to the extent applicable and comparable to JavaScript or TypeScript,

I was referred to StarlingMonkey over here #general > Embedding JavaScript into QuickJS before compiling to WASM.

To be clear, I am not looking for "a" or "the" JavaScript to WASM toolchain; I'm actively testing, breaking, and vetting JavaScript to WASM toolchains and novel implementations, for research and comparative analysis purposes; without any biases or preferences for any. They all get tested until they break, witout rancor, and without exception or handicap.

Assume

  • I have basically zero experience writing WIT
  • There is zero networking involved in the JavaScript source code
  • I just need to read STDIN and write to STDOUT

Questions:

  • In node world there is process.stdin and process.stdout, and even readFileSync point to 0 or /dev/stdin or /proc/self/fd/0, and /dev/stdout or /proc/self/fd/1, respectively. STDOUT !== WHATWG Console's console. What are the specific I/O interfaces StarlingMonkey has implemented?

  • The Component Model has the WIT thing - it's own syntax and bassically an entire language itself. What is the minimal WIT that Component Model compilers expect just to read STDIN and write to STDOUT?

  • How to compile generic JavaScript that expects to done only read STDIN and write to STDOUT (neither specified in ECMA-262) - with absolutely no networking involved, no ServiceWorker-like fetch() handler at all, using StarlingMokey's starling.wasm or starling-raw.wasm?

Ngôn ngữ chính
C
Star
297
Fork
64
Merge trung bình
2 ngày 2 giờ
Pull request đã merge (30 ngày)
19

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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/StarlingMonkey

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

Issue tương tự

Thêm issue về C

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.