Skip to content

Commit ff815db

Browse files
Merge pull request #234 from alexcasalboni/main
Add documentation warnings for Rust, Go, and JavaScript
2 parents af91bac + 4742f3b commit ff815db

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

component-model/src/language-support/go.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,8 @@ Under the hood, TinyGo invokes `wasm-tools` to embed the WIT file to the module
286286
tinygo build -target=wasip2 -o add.wasm --wit-package docs:[email protected] --wit-world adder main.go
287287
```
288288

289+
> **WARNING:** By default, tinygo includes all debug-related information in your .wasm file. That is desirable when prototyping or testing locally to obtain useful backtraces in case of errors (for example, with `wasmtime::WasmBacktraceDetails::Enable`). To remove debug data and optimize your binary file, build with `-no-debug`. The resulting .wasm file will be considerably smaller (up to 75% reduction in size).
290+
289291
We now have an add component that satisfies our `adder` world, exporting the `add` function, which
290292

291293
We can confirm using the `wasm-tools component wit` command:

component-model/src/language-support/javascript.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ You should see output like the following:
106106
OK Successfully written add.wasm.
107107
```
108108

109+
> **WARNING:** By using `--disable all`, your component won't get access to any WASI interfaces that might be useful for debugging or logging. For example, you can't `console.log(...)` or `console.error(...)` without `stdio`; you can't use `Math.random()` without `random`; and you can't use `Date.now()` or `new Date()` without `clocks`. Please note that calls to `Math.random()` or `Date.now()` will return seemingly valid outputs, but without actual randomness or timestamp correctness.
110+
109111
[mdn-js-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
110112

111113
## Running the Component in the `example-host`

component-model/src/language-support/rust.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ Now, use `cargo component` to build the component, being sure to optimize with a
9090
cargo component build --release
9191
```
9292

93+
> **WARNING:** Building with `--release` removes all debug-related information from the resulting .wasm file. When prototyping or testing locally, you might want to avoid `--release` to obtain useful backtraces in case of errors (for example, with `wasmtime::WasmBacktraceDetails::Enable`). Note: the resulting .wasm file will be considerably larger (likely 4MB+).
94+
9395
You can use `wasm-tools component wit` to output the WIT package of the component:
9496

9597
```

0 commit comments

Comments
 (0)