pub fn detect_language(context: impl AsRef<Path>) -> Result<WasmLanguage>Expand description
Detect the source language from files in the given directory
This function examines project files to determine which language should be used for WASM compilation.
§Detection Order
- Cargo.toml with cargo-component ->
RustComponent - Cargo.toml -> Rust
- go.mod -> Go (
TinyGo) - pyproject.toml or requirements.txt -> Python
- package.json with assemblyscript ->
AssemblyScript - package.json -> TypeScript
- build.zig -> Zig
- Makefile with *.c files -> C
§Errors
Returns an error if no supported WASM language project is detected in the context directory.