From 8ca3af0e370650e149024e575eab4654a8f88227 Mon Sep 17 00:00:00 2001 From: Jairus Tanaka <60235514+JairusSW@users.noreply.github.com> Date: Tue, 7 Jun 2022 10:51:52 -0700 Subject: [PATCH] Update and clean up AssemblyScript example (#4233) * Update and clean up AssemblyScript example * Remove wasm build files * Remove wasm source files --- docs/assemblyscript-hello-world/.gitignore | 3 + docs/assemblyscript-hello-world/asconfig.json | 9 ++ .../package-lock.json | 86 ------------------ docs/assemblyscript-hello-world/package.json | 13 +-- .../wasi-hello-world.ts | 7 +- .../wasi-hello-world.wasm | Bin 7060 -> 0 bytes 6 files changed, 22 insertions(+), 96 deletions(-) create mode 100644 docs/assemblyscript-hello-world/asconfig.json delete mode 100644 docs/assemblyscript-hello-world/package-lock.json delete mode 100644 docs/assemblyscript-hello-world/wasi-hello-world.wasm diff --git a/docs/assemblyscript-hello-world/.gitignore b/docs/assemblyscript-hello-world/.gitignore index c2658d7d1b..39901aeaa4 100644 --- a/docs/assemblyscript-hello-world/.gitignore +++ b/docs/assemblyscript-hello-world/.gitignore @@ -1 +1,4 @@ node_modules/ +package-lock.json +*.lock +*.{wat,wasm} \ No newline at end of file diff --git a/docs/assemblyscript-hello-world/asconfig.json b/docs/assemblyscript-hello-world/asconfig.json new file mode 100644 index 0000000000..65c9ea8f09 --- /dev/null +++ b/docs/assemblyscript-hello-world/asconfig.json @@ -0,0 +1,9 @@ +{ + "targets": { + "helloworld": { + "outFile": "build/wasi-hello-world.wasm", + "textFile": "build/wasi-hello-world.wat" + } + }, + "options": {} +} \ No newline at end of file diff --git a/docs/assemblyscript-hello-world/package-lock.json b/docs/assemblyscript-hello-world/package-lock.json deleted file mode 100644 index fa465fe3c0..0000000000 --- a/docs/assemblyscript-hello-world/package-lock.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "name": "wasi-hello-world", - "version": "1.0.0", - "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.4.6", - "resolved": "https://registry.npmjs.org/as-wasi/-/as-wasi-0.4.6.tgz", - "integrity": "sha512-HFWdxLVHrOfchf/M+gE2IczsHBkWXqekZZfHYmDj6WP1UnpQC4k44OeyjqmSwC/db1tppEwCUssDCuFGnMdJZw==" - }, - "assemblyscript": { - "version": "0.19.10", - "resolved": "https://registry.npmjs.org/assemblyscript/-/assemblyscript-0.19.10.tgz", - "integrity": "sha512-HavcUBXB3mBTRGJcpvaQjmnmaqKHBGREjSPNsIvnAk2f9dj78y4BkMaSSdvBQYWcDDzsHQjyUC8stICFkD1Odg==", - "dev": true, - "requires": { - "binaryen": "101.0.0-nightly.20210723", - "long": "^4.0.0" - } - }, - "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 - }, - "long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==", - "dev": true - } - } -} diff --git a/docs/assemblyscript-hello-world/package.json b/docs/assemblyscript-hello-world/package.json index 121c4e8ec8..8135b4c884 100644 --- a/docs/assemblyscript-hello-world/package.json +++ b/docs/assemblyscript-hello-world/package.json @@ -4,15 +4,16 @@ "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", - "wasmtime": "wasmtime wasi-hello-world.wasm" + "build": "asc wasi-hello-world.ts --target helloworld", + "wasmtime": "wasmtime ./build/wasi-hello-world.wasm" }, "author": "Aaron Turner", + "contributors": [ + "Jairus Tanaka (JairusSW)" + ], "license": "MIT", "devDependencies": { - "assemblyscript": "^0.19.10" + "assemblyscript": "^0.20.7" }, - "dependencies": { - "as-wasi": "^0.4.6" - } + "dependencies": {} } diff --git a/docs/assemblyscript-hello-world/wasi-hello-world.ts b/docs/assemblyscript-hello-world/wasi-hello-world.ts index 1cd3065fe4..ef1b673157 100644 --- a/docs/assemblyscript-hello-world/wasi-hello-world.ts +++ b/docs/assemblyscript-hello-world/wasi-hello-world.ts @@ -1,5 +1,4 @@ import "wasi" - -import {Console} from "as-wasi" -Console.log('Hello World!\n'); - +// Import the WASI environment and additional WASI-enabled APIs +console.log('Hello World!\n'); +// Call AssemblyScript console.log which in turn calls WASI \ No newline at end of file diff --git a/docs/assemblyscript-hello-world/wasi-hello-world.wasm b/docs/assemblyscript-hello-world/wasi-hello-world.wasm deleted file mode 100644 index bb85a774dac9c3b39e165d36706f91cf4ceb545f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7060 zcmbuEU5p$@wa4qDyQgPrc3oaCiL-I+>YV{h2yp`UIuJs#Whr(X6qy&qqiqr=@yy2d z&JG)pP-amA_vL~jKs+Ilhbvtn5fQ`-NFZ4VL;wjzNKsxu3J@ed@(}R^B4B=}x@UIm zbp#S)ySuvj)H$cl`Jaz!tFxO=Xr+{n?u?mC)EPa|6E5nEQZm7VoyfdgdC0k?K{kJf zT2IVzbHkHoH_xBmym0o?=HnN~r!S4pZJj^&>(9*fpynbNJ6R&7+%+9+kT&J9;|~s=TWr7JRE)NeIKd5Yg^NA`m zYj%x!d$P(yo-sV4RaJx{ZtIgg>QLOjk*#$z7qX}aRhG*uFR!v_rq6$|8*%#udpw&2 z!z|o#)ULUixSd{qhu5+wV-Zx`OgDGJ)-uCDRx+oZOuDuT=zi2Fx4@{@I_fR=ZL8aC z2JQ8DfX=2W(iT+6PgbqaLWYtpl%Z_4P=xYsrBEC7i(ICY`eiJ(;$=Om+DzSt{tP>z z2%T7tLwoc=Elbd-Uh>9thik&%JN6`7RkGE5x>cka78v{{4!rN(jq{=vULW=jAT!$n7S%*rQY1BXsXp29bD7B#8kK znmlHaH3`LPE15a8TvS-y!N3gN?aH8u{OQ?fhl^Gln^aMig%J0PM+Jr<^QHT^c>KA~ z7lJYsUsK$pX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