Skip to content

Commit 0e285aa

Browse files
committed
Renaming more stuff to as-bind
1 parent 307c635 commit 0e285aa

File tree

6 files changed

+16
-25
lines changed

6 files changed

+16
-25
lines changed

README.md

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,13 @@ You can install as-bind in your project by running the following:
4747

4848
## Quick Start
4949

50-
**1. In your Assemblyscript**
50+
**1. Compiling your Assemblyscript**
5151

52-
Export everything from the asbind assemblyscript library:
52+
To enable as-bind for your AssemblyScript Wasm modules, add the as-bind entrypoint when compiling your module:
5353

54-
```typescript
55-
// This should be in your entry point file for your Assemblyscript project
56-
57-
// '../node_modules/as-bind/*' should be the relative path to this directory in your project
58-
export * from "../node_modules/as-bind/lib/assembly/asbind.ts";
59-
```
54+
`asc ./node_modules/as-bind/lib/assembly/as-bind.ts your-entryfile.ts [...other cli options...]`
6055

61-
After this, let's export an example function we can try:
56+
For **optional testing purposes** , let's export an example function we can try in `your-entryfile.ts`:
6257

6358
```typescript
6459
export function myExportedFunctionThatTakesAString(value: string): string {
@@ -78,7 +73,7 @@ const wasm = fetch("./path-to-my-wasm.wasm");
7873
const asyncTask = async () => {
7974
const asBindInstance = await AsBind.instantiate(wasm);
8075

81-
// You can now use your wasm / asbind instance!
76+
// You can now use your wasm / as-bind instance!
8277
const response = asBindInstance.exports.myExportedFunctionThatTakesAString(
8378
"Hello World!"
8479
);
@@ -98,7 +93,7 @@ const wasm = fs.readFileSync("./path-to-my-wasm.wasm");
9893
const asyncTask = async () => {
9994
const asBindInstance = await AsBind.instantiate(wasm);
10095

101-
// You can now use your wasm / asbind instance!
96+
// You can now use your wasm / as-bind instance!
10297
const response = asBindInstance.exports.myExportedFunctionThatTakesAString(
10398
"Hello World!"
10499
);

examples/markdown-parser/assembly/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
// Wasm module to do a basic markdown to HTML
22

3-
// Export asbind
4-
export * from "../../../dist/asbind";
5-
63
import { log } from "./util";
74

85
import { Token } from "./tokenizer/token";
File renamed without changes.

lib/supported-ref-types.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const SUPPORTED_REF_TYPES = {
1010
return wasmExports.__retain(wasmExports.__allocString(arg));
1111
},
1212
getValueFromRef: (wasmExports, responseRef) => {
13-
return wasmExports.__getString(responseRef).slice(0);
13+
return wasmExports.__getString(responseRef);
1414
}
1515
},
1616
INT8ARRAY: {

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"name": "as-bind",
33
"description": "Isomorphic library to handle passing high-level data structures between AssemblyScript and JavaScript 🤝🚀",
44
"version": "0.1.1",
5-
"main": "dist/asbind.cjs.js",
6-
"module": "dist/asbind.esm.js",
7-
"browser": "dist/asbind.iife.js",
5+
"main": "dist/as-bind.cjs.js",
6+
"module": "dist/as-bind.esm.js",
7+
"browser": "dist/as-bind.iife.js",
88
"scripts": {
99
"build": "run-s lib:wasm:build lib:js:build",
1010
"dev": "run-p lib:watch lib:test:watch",
@@ -15,8 +15,8 @@
1515
"lib:watch": "chokidar --initial \"lib/**/*\" -c \"run-s lib:wasm:build lib:js:build:dev test\"",
1616
"lib:test:watch": "chokidar \"test/**/*.js\" \"test/**/*.ts\" -c \"run-s lib:test:build test\"",
1717
"lib:wasm:build": "run-s lib:wasm:build:debug lib:wasm:build:optimized lib:wasm:build:cp",
18-
"lib:wasm:build:debug": "asc lib/assembly/asbind.ts -b dist/asbind.debug.wasm -t dist/asbind.debug.wat --sourceMap --validate --debug --runtime full",
19-
"lib:wasm:build:optimized": "asc lib/assembly/asbind.ts -b dist/asbind.wasm --sourceMap dist/asbind.wasm.map -t dist/asbind.wat --validate --runtime full -O3",
18+
"lib:wasm:build:debug": "asc lib/assembly/as-bind.ts -b dist/as-bind.debug.wasm -t dist/as-bind.debug.wat --sourceMap --validate --debug --runtime full",
19+
"lib:wasm:build:optimized": "asc lib/assembly/as-bind.ts -b dist/as-bind.wasm --sourceMap dist/as-bind.wasm.map -t dist/as-bind.wat --validate --runtime full -O3",
2020
"lib:wasm:build:cp": "cpy 'lib/assembly/**/*' dist",
2121
"lib:js:build": "rollup -c --environment LIB,PROD",
2222
"lib:js:build:dev": "rollup -c --environment LIB,DEV",
@@ -26,7 +26,7 @@
2626
"md:dev": "run-p lib:watch md:wasm:watch md:js:watch serve",
2727
"md:wasm:watch": "chokidar --initial \"examples/markdown-parser/assembly/**/*\" -c \"run-s md:wasm:build\"",
2828
"md:js:watch": "chokidar --initial \"examples/markdown-parser/**/*\" -c \"rollup -c --environment MD,DEV\"",
29-
"md:wasm:build": "asc examples/markdown-parser/assembly/index.ts -b dist/examples/markdown-parser/index.wasm -t dist/examples/markdown-parser/index.wat --sourceMap dist/examples/markdown-parser/index.wasm.map --validate --runtime full",
29+
"md:wasm:build": "asc lib/assembly/as-bind.ts examples/markdown-parser/assembly/index.ts -b dist/examples/markdown-parser/index.wasm -t dist/examples/markdown-parser/index.wat --sourceMap dist/examples/markdown-parser/index.wasm.map --validate --runtime full",
3030
"md:ts:build": "tsc --project examples/markdown-parser/assembly/ --outDir dist/ --module \"es2015\"",
3131
"md:js:build": "rollup -c --environment MD,PROD",
3232
"md:deploy": "run-s build md:build md:deploy:gh-pages",
@@ -75,7 +75,7 @@
7575
},
7676
"repository": {
7777
"type": "git",
78-
"url": "git+https://github.com/torch2424/asbind.git"
78+
"url": "git+https://github.com/torch2424/as-bind.git"
7979
},
8080
"keywords": [
8181
"assemblyscript",
@@ -95,8 +95,8 @@
9595
"author": "Aaron Turner",
9696
"license": "MIT",
9797
"bugs": {
98-
"url": "https://github.com/torch2424/asbind/issues"
98+
"url": "https://github.com/torch2424/as-bind/issues"
9999
},
100-
"homepage": "https://github.com/torch2424/asbind#readme",
100+
"homepage": "https://github.com/torch2424/as-bind#readme",
101101
"dependencies": {}
102102
}

test/assembly/test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// The entry file of your WebAssembly module.
2-
export * from "../../lib/assembly/asbind";
32

43
export function helloWorld(world: string): string {
54
return "Hello " + world + "!";

0 commit comments

Comments
 (0)