Skip to content
This repository has been archived by the owner on Sep 6, 2022. It is now read-only.

Commit

Permalink
Merge pull request #3 from WebAssembly-Enthusiasts/master
Browse files Browse the repository at this point in the history
  • Loading branch information
surma authored Nov 9, 2020
2 parents f82bb7e + 8609431 commit 3f33c52
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
package-lock.json
test/build
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ function asc(opts) {
return `--${opt}`;
}
return `--${opt}=${val}`;
})
}),
...(opts.fileExtension ? [`--extension`, opts.fileExtension] : [])
];
asCompiler.main(
params,
Expand Down
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
{
"name": "rollup-plugin-assemblyscript",
"version": "1.2.0",
"version": "1.2.1",
"description": "",
"main": "index.js",
"keywords": [],
"author": "Surma <[email protected]>",
"license": "Apache-2.0",
"dependencies": {
"assemblyscript": "^0.9.4"
"assemblyscript": "^0.17.1"
},
"devDependencies": {
"husky": "^4.2.3",
"lint-staged": "^10.0.8",
"prettier": "^1.19.1"
"prettier": "^1.19.1",
"rollup": "^2.32.1"
},
"scripts": {
"test": "cd test && rollup -c",
"test-serve": "npx servez test"
},
"husky": {
"hooks": {
Expand Down
4 changes: 4 additions & 0 deletions test/addition.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//@ts-ignore
export function add(a: i32, b: i32): i32 {
return a + b;
}
11 changes: 11 additions & 0 deletions test/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script src="./build/main.js"></script>
</body>
</html>
5 changes: 5 additions & 0 deletions test/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { instancePromise } from "asc:./addition.as";

instancePromise.then(instance => {
alert(instance.exports.add(40, 2));
});
21 changes: 21 additions & 0 deletions test/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
let asc = require("../index.js").asc;

export default {
input: "main.js",
output: {
file: "build/main.js",
name: "test",
format: "umd"
},
plugins: [
asc({
fileExtension: ".as",
compilerOptions: {
optimizeLevel: 3,
runtime: "none"
//shrinkLevel: 1,
//importMemory: true
}
})
]
};

0 comments on commit 3f33c52

Please sign in to comment.