Skip to content

Commit

Permalink
Merge pull request #39 from jsoverson/formatting
Browse files Browse the repository at this point in the history
Made project more accessible to contributions
  • Loading branch information
bjorn3 authored Oct 9, 2023
2 parents 30577ec + ecd4049 commit 4f69fae
Show file tree
Hide file tree
Showing 17 changed files with 1,648 additions and 259 deletions.
8 changes: 8 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
rules: {
"@typescript-eslint/no-this-alias": "off",
},
};
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
node_modules/
dist/
typings/
examples/wasm-rustc
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "examples/wasm-rustc"]
path = examples/wasm-rustc
url = [email protected]:bjorn3/wasm-rustc.git
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": false,
"printWidth": 80
}
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,30 @@ let inst = await WebAssembly.instantiate(wasm, {
wasi.start(inst);
```

## Building

```
$ npm install
$ npm run build
```

## Running the demo

The demo requires the wasm rustc artifacts and the xterm js package. To get them run:

```
$ git submodule update --init
$ cd examples && npm install
```

Run the demo with a static web server from the root of this project:

```
$ npx http-server
```

And visit [http://127.0.0.1:8080/examples/rustc.html]() in your browser.

## License

Licensed under either of
Expand Down
8 changes: 6 additions & 2 deletions examples/rustc.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@
<body>
<div id="terminal"></div>
<div id="downloads"></div>
<p id="note">
Note: the panic at the end is expected. This demo highlights how far `rustc` can get on this polyfill before failing due to other reasons.
</p>
<script type="module">
import { Fd } from "../dist/fd.js";
import { File, Directory } from "../dist/fs_core.js";
import { PreopenDirectory } from "../dist/fs_fd.js";
import WASI from "../dist/wasi.js";
import { WASI } from "../dist/index.js";
import { strace } from "../dist/strace.js"


var term = new Terminal({
convertEol: true,
});
Expand Down Expand Up @@ -124,7 +128,7 @@
}),
];

let w = new WASI(args, env, fds);
let w = new WASI(args, env, fds, { debug: true });

let inst = await WebAssembly.instantiate(wasm, {
"wasi_snapshot_preview1": strace(w.wasiImport, ["fd_prestat_get"]),
Expand Down
1 change: 1 addition & 0 deletions examples/wasm-rustc
Submodule wasm-rustc added at ac835f
Loading

0 comments on commit 4f69fae

Please sign in to comment.