Installation
Generated JavaScript includes its runtime intrinsics inline by default. To
select an external runtime provider, enable the opt-in external-runtime Cargo
feature, call transpile_with_config, and set TranspileConfig::cm_runtime_es_module to
@bytecodealliance/jco-cm-runtime or another module specifier. Make the selected
module resolvable from the generated output; it must export a runtime provider.
Currently, external providers implement resource.tableGet, while the remaining
intrinsics are generated inline.
[]
= { = "2.17", = ["external-runtime"] }
use ;
let config = builder
.opts
.cm_runtime_es_module
.build;
let transpiled = transpile_with_config?;
The existing transpile(component, opts) API and TranspileOpts struct literals
remain supported. TranspileConfig is non-exhaustive so future configuration
fields can be added without breaking callers; construct it with its builder or
Default.
The separate opt-in coop-threads Cargo feature exposes the thread-named
Intrinsic aliases, such as Intrinsic::GlobalCurrentThreadMeta. The published
task-named variants remain available for exhaustive matches. This feature is
independent of external-runtime; it controls the public Rust names and does
not change the generated JavaScript.
License
This project is licensed under the Apache 2.0 license with the LLVM exception. See LICENSE for more details.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.