Skip to content

Commit

Permalink
Merge 8a9f78a into 6498216
Browse files Browse the repository at this point in the history
  • Loading branch information
jedel1043 authored Mar 19, 2022
2 parents 6498216 + 8a9f78a commit 32ff1d7
Show file tree
Hide file tree
Showing 11 changed files with 8,563 additions and 2,919 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ jobs:
- uses: actions/checkout@v3
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- uses: Borales/actions-yarn@v2.3.0
- uses: actions/setup-node@v3
with:
cmd: install
- name: Cache yarn build
node-version: "16"
- run: npm ci
- name: Cache npm build
uses: actions/cache@v2.1.7
with:
path: |
Expand All @@ -35,10 +36,8 @@ jobs:
boa_wasm/pkg
~/.cargo/git
~/.cargo/registry
key: ${{ runner.os }}-yarn-build-target-${{ hashFiles('**/yarn.lock') }}
- uses: Borales/actions-yarn@v2.3.0
with:
cmd: build:prod
key: ${{ runner.os }}-npm-build-target-${{ hashFiles('**/package-lock.json') }}
- run: npm run build:prod
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/webassembly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
profile: minimal
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Cache yarn build
- name: Cache npm build
uses: actions/cache@v2.1.7
with:
path: |
Expand All @@ -41,10 +41,9 @@ jobs:
~/.cargo/git
~/.cargo/registry
boa_wasm/pkg
key: ${{ runner.os }}-yarn-build-target-${{ hashFiles('**/yarn.lock') }}
- uses: Borales/actions-yarn@v2.3.0
key: ${{ runner.os }}-npm-build-target-${{ hashFiles('**/package-lock.json') }}
- uses: actions/setup-node@v3
with:
cmd: install
- uses: Borales/actions-yarn@v2.3.0
with:
cmd: build
node-version: "16"
- run: npm ci
- run: npm run build
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ tool to use. It will install Rust and allow you to switch between _nightly_,
_stable_ and _beta_. You can also install additional components. In Linux, you
can run:

```
```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```

Expand Down Expand Up @@ -75,13 +75,13 @@ Boa provides its own test suite, and can also run the official ECMAScript test s
suite, you can just run the normal `cargo test`, and to run the full ECMAScript test suite, you can run it
with this command:

```
```bash
cargo run --release --bin boa_tester -- run -v 2> error.log
```

Note that this requires the `test262` submodule to be checked out, so you will need to run the following first:

```
```bash
git submodule init && git submodule update
```

Expand All @@ -100,14 +100,14 @@ type tests, use `-s test/language/types/number`.
Finally, if you're using the verbose flag and running a sub suite with a small number of tests, then the output will
be more readable if you disable parallelism with the `-d` flag. All together it might look something like:

```
```bash
cargo run --release --bin boa_tester -- run -vv -d -s test/language/types/number 2> error.log
```

## Communication

We have a Discord server, feel free to ask questions here:
https://discord.gg/tUFFk9Y
<https://discord.gg/tUFFk9Y>

[issues]: https://github.com/boa-dev/boa/issues
[rustup]: https://rustup.rs/
Expand Down
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ Currently, it has support for some of the language.

[![Build Status][build_badge]][build_link]
[![codecov](https://codecov.io/gh/boa-dev/boa/branch/main/graph/badge.svg)](https://codecov.io/gh/boa-dev/boa)
[![](https://img.shields.io/crates/v/Boa.svg)](https://crates.io/crates/Boa)
[![](https://docs.rs/Boa/badge.svg)](https://docs.rs/Boa/)
[![Crates.io](https://img.shields.io/crates/v/Boa.svg)](https://crates.io/crates/Boa)
[![Docs.rs](https://docs.rs/Boa/badge.svg)](https://docs.rs/Boa/)
[![Discord](https://img.shields.io/discord/595323158140158003?logo=discord)](https://discord.gg/tUFFk9Y)

[build_badge]: https://github.com/boa-dev/boa/actions/workflows/rust.yml/badge.svg?event=push&branch=main
Expand Down Expand Up @@ -53,13 +53,18 @@ Check [debugging.md](./docs/debugging.md) for more info on debugging.
This interpreter can be exposed to javascript!
You can build the example locally with:

```
$ yarn install
$ yarn serve
```bash
npm run build
```

In the console you can use `window.evaluate` to pass JavaScript in.
To develop on the web assembly side you can run `yarn serve` then go to `http://localhost:8080`.
To develop on the web assembly side you can run:

```bash
npm run serve
```

then go to `http://localhost:8080`.

## Roadmap

Expand All @@ -81,7 +86,7 @@ See [Profiling](./docs/profiling.md)

## Command-line Options

```
```text
USAGE:
boa [OPTIONS] [FILE]...
Expand Down
1 change: 1 addition & 0 deletions boa_wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ license = "Unlicense/MIT"

[dependencies]
boa_engine = { path = "../boa_engine", features = ["console"], version = "0.14.0" }
# BUG: Pump when 0.2.80 releases. See https://github.com/rustwasm/wasm-bindgen/issues/2774
wasm-bindgen = "=0.2.78"
getrandom = { version = "0.2.5", features = ["js"] }

Expand Down
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
display: flex;
align-items: center;
}

.demo__img {
width: 170px;
display: block;
Expand Down
32 changes: 5 additions & 27 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,6 @@
// Note that a dynamic `import` statement here is required due to
// webpack/webpack#6615, but in theory `import { greet } from './pkg/hello_world';`
// will work here one day as well!
const rust = import("./boa_wasm/pkg");
import * as monaco from "monaco-editor";
import { evaluate } from "./boa_wasm/pkg";

window.MonacoEnvironment = {
getWorkerUrl: function (moduleId, label) {
if (label === "json") {
return "./json.worker.js";
}
if (label === "css") {
return "./css.worker.js";
}
if (label === "html") {
return "./html.worker.js";
}
if (label === "typescript" || label === "javascript") {
return "./ts.worker.js";
}
return "./editor.worker.js";
},
};
import * as monaco from "monaco-editor/esm/vs/editor/editor.api";

const initialCode = `\
function greet(targetName) {
Expand All @@ -47,12 +27,10 @@ window.addEventListener("resize", () => {
editor.layout();
});

rust.then((m) => {
window.evaluate = m.evaluate;
window.evaluate = evaluate;

editor.getModel().onDidChangeContent(inputHandler);
inputHandler(); // Evaluate initial code
});
editor.getModel().onDidChangeContent(inputHandler);
inputHandler(); // Evaluate initial code

function inputHandler(evt) {
const text = editor.getValue();
Expand Down
Loading

0 comments on commit 32ff1d7

Please sign in to comment.