Skip to content

Commit 30dedf0

Browse files
authored
Migrate to 0.20.x version for all examples (#22)
1 parent 022bb05 commit 30dedf0

File tree

13 files changed

+891
-918
lines changed

13 files changed

+891
-918
lines changed

Diff for: game-of-life/asconfig.json

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"targets": {
3+
"options": {
4+
"runtime": "stub",
5+
"sourceMap": true,
6+
"measure": true
7+
},
8+
"debug": {
9+
"outFile": "build/untouched.wasm",
10+
"textFile": "build/untouched.wat",
11+
"use": "Math=JSMath",
12+
"importMemory": true,
13+
"debug": true
14+
},
15+
"release": {
16+
"outFile": "build/optimized.wasm",
17+
"textFile": "build/optimized.wat",
18+
"use": "Math=JSMath",
19+
"importMemory": true,
20+
"optimizeLevel": 3,
21+
"converge": false,
22+
"shrinkLevel": 0,
23+
"noAssert": false
24+
}
25+
}
26+
}

Diff for: game-of-life/build/optimized.wasm

-39 Bytes
Binary file not shown.

Diff for: game-of-life/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ <h1>
6464
.then(buffer => WebAssembly.instantiate(buffer, {
6565
env: {
6666
memory,
67-
abort: function() {}
67+
abort: function() {},
68+
"Math.random": Math.random
6869
},
6970
config: {
7071
BGR_ALIVE : rgb2bgr(RGB_ALIVE) | 1, // little endian, LSB must be set
7172
BGR_DEAD : rgb2bgr(RGB_DEAD) & ~1, // little endian, LSB must not be set
7273
BIT_ROT
7374
},
74-
Math
7575
}))
7676
.then(module => {
7777
var exports = module.instance.exports;

Diff for: game-of-life/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"license": "Apache-2.0",
55
"private": true,
66
"scripts": {
7-
"asbuild:untouched": "asc assembly/index.ts -b build/untouched.wasm -t build/untouched.wat --use Math=JSMath --runtime stub --importMemory --sourceMap --debug --measure",
8-
"asbuild:optimized": "asc assembly/index.ts -b build/optimized.wasm -t build/optimized.wat -d build/optimized.d.ts --use Math=JSMath -O3 --runtime stub --importMemory --sourceMap --measure",
7+
"asbuild:untouched": "asc assembly/index.ts --target debug",
8+
"asbuild:optimized": "asc assembly/index.ts --target release",
99
"asbuild": "npm run asbuild:untouched && npm run asbuild:optimized",
1010
"start": "npx serve"
1111
},

Diff for: i64/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"types": "index.d.ts",
77
"scripts": {
88
"asbuild": "npm run asbuild:untouched && npm run asbuild:optimized",
9-
"asbuild:untouched": "asc assembly/i64.ts -t build/untouched.wat -b build/untouched.wasm --runtime stub --sourceMap --debug --measure",
10-
"asbuild:optimized": "asc assembly/i64.ts -b build/optimized.wasm -t build/optimized.wat -d build/optimized.d.ts -O3 --runtime stub --sourceMap --measure",
9+
"asbuild:untouched": "asc assembly/i64.ts -t build/untouched.wat -o build/untouched.wasm --runtime stub --sourceMap --debug --measure",
10+
"asbuild:optimized": "asc assembly/i64.ts -t build/optimized.wat -o build/optimized.wasm -O3 --runtime stub --sourceMap --measure",
1111
"test": "node tests"
1212
},
1313
"files": [

Diff for: libm/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"types": "index.d.ts",
88
"scripts": {
99
"asbuild": "npm run asbuild:libm && npm run asbuild:libmf",
10-
"asbuild:libm": "asc assembly/libm.ts -O3 -b build/libm.wasm -t build/libm.wat --runtime stub",
11-
"asbuild:libmf": "asc assembly/libmf.ts -O3 -b build/libmf.wasm -t build/libmf.wat --runtime stub",
10+
"asbuild:libm": "asc assembly/libm.ts -O3 -o build/libm.wasm -t build/libm.wat --runtime stub",
11+
"asbuild:libmf": "asc assembly/libmf.ts -O3 -o build/libmf.wasm -t build/libmf.wat --runtime stub",
1212
"test": "node tests"
1313
},
1414
"files": [

Diff for: mandelbrot/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"license": "Apache-2.0",
55
"private": true,
66
"scripts": {
7-
"asbuild:untouched": "asc assembly/index.ts -b build/untouched.wasm -t build/untouched.wat --use Math=JSMath --runtime stub --importMemory --sourceMap --debug --measure",
8-
"asbuild:optimized": "asc assembly/index.ts -b build/optimized.wasm -t build/optimized.wat -d build/optimized.d.ts --use Math=JSMath --runtime stub -O3 --importMemory --sourceMap --measure",
7+
"asbuild:untouched": "asc assembly/index.ts -o build/untouched.wasm -t build/untouched.wat --use Math=JSMath --runtime stub --importMemory --sourceMap --debug --measure",
8+
"asbuild:optimized": "asc assembly/index.ts -o build/optimized.wasm -t build/optimized.wat --use Math=JSMath --runtime stub -O3 --importMemory --sourceMap --measure",
99
"asbuild": "npm run asbuild:untouched && npm run asbuild:optimized",
1010
"start": "npx serve"
1111
},

0 commit comments

Comments
 (0)