diff --git a/docs/assemblyscript-hello-world/.gitignore b/docs/assemblyscript-hello-world/.gitignore new file mode 100644 index 0000000000..c2658d7d1b --- /dev/null +++ b/docs/assemblyscript-hello-world/.gitignore @@ -0,0 +1 @@ +node_modules/ diff --git a/docs/assemblyscript-hello-world/package-lock.json b/docs/assemblyscript-hello-world/package-lock.json index f4568e8796..fa465fe3c0 100644 --- a/docs/assemblyscript-hello-world/package-lock.json +++ b/docs/assemblyscript-hello-world/package-lock.json @@ -1,28 +1,79 @@ { "name": "wasi-hello-world", "version": "1.0.0", - "lockfileVersion": 1, + "lockfileVersion": 2, "requires": true, + "packages": { + "": { + "name": "wasi-hello-world", + "version": "1.0.0", + "license": "MIT", + "dependencies": { + "as-wasi": "^0.4.6" + }, + "devDependencies": { + "assemblyscript": "^0.19.10" + } + }, + "node_modules/as-wasi": { + "version": "0.4.6", + "resolved": "https://registry.npmjs.org/as-wasi/-/as-wasi-0.4.6.tgz", + "integrity": "sha512-HFWdxLVHrOfchf/M+gE2IczsHBkWXqekZZfHYmDj6WP1UnpQC4k44OeyjqmSwC/db1tppEwCUssDCuFGnMdJZw==" + }, + "node_modules/assemblyscript": { + "version": "0.19.10", + "resolved": "https://registry.npmjs.org/assemblyscript/-/assemblyscript-0.19.10.tgz", + "integrity": "sha512-HavcUBXB3mBTRGJcpvaQjmnmaqKHBGREjSPNsIvnAk2f9dj78y4BkMaSSdvBQYWcDDzsHQjyUC8stICFkD1Odg==", + "dev": true, + "dependencies": { + "binaryen": "101.0.0-nightly.20210723", + "long": "^4.0.0" + }, + "bin": { + "asc": "bin/asc", + "asinit": "bin/asinit" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/assemblyscript" + } + }, + "node_modules/binaryen": { + "version": "101.0.0-nightly.20210723", + "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-101.0.0-nightly.20210723.tgz", + "integrity": "sha512-eioJNqhHlkguVSbblHOtLqlhtC882SOEPKmNFZaDuz1hzQjolxZ+eu3/kaS10n3sGPONsIZsO7R9fR00UyhEUA==", + "dev": true, + "bin": { + "wasm-opt": "bin/wasm-opt" + } + }, + "node_modules/long": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", + "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==", + "dev": true + } + }, "dependencies": { "as-wasi": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/as-wasi/-/as-wasi-0.1.1.tgz", - "integrity": "sha512-7PrSjsD/K2Pg95/2fu+4RJCfZLiuM0w0k5lMceaCf73EvH+7WPQTM1WW/vS0cizRTaEDj8Wz5ttoZBJSvsZpBQ==" + "version": "0.4.6", + "resolved": "https://registry.npmjs.org/as-wasi/-/as-wasi-0.4.6.tgz", + "integrity": "sha512-HFWdxLVHrOfchf/M+gE2IczsHBkWXqekZZfHYmDj6WP1UnpQC4k44OeyjqmSwC/db1tppEwCUssDCuFGnMdJZw==" }, "assemblyscript": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/assemblyscript/-/assemblyscript-0.10.0.tgz", - "integrity": "sha512-ErUNhHboD+zsB4oG6X1YICDAIo27Gq7LeNX6jVe+Q0W5cI51/fHwC8yJ68IukqvupmZgYPdp1JqqRXlS+BrUfA==", + "version": "0.19.10", + "resolved": "https://registry.npmjs.org/assemblyscript/-/assemblyscript-0.19.10.tgz", + "integrity": "sha512-HavcUBXB3mBTRGJcpvaQjmnmaqKHBGREjSPNsIvnAk2f9dj78y4BkMaSSdvBQYWcDDzsHQjyUC8stICFkD1Odg==", "dev": true, "requires": { - "binaryen": "93.0.0-nightly.20200514", + "binaryen": "101.0.0-nightly.20210723", "long": "^4.0.0" } }, "binaryen": { - "version": "93.0.0-nightly.20200514", - "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-93.0.0-nightly.20200514.tgz", - "integrity": "sha512-SRRItmNvhRVfoWWbRloO4i8IqkKH8rZ7/0QWRgLpM3umupK8gBpo9MY7Zp3pDysRSp+rVoqxvM5x4tFyCSa9zw==", + "version": "101.0.0-nightly.20210723", + "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-101.0.0-nightly.20210723.tgz", + "integrity": "sha512-eioJNqhHlkguVSbblHOtLqlhtC882SOEPKmNFZaDuz1hzQjolxZ+eu3/kaS10n3sGPONsIZsO7R9fR00UyhEUA==", "dev": true }, "long": { diff --git a/docs/assemblyscript-hello-world/package.json b/docs/assemblyscript-hello-world/package.json index 2bcd9100a2..121c4e8ec8 100644 --- a/docs/assemblyscript-hello-world/package.json +++ b/docs/assemblyscript-hello-world/package.json @@ -4,15 +4,15 @@ "description": "Hello world in Wasi with AS and as-wasi", "main": "index.js", "scripts": { - "build": "asc wasi-hello-world.ts -b wasi-hello-world.wasm -t wasi-hello-world.wat --runtime half", + "build": "asc wasi-hello-world.ts -b wasi-hello-world.wasm", "wasmtime": "wasmtime wasi-hello-world.wasm" }, "author": "Aaron Turner", "license": "MIT", "devDependencies": { - "assemblyscript": "^0.10.0" + "assemblyscript": "^0.19.10" }, "dependencies": { - "as-wasi": "^0.1.1" + "as-wasi": "^0.4.6" } } diff --git a/docs/assemblyscript-hello-world/wasi-hello-world.wasm b/docs/assemblyscript-hello-world/wasi-hello-world.wasm new file mode 100644 index 0000000000..bb85a774da Binary files /dev/null and b/docs/assemblyscript-hello-world/wasi-hello-world.wasm differ diff --git a/docs/wasm-assemblyscript.md b/docs/wasm-assemblyscript.md index b512fc6ea7..f6668828d0 100644 --- a/docs/wasm-assemblyscript.md +++ b/docs/wasm-assemblyscript.md @@ -1,18 +1,9 @@ # AssemblyScript -[AssemblyScript] 0.10.0 includes support for targeting WASI. To use it, add +[AssemblyScript] has included support for targeting WASI since version 0.10.0. To use it, add `import "wasi"` at the top of your entrypoint file. -To create a program which can be run directly as a command, pass `--runtime half` -to the AssemblyScript linker. This selects the [half runtime], which ensures that -the generated wasm module doesn't contain any extraneous exports. (This isn't -strictly required today, but the handling of extraneous exports may change in -the future, so it's encouraged. As a bonus, it also reduces code size.) - -To create a program which can be loaded as a library and used from other modules, -no special options are needed. - -Let's walk through a simple hello world example. +Let's walk through a simple hello world example using the latest AssemblyScript runtime (at the time of this writing, it is AssemblyScript runtime included in version 0.19.x): ## `wasi-hello-world.ts` @@ -49,5 +40,4 @@ repository to run the example locally. [code]: https://github.com/bytecodealliance/wasmtime/blob/main/docs/assemblyscript-hello-world [AssemblyScript]: https://assemblyscript.org [as-wasi]: https://github.com/jedisct1/as-wasi -[half runtime]: https://docs.assemblyscript.org/details/runtime#runtime-variants [Wasmtime API]: ./lang.md