Open xujuntwt95329 opened 1 year ago
The source code of ts2wasm compiler is under branch ts2wasm_experiment
of WAMR:
https://github.com/bytecodealliance/wasm-micro-runtime/tree/ts2wasm_experiment
请问一下 当前 ts2wasm 项目编译生成的wasm模块,只能通过v8引擎运行吗? 其他常用的wasm 运行时无法运行?这个是什么原因?是因为当前的wasm内部有什么特殊规范吗?
@Joneyao ts2wasm rely on the WebAssembly GC proposal, we use latest version of binaryen to generate GC related opcodes, these opcodes only compatible to V8 version 11+, so currently we can only run the wasm module in these two approaches:
d8
executable, see run_generated_module for more detailsNote that the functionality of std libraries (like console.log) is under development, so currently the wasm module may lack of output capabilities, you can use chrome dev-tools to inspect the internal data (local/globals) inside the VM
Did you consider https://github.com/dudykr/stc as a possible base for typechecking? I don't know if it's possibly more mallable to the wasm case, anyway likely faster.
@goodcodedev Thanks for suggesting such a wonderful project, we do find that tsc
is relatively slow to parse the source code, but currently we are focusing on how to support TypeScript's rich semantic based on WasmGC
, so replacing the type checker may not be on the top priority.
I believe the compilation speed is very important for developer experience, so we may need to consider this in the future, and https://github.com/dudykr/stc you suggested seems a great approach :), we may make this as a topic in the future SIG meeting, and any further suggestions and discussions are welcome.
The source code of ts2wasm compiler is under branch
ts2wasm_experiment
of WAMR: https://github.com/bytecodealliance/wasm-micro-runtime/tree/ts2wasm_experiment
This branch seems to be removed or renamed. Where did it go?
Compiling TypeScript to WebAssembly
WebAssembly lacks of application programming language, currently supported languages are mainly for system programming (C/C++/Rust). Some approaches embed a whole language runtime inside WebAssembly to support other languages (JS, python), but this is not friendly to footprint and performance. On the other hand, TypeScript, as a statically-typed super set of JavaScript, can likely run faster on WebAssembly if we make use of the type information during compilation.
This issue is to track and discuss possible approaches to support compiling TypeScript to WebAssembly.
Motivation
Basic ideas
Expected benefits
Use case
Dependent proposals
Experimental implementation
https://github.com/bytecodealliance/wasm-micro-runtime/pull/2034
SIG
https://github.com/bytecodealliance/governance/pull/28/files