Skip to content

Commit 2517bac

Browse files
authored
Refactor the API ref docs. (#121)
0. Fix the duplicated lint and build check. 1. Rename the file name. 2. Use the `latest.md` for the latest API docs. 3. Correct the title. 4. Use the WASMEDGE_VERSION variable. Signed-off-by: YiYing He <[email protected]>
1 parent ec1301d commit 2517bac

File tree

93 files changed

+10915
-225
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+10915
-225
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
WASMEDGE_VERSION='0.11.2'
1+
WASMEDGE_VERSION='0.13.0'

.github/workflows/build-test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: Build Check
22
on:
33
workflow_dispatch:
44
push:
5+
branches:
6+
- main
57
paths-ignore:
68
- 'README.md'
79
- 'LICENSE'
@@ -12,6 +14,8 @@ on:
1214
- '.env'
1315
- '.gitignore'
1416
pull_request:
17+
branches:
18+
- main
1519
paths-ignore:
1620
- 'README.md'
1721
- 'LICENSE'

.github/workflows/lint.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: Lint
33
on:
44
workflow_dispatch:
55
push:
6+
branches:
7+
- main
68
pull_request:
79
branches:
810
- main

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
1-
![WasmEdge Logo](https://github.com/WasmEdge/.github/raw/main/profile/wasmedge-runtime-logo.png)
2-
31
# WasmEdge Docs
42

5-
This repo contains technical documentation for the [WasmEdge Runtime](https://github.com/WasmEdge/WasmEdge) project. The documentation website built from this repo is published https://wasmedge.org/docs/, check it out!
3+
![WasmEdge Logo](https://github.com/WasmEdge/.github/raw/main/profile/wasmedge-runtime-logo.png)
4+
5+
This repo contains technical documentation for the [WasmEdge Runtime](https://github.com/WasmEdge/WasmEdge) project. The documentation website built from this repo is published <https://wasmedge.org/docs/>, check it out!
66

7-
# Setting up the Docs Locally
7+
## Setting up the Docs Locally
88

99
To set up the WasmEdge Docs locally, you will need to follow these general steps:
1010

1111
1. **Clone the project:** Go to the GitHub repository page of the WasmEdge Docs project and click on the "Code" button to get the URL of the repository. Then, open a terminal or command prompt and type the following command:
1212

13-
```bash
14-
git clone https://github.com/WasmEdge/docs.git
15-
```
13+
```bash
14+
git clone https://github.com/WasmEdge/docs.git
15+
```
1616

1717
2. **Install dependencies:** Navigate to the project directory in the terminal and run the following command to install the necessary dependencies:
1818

19-
```bash
20-
npm install
21-
```
19+
```bash
20+
npm install
21+
```
2222

2323
3. **Start the development server:** Once the dependencies are installed, you can start the development server by running the following command:
2424

25-
```bash
26-
npm start
27-
```
25+
```bash
26+
npm start
27+
```
2828

29-
This should start the development server on port 3000. You can access the running application by opening a web browser and navigating to http://localhost:3000/docs/.
29+
This should start the development server on port 3000. You can access the running application by opening a web browser and navigating to <http://localhost:3000/docs/>.
3030

3131
That's it! You should now have a local instance of the WasmEdge Docs running on your machine.

docs/contribute/installer.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ The real installer handles all stuff. It supports python2.7 (not tested on earli
6363
- Short Option: `-v VERSION`
6464
- Full Option: `--version VERSION`
6565
- Description: Install the given VERSION of WasmEdge
66-
- Available Value: VERSION `0.11.2` or other valid release versions.
66+
- Available Value: VERSION `{{ wasmedge_version }}` or other valid release versions.
6767
- Note - In the case of supplied an invalid or nonexistent version, the installer exists with an error.
6868

6969
### Installation path
@@ -123,7 +123,7 @@ The real installer handles all stuff. It supports python2.7 (not tested on earli
123123

124124
- Note - Currently `--plugins` is an experimental option.
125125

126-
- Full Option: `--plugins wasi_crypto:0.11.0`
126+
- Full Option: `--plugins wasi_crypto:0.12.0`
127127

128128
- Note - The format for this argument is `<plugin_name>:<version_number>`. `<version_number>` is not compulsory. For example `--plugins wasi_crypto` is a valid option.
129129
- Note - `<plugin_name>` is cases sensitive. Allowed values are stated [here](https://wasmedge.org/docs/contribute/plugin/intro) in the `Rust Crate` column. The logic is that the release name should be the same.

docs/contribute/plugin/develop_plugin_c.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Assume that the plug-in example is in the file `testplugin.c`.
1818

1919
The goal of the plug-in is to provide the host functions which can be imported when instantiating WASM.
2020

21-
Therefore, developers can implement their plug-in host functions first, as the same as the [host functions in WasmEdge C API](/embed/c/reference/0.12.0.md#host-functions).
21+
Therefore, developers can implement their plug-in host functions first, as the same as the [host functions in WasmEdge C API](/embed/c/reference/latest.md#host-functions).
2222

2323
> For the more details about the [external data](/embed/c/host_function.md#host-data) and [calling frame context](/embed/c/host_function.md#calling-frame-context), please refer to the host function guide.
2424

docs/contribute/source/os/android/cli.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ sidebar_position: 2
66

77
In this section, we will show you how to use WasmEdge CLI tools on Android devices. We will showcase a full WasmEdge demo to perform image classification (Tensorflow-based AI inference) on an Android device.
88

9+
<!-- prettier-ignore -->
10+
:::note
11+
The `WasmEdge-tensorflow-tools` has been deprecated after the 0.12.1 version. We'll update to use the WasmEdge plug-in in the future.
12+
:::
13+
914
## Install Android version of WasmEdge-TensorFlow-Tools
1015

1116
First, install WasmEdge-TensorFlow-Tools pre-release on your Android device. It works with the Android version of TensorFlow-Lite dynamic shared library.
@@ -36,8 +41,8 @@ sirius:/ $
3641
Use the following commands on your Ubuntu dev machine to download the WasmEdge-TensorFlow-Tools pre-release packages.
3742

3843
```bash
39-
$ wget https://github.com/second-state/WasmEdge-tensorflow-tools/releases/download/{{ wasmedge_version }}/WasmEdge-tensorflow-tools-{{ wasmedge_version }}-android_aarch64.tar.gz
40-
$ mkdir WasmEdge-tensorflow-tools && tar zxvf WasmEdge-tensorflow-tools-{{ wasmedge_version }}-android_aarch64.tar.gz -C WasmEdge-tensorflow-tools
44+
$ wget https://github.com/second-state/WasmEdge-tensorflow-tools/releases/download/0.12.1/WasmEdge-tensorflow-tools-0.12.1-android_aarch64.tar.gz
45+
$ mkdir WasmEdge-tensorflow-tools && tar zxvf WasmEdge-tensorflow-tools-0.12.1-android_aarch64.tar.gz -C WasmEdge-tensorflow-tools
4146
show-tflite-tensor
4247
wasmedge-tensorflow-lite
4348
```
@@ -47,8 +52,8 @@ wasmedge-tensorflow-lite
4752
We provide an Android compatible version of TensorFlow-Lite dynamic shared library in the WasmEdge-Tensorflow-deps package. Download the package to your Ubuntu dev machine as follows.
4853

4954
```bash
50-
$ wget https://github.com/second-state/WasmEdge-tensorflow-deps/releases/download/{{ wasmedge_version }}/WasmEdge-tensorflow-deps-TFLite-{{ wasmedge_version }}-android_aarch64.tar.gz
51-
$ tar zxvf WasmEdge-tensorflow-deps-TFLite-{{ wasmedge_version }}-android_aarch64.tar.gz -C WasmEdge-tensorflow-tools
55+
$ wget https://github.com/second-state/WasmEdge-tensorflow-deps/releases/download/0.12.1/WasmEdge-tensorflow-deps-TFLite-0.12.1-android_aarch64.tar.gz
56+
$ tar zxvf WasmEdge-tensorflow-deps-TFLite-0.12.1-android_aarch64.tar.gz -C WasmEdge-tensorflow-tools
5257
libtensorflowlite_c.so
5358
```
5459

docs/contribute/source/os/android/ndk.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ sidebar_position: 3
66

77
In this section, we will demonstrate how to build an Android native application using C and the Android SDK. The native application uses the WasmEdge C SDK to embed the WasmEdge Runtime, and call WASM functions through WasmEdge.
88

9+
<!-- prettier-ignore -->
10+
:::note
11+
The `WasmEdge-Image`, `WasmEdge-Tensorflow`, and `WasmEdge-tensorflow-tools` have been deprecated after the 0.12.1 version. We'll update to use the WasmEdge plug-in in the future.
12+
:::
13+
914
## Prerequisite
1015

1116
### Android
@@ -92,22 +97,22 @@ int main(int argc, char *argv[]) {
9297
Use the following commands to download WasmEdge for Android on your Ubuntu dev machine.
9398
9499
```bash
95-
wget https://github.com/WasmEdge/WasmEdge/releases/download/{{ wasmedge_version }}/WasmEdge-{{ wasmedge_version }}-android_aarch64.tar.gz
96-
wget https://github.com/second-state/WasmEdge-image/releases/download/{{ wasmedge_version }}/WasmEdge-image-{{ wasmedge_version }}-android_aarch64.tar.gz
97-
wget https://github.com/second-state/WasmEdge-tensorflow/releases/download/{{ wasmedge_version }}/WasmEdge-tensorflowlite-{{ wasmedge_version }}-android_aarch64.tar.gz
98-
wget https://github.com/second-state/WasmEdge-tensorflow-deps/releases/download/{{ wasmedge_version }}/WasmEdge-tensorflow-deps-TFLite-{{ wasmedge_version }}-android_aarch64.tar.gz
99-
tar -zxf WasmEdge-{{ wasmedge_version }}-android_aarch64.tar.gz
100-
tar -zxf WasmEdge-image-{{ wasmedge_version }}-android_aarch64.tar.gz -C WasmEdge-{{ wasmedge_version }}-Android/
101-
tar -zxf WasmEdge-tensorflowlite-{{ wasmedge_version }}-android_aarch64.tar.gz -C WasmEdge-{{ wasmedge_version }}-Android/
102-
tar -zxf WasmEdge-tensorflow-deps-TFLite-{{ wasmedge_version }}-android_aarch64.tar.gz -C WasmEdge-{{ wasmedge_version }}-Android/lib/
100+
wget https://github.com/WasmEdge/WasmEdge/releases/download/0.12.1/WasmEdge-0.12.1-android_aarch64.tar.gz
101+
wget https://github.com/second-state/WasmEdge-image/releases/download/0.12.1/WasmEdge-image-0.12.1-android_aarch64.tar.gz
102+
wget https://github.com/second-state/WasmEdge-tensorflow/releases/download/0.12.1/WasmEdge-tensorflowlite-0.12.1-android_aarch64.tar.gz
103+
wget https://github.com/second-state/WasmEdge-tensorflow-deps/releases/download/0.12.1/WasmEdge-tensorflow-deps-TFLite-0.12.1-android_aarch64.tar.gz
104+
tar -zxf WasmEdge-0.12.1-android_aarch64.tar.gz
105+
tar -zxf WasmEdge-image-0.12.1-android_aarch64.tar.gz -C WasmEdge-0.12.1-Android/
106+
tar -zxf WasmEdge-tensorflowlite-0.12.1-android_aarch64.tar.gz -C WasmEdge-0.12.1-Android/
107+
tar -zxf WasmEdge-tensorflow-deps-TFLite-0.12.1-android_aarch64.tar.gz -C WasmEdge-0.12.1-Android/lib/
103108
```
104109

105110
### Compile
106111

107112
The following command compiles the C program to `a.out` on your Ubunu dev machine.
108113

109114
```bash
110-
(/path/to/ndk)/toolchains/llvm/prebuilt/(HostPlatform)/bin/aarch64-linux-(AndroidApiVersion)-clang test.c -I./WasmEdge-{{ wasmedge_version }}-Android/include -L./WasmEdge-{{ wasmedge_version }}-Android/lib -lwasmedge-image_c -lwasmedge-tensorflowlite_c -ltensorflowlite_c -lwasmedge
115+
(/path/to/ndk)/toolchains/llvm/prebuilt/(HostPlatform)/bin/aarch64-linux-(AndroidApiVersion)-clang test.c -I./WasmEdge-0.12.1-Android/include -L./WasmEdge-0.12.1-Android/lib -lwasmedge-image_c -lwasmedge-tensorflowlite_c -ltensorflowlite_c -lwasmedge
111116
```
112117

113118
## Run
@@ -121,7 +126,7 @@ adb push a.out /data/local/tmp
121126
adb push birds_v1.wasm /data/local/tmp
122127
adb push lite-model_aiy_vision_classifier_birds_V1_3.tflite /data/local/tmp
123128
adb push bird.jpg /data/local/tmp
124-
adb push ./WasmEdge-{{ wasmedge_version }}-Android/lib /data/local/tmp
129+
adb push ./WasmEdge-0.12.1-Android/lib /data/local/tmp
125130
```
126131

127132
### Run the example

docs/develop/build-and-run/cli.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,14 +289,19 @@ world
289289

290290
Use `wasmedge-tensorflow-lite` ([link](https://github.com/WasmEdge/WasmEdge/tree/master/examples/js)):
291291

292+
<!-- prettier-ignore -->
293+
:::note
294+
The `WasmEdge-tensorflow-tools` has been deprecated after the 0.12.1 version. We'll update to use the WasmEdge plug-in in the future.
295+
:::
296+
292297
```bash
293-
$ docker pull wasmedge/slim-tf:{{ wasmedge_version }}
298+
$ docker pull wasmedge/slim-tf:0.12.1
294299
$ wget https://raw.githubusercontent.com/second-state/wasmedge-quickjs/main/example_js/tensorflow_lite_demo/aiy_food_V1_labelmap.txt
295300
$ wget https://raw.githubusercontent.com/second-state/wasmedge-quickjs/main/example_js/tensorflow_lite_demo/food.jpg
296301
$ wget https://raw.githubusercontent.com/second-state/wasmedge-quickjs/main/example_js/tensorflow_lite_demo/lite-model_aiy_vision_classifier_food_V1_1.tflite
297302
$ wget https://raw.githubusercontent.com/second-state/wasmedge-quickjs/main/example_js/tensorflow_lite_demo/main.js
298303

299-
$ docker run -it --rm -v $PWD:/app wasmedge/slim-tf:{{ wasmedge_version }} wasmedge-tensorflow-lite --dir .:. qjs_tf.wasm main.js
304+
$ docker run -it --rm -v $PWD:/app wasmedge/slim-tf:0.12.1 wasmedge-tensorflow-lite --dir .:. qjs_tf.wasm main.js
300305
label:
301306
Hot dog
302307
confidence:

docs/develop/rust/bindgen.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ sidebar_position: 10
44

55
# Bindgen of Rust Functions
66

7-
If your Rust program has a `main()` function, you could compile it into WebAssembly, and run it using the `wasmedge` CLI tool as a standalone application. However, a far more common use case is to compile a Rust function into WebAssembly, and then call it from a host application. That is known as an embedded WASM function. The host application uses WasmEdge language SDKs (e.g., [Go](/category/go-sdk-for-embedding-wasm-functions), [Rust](/category/rust-sdk-for-embedding-wasm-functions), [C](/category/c-sdk-for-embedding-wasm-functions), Python (WIP) and Java (WIP)) to call those WASM functions compiled from Rust source code. In this chapter, we will cover a little about WasmEdge-bindgen and you can find more information [here](/category/passing-complex-data)
7+
If your Rust program has a `main()` function, you could compile it into WebAssembly, and run it using the `wasmedge` CLI tool as a standalone application. However, a far more common use case is to compile a Rust function into WebAssembly, and then call it from a host application. That is known as an embedded WASM function. The host application uses WasmEdge language SDKs (e.g., [Go](/category/go-sdk-for-embedding-wasmedge), [Rust](/category/rust-sdk-for-embedding-wasmedge), [C](/category/c-sdk-for-embedding-wasmedge), Python (WIP) and Java (WIP)) to call those WASM functions compiled from Rust source code. In this chapter, we will cover a little about WasmEdge-bindgen and you can find more information [here](/category/passing-complex-data)
88

99
All the WasmEdge host language SDKs support simple function calls. However, the WASM spec only supports a few simple data types as call parameters and return values, such as `i32`, `i64`, `f32`, `f64`, and `v128`. The `wasmedge-bindgen` crate would transform parameters and return values of Rust functions into simple integer types when the Rust function is compiled into WASM. For example, a string is automatically converted into two integers, a memory address and a length, which can be handled by the standard WASM spec. It is very easy to do this in Rust source code. Just annotate your function with the `#[wasmedge-bindgen]` macro. You can compile the annotated Rust code using the standard Rust compiler toolchain (e.g., the latest `Cargo`).
1010

0 commit comments

Comments
 (0)