Browse Source

Some cleanup (#666)

pull/676/head
Iban Eguia 4 years ago committed by GitHub
parent
commit
1673871116
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      .github/ISSUE_TEMPLATE/bug_report.md
  2. 8
      .github/ISSUE_TEMPLATE/custom.md
  3. 5
      .github/ISSUE_TEMPLATE/feature_request.md
  4. 7
      .github/PULL_REQUEST_TEMPLATE.md
  5. 13
      .github/workflows/master.yml
  6. 6
      .github/workflows/pull_request.yml
  7. 50
      .github/workflows/rust.yml
  8. 2
      .github/workflows/security_audit.yml
  9. 51
      .github/workflows/webassembly.yml
  10. 8
      .prettierignore
  11. 14
      .vscode/launch.json
  12. 39
      .vscode/tasks.json
  13. 24
      CODE_OF_CONDUCT.md
  14. 76
      Cargo.lock
  15. 14
      Makefile
  16. 1
      README.md
  17. 7
      boa/benches/README.md
  18. 2
      boa/benches/bench_scripts/arithmetic_operations.js
  19. 6
      boa/benches/bench_scripts/array_access.js
  20. 12
      boa/benches/bench_scripts/array_create.js
  21. 239
      boa/benches/bench_scripts/array_pop.js
  22. 10
      boa/benches/bench_scripts/boolean_object_access.js
  23. 12
      boa/benches/bench_scripts/fibonacci.js
  24. 12
      boa/benches/bench_scripts/for_loop.js
  25. 4
      boa/benches/bench_scripts/goal_symbol_switch.js
  26. 3
      boa/benches/bench_scripts/hello_world.js
  27. 14
      boa/benches/bench_scripts/long_repetition.js
  28. 10
      boa/benches/bench_scripts/number_object_access.js
  29. 10
      boa/benches/bench_scripts/object_creation.js
  30. 10
      boa/benches/bench_scripts/object_prop_access_const.js
  31. 10
      boa/benches/bench_scripts/object_prop_access_dyn.js
  32. 4
      boa/benches/bench_scripts/regexp.js
  33. 4
      boa/benches/bench_scripts/regexp_creation.js
  34. 4
      boa/benches/bench_scripts/regexp_literal.js
  35. 4
      boa/benches/bench_scripts/regexp_literal_creation.js
  36. 12
      boa/benches/bench_scripts/string_compare.js
  37. 8
      boa/benches/bench_scripts/string_concat.js
  38. 6
      boa/benches/bench_scripts/string_copy.js
  39. 10
      boa/benches/bench_scripts/string_object_access.js
  40. 2
      boa/benches/bench_scripts/symbol_creation.js
  41. 4
      boa/src/syntax/parser/tests.rs
  42. 5
      docs/debugging.md
  43. 1
      docs/profiling.md
  44. 2
      index.js
  45. 9
      package.json
  46. 36
      webpack.config.js
  47. 646
      yarn.lock

14
.github/ISSUE_TEMPLATE/bug_report.md

@ -1,10 +1,9 @@
--- ---
name: "\U0001F41B Bug report" name: "\U0001F41B Bug report"
about: Create a report to help us improve about: Create a report to help us improve
title: '' title: ""
labels: bug labels: bug
assignees: '' assignees: ""
--- ---
<!-- <!--
@ -39,10 +38,11 @@ Running this code, `a` should be set to `10` and printed, but `a` is instead set
--> -->
**Build environment (please complete the following information):** **Build environment (please complete the following information):**
- OS: [e.g. Fedora Linux]
- Version: [e.g. 32] - OS: [e.g. Fedora Linux]
- Target triple: [e.g. x86_64-unknown-linux-gnu] - Version: [e.g. 32]
- Rustc version: [e.g. rustc 1.43.0 (4fb7144ed 2020-04-20), running `rustc -V`] - Target triple: [e.g. x86_64-unknown-linux-gnu]
- Rustc version: [e.g. rustc 1.43.0 (4fb7144ed 2020-04-20), running `rustc -V`]
**Additional context** **Additional context**
Add any other context about the problem here. Add any other context about the problem here.

8
.github/ISSUE_TEMPLATE/custom.md

@ -1,13 +1,13 @@
--- ---
name: Custom name: Custom
about: Open an issue in the repo that is neither a bug or a feature, such a new idea about: Open an issue in the repo that is neither a bug or a feature, such a new idea
title: '' title: ""
labels: '' labels: ""
assignees: '' assignees: ""
--- ---
<!-- <!--
Thank you for contributing to Boa! Please, let us know how can we help you. Thank you for contributing to Boa! Please, let us know how can we help you.
--> -->
E.g.: I think we should improve the way the JavaScript interpreter works by... E.g.: I think we should improve the way the JavaScript interpreter works by...

5
.github/ISSUE_TEMPLATE/feature_request.md

@ -1,10 +1,9 @@
--- ---
name: "\U0001F680 Feature request" name: "\U0001F680 Feature request"
about: Suggest a new ECMAScript feature to be implemented, or a new capability of the engine. about: Suggest a new ECMAScript feature to be implemented, or a new capability of the engine.
title: '' title: ""
labels: enhancement labels: enhancement
assignees: '' assignees: ""
--- ---
<!-- <!--

7
.github/PULL_REQUEST_TEMPLATE.md

@ -6,6 +6,7 @@ information as you feel neccesary.
This Pull Request fixes/closes #{issue_num}. This Pull Request fixes/closes #{issue_num}.
It changes the following: It changes the following:
-
- -
- -
-

13
.github/workflows/master.yml

@ -16,17 +16,17 @@ jobs:
override: true override: true
profile: minimal profile: minimal
- name: Cache cargo registry - name: Cache cargo registry
uses: actions/cache@v1 uses: actions/cache@v2
with: with:
path: ~/.cargo/registry path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index - name: Cache cargo index
uses: actions/cache@v1 uses: actions/cache@v2
with: with:
path: ~/.cargo/git path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build - name: Cache cargo build
uses: actions/cache@v1 uses: actions/cache@v2
with: with:
path: target path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
@ -38,13 +38,13 @@ jobs:
- run: echo "<meta http-equiv=refresh content=0;url=boa/index.html>" > target/doc/index.html - run: echo "<meta http-equiv=refresh content=0;url=boa/index.html>" > target/doc/index.html
- run: mkdir target/doc_upload && mv target/doc target/doc_upload/doc - run: mkdir target/doc_upload && mv target/doc target/doc_upload/doc
- name: Upload documentation - name: Upload documentation
uses: crazy-max/ghaction-github-pages@v1 uses: crazy-max/ghaction-github-pages@v2
with: with:
target_branch: gh-pages target_branch: gh-pages
keep_history: true keep_history: true
build_dir: target/doc_upload build_dir: target/doc_upload
env: env:
GITHUB_PAT: ${{ secrets.PERSONAL_GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run benchmark - name: Run benchmark
run: cargo bench -p Boa | tee output.txt run: cargo bench -p Boa | tee output.txt
- name: Store benchmark result - name: Store benchmark result
@ -54,5 +54,4 @@ jobs:
tool: "criterion" tool: "criterion"
output-file-path: output.txt output-file-path: output.txt
auto-push: true auto-push: true
github-token: ${{ secrets.PERSONAL_GITHUB_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }}

6
.github/workflows/pull_request.yml

@ -12,17 +12,17 @@ jobs:
override: true override: true
profile: minimal profile: minimal
- name: Cache cargo registry - name: Cache cargo registry
uses: actions/cache@v1 uses: actions/cache@v2
with: with:
path: ~/.cargo/registry path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index - name: Cache cargo index
uses: actions/cache@v1 uses: actions/cache@v2
with: with:
path: ~/.cargo/git path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build - name: Cache cargo build
uses: actions/cache@v1 uses: actions/cache@v2
with: with:
path: target path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}

50
.github/workflows/rust.yml

@ -20,17 +20,17 @@ jobs:
override: true override: true
profile: minimal profile: minimal
- name: Cache cargo registry - name: Cache cargo registry
uses: actions/cache@v1 uses: actions/cache@v2
with: with:
path: ~/.cargo/registry path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index - name: Cache cargo index
uses: actions/cache@v1 uses: actions/cache@v2
with: with:
path: ~/.cargo/git path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build - name: Cache cargo build
uses: actions/cache@v1 uses: actions/cache@v2
with: with:
path: target path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
@ -40,19 +40,19 @@ jobs:
args: -v args: -v
check_on_windows: check_on_windows:
name: Check on Windows name: Check on Windows
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1 - uses: actions-rs/toolchain@v1
with: with:
toolchain: stable toolchain: stable
override: true override: true
profile: minimal profile: minimal
- uses: actions-rs/cargo@v1 - uses: actions-rs/cargo@v1
with: with:
command: check command: check
args: -v args: -v
test_on_linux: test_on_linux:
name: Test Suite on Linux name: Test Suite on Linux
@ -65,17 +65,17 @@ jobs:
override: true override: true
profile: minimal profile: minimal
- name: Cache cargo registry - name: Cache cargo registry
uses: actions/cache@v1 uses: actions/cache@v2
with: with:
path: ~/.cargo/registry path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index - name: Cache cargo index
uses: actions/cache@v1 uses: actions/cache@v2
with: with:
path: ~/.cargo/git path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build - name: Cache cargo build
uses: actions/cache@v1 uses: actions/cache@v2
with: with:
path: target path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
@ -131,17 +131,17 @@ jobs:
profile: minimal profile: minimal
components: clippy components: clippy
- name: Cache cargo registry - name: Cache cargo registry
uses: actions/cache@v1 uses: actions/cache@v2
with: with:
path: ~/.cargo/registry path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index - name: Cache cargo index
uses: actions/cache@v1 uses: actions/cache@v2
with: with:
path: ~/.cargo/git path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build - name: Cache cargo build
uses: actions/cache@v1 uses: actions/cache@v2
with: with:
path: target path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
@ -161,17 +161,17 @@ jobs:
override: true override: true
profile: minimal profile: minimal
- name: Cache cargo registry - name: Cache cargo registry
uses: actions/cache@v1 uses: actions/cache@v2
with: with:
path: ~/.cargo/registry path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index - name: Cache cargo index
uses: actions/cache@v1 uses: actions/cache@v2
with: with:
path: ~/.cargo/git path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build - name: Cache cargo build
uses: actions/cache@v1 uses: actions/cache@v2
with: with:
path: target path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}

2
.github/workflows/security_audit.yml

@ -1,7 +1,7 @@
name: Security audit name: Security audit
on: on:
schedule: schedule:
- cron: '0 0 * * *' - cron: "0 0 * * *"
jobs: jobs:
audit: audit:
runs-on: ubuntu-latest runs-on: ubuntu-latest

51
.github/workflows/webassembly.yml

@ -0,0 +1,51 @@
on:
pull_request:
branches:
- master
push:
branches:
- master
name: Webassembly demo
jobs:
check_style:
name: Check webassembly demo style
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Check code formatting
uses: creyD/prettier_action@v3.0
with:
dry: true
prettier_options: --check .
build:
name: Build webassembly demo
runs-on: ubuntu-latest
env:
WASM_PACK_PATH: ~/.cargo/bin/wasm-pack
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Cache yarn build
uses: actions/cache@v2
with:
path: |
node_modules
target
boa_wasm/pkg
key: ${{ runner.os }}-yarn-build-target-${{ hashFiles('**/yarn.lock') }}
- uses: Borales/actions-yarn@v2.3.0
with:
cmd: install
- uses: Borales/actions-yarn@v2.3.0
with:
cmd: build

8
.prettierignore

@ -0,0 +1,8 @@
# Ignore artifacts:
*.rs
target
node_modules
boa/benches/bench_scripts/mini_js.js
boa/benches/bench_scripts/clean_js.js
boa_wasm/pkg
dist

14
.vscode/launch.json vendored

@ -12,20 +12,14 @@
"program": "${workspaceFolder}/target/debug/boa.exe" "program": "${workspaceFolder}/target/debug/boa.exe"
}, },
"program": "${workspaceFolder}/target/debug/boa", "program": "${workspaceFolder}/target/debug/boa",
"args": [ "args": ["${workspaceFolder}/tests/js/test.js"],
"${workspaceFolder}/tests/js/test.js" "sourceLanguages": ["rust"]
],
"sourceLanguages": [
"rust"
]
}, },
{ {
"name": "(Windows) Launch", "name": "(Windows) Launch",
"type": "cppvsdbg", "type": "cppvsdbg",
"request": "launch", "request": "launch",
"args": [ "args": ["${workspaceFolder}/tests/js/test.js"],
"${workspaceFolder}/tests/js/test.js"
],
"program": "${workspaceFolder}/target/debug/boa.exe", "program": "${workspaceFolder}/target/debug/boa.exe",
"cwd": "${workspaceFolder}", "cwd": "${workspaceFolder}",
"sourceFileMap": { "sourceFileMap": {
@ -45,6 +39,6 @@
"cwd": "${workspaceRoot}", "cwd": "${workspaceRoot}",
"environment": [], "environment": [],
"externalConsole": true "externalConsole": true
}, }
] ]
} }

39
.vscode/tasks.json vendored

@ -7,12 +7,7 @@
"type": "process", "type": "process",
"label": "Cargo Run", "label": "Cargo Run",
"command": "cargo", "command": "cargo",
"args": [ "args": ["run", "--bin", "boa", "./tests/js/test.js"],
"run",
"--bin",
"boa",
"./tests/js/test.js"
],
"group": { "group": {
"kind": "build", "kind": "build",
"isDefault": true "isDefault": true
@ -30,12 +25,7 @@
"type": "process", "type": "process",
"label": "Cargo Run (Profiler)", "label": "Cargo Run (Profiler)",
"command": "cargo", "command": "cargo",
"args": [ "args": ["run", "--features", "Boa/profiler", "../tests/js/test.js"],
"run",
"--features",
"Boa/profiler",
"../tests/js/test.js"
],
"group": "build", "group": "build",
"options": { "options": {
"env": { "env": {
@ -51,12 +41,7 @@
"type": "process", "type": "process",
"label": "Get Tokens", "label": "Get Tokens",
"command": "cargo", "command": "cargo",
"args": [ "args": ["run", "--", "-t=Debug", "./tests/js/test.js"],
"run",
"--",
"-t=Debug",
"./tests/js/test.js"
],
"group": "build", "group": "build",
"presentation": { "presentation": {
"clear": true "clear": true
@ -66,24 +51,17 @@
"type": "process", "type": "process",
"label": "Get AST", "label": "Get AST",
"command": "cargo", "command": "cargo",
"args": [ "args": ["run", "--", "-a=Debug", "./tests/js/test.js"],
"run",
"--",
"-a=Debug",
"./tests/js/test.js"
],
"group": "build", "group": "build",
"presentation": { "presentation": {
"clear": true "clear": true
}, }
}, },
{ {
"type": "process", "type": "process",
"label": "Cargo Test", "label": "Cargo Test",
"command": "cargo", "command": "cargo",
"args": [ "args": ["test"],
"test"
],
"group": { "group": {
"kind": "test", "kind": "test",
"isDefault": true "isDefault": true
@ -96,10 +74,7 @@
"type": "process", "type": "process",
"label": "Cargo Test Build", "label": "Cargo Test Build",
"command": "cargo", "command": "cargo",
"args": [ "args": ["test", "--no-run"],
"test",
"--no-run"
],
"group": "build" "group": "build"
} }
] ]

24
CODE_OF_CONDUCT.md

@ -1,4 +1,3 @@
# Contributor Covenant Code of Conduct # Contributor Covenant Code of Conduct
## Our Pledge ## Our Pledge
@ -18,23 +17,23 @@ diverse, inclusive, and healthy community.
Examples of behavior that contributes to a positive environment for our Examples of behavior that contributes to a positive environment for our
community include: community include:
* Demonstrating empathy and kindness toward other people - Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences - Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback - Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes, - Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience and learning from the experience
* Focusing on what is best not just for us as individuals, but for the - Focusing on what is best not just for us as individuals, but for the
overall community overall community
Examples of unacceptable behavior include: Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or - The use of sexualized language or imagery, and sexual attention or
advances of any kind advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks - Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment - Public or private harassment
* Publishing others' private information, such as a physical or email - Publishing others' private information, such as a physical or email
address, without their explicit permission address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a - Other conduct which could reasonably be considered inappropriate in a
professional setting professional setting
## Enforcement Responsibilities ## Enforcement Responsibilities
@ -107,7 +106,7 @@ Violating these terms may lead to a permanent ban.
### 4. Permanent Ban ### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community **Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals. individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within **Consequence**: A permanent ban from any sort of public interaction within
@ -127,4 +126,3 @@ enforcement ladder](https://github.com/mozilla/diversity).
For answers to common questions about this code of conduct, see the FAQ at For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations. https://www.contributor-covenant.org/translations.

76
Cargo.lock generated

@ -67,15 +67,15 @@ dependencies = [
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.0.0" version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
[[package]] [[package]]
name = "base64" name = "base64"
version = "0.11.0" version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
@ -249,6 +249,16 @@ dependencies = [
"itertools", "itertools",
] ]
[[package]]
name = "crossbeam-channel"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ee0cc8804d5393478d743b035099520087a5186f3b93fa58cec08fa62407b6"
dependencies = [
"cfg-if",
"crossbeam-utils",
]
[[package]] [[package]]
name = "crossbeam-deque" name = "crossbeam-deque"
version = "0.7.3" version = "0.7.3"
@ -275,17 +285,6 @@ dependencies = [
"scopeguard", "scopeguard",
] ]
[[package]]
name = "crossbeam-queue"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570"
dependencies = [
"cfg-if",
"crossbeam-utils",
"maybe-uninit",
]
[[package]] [[package]]
name = "crossbeam-utils" name = "crossbeam-utils"
version = "0.7.2" version = "0.7.2"
@ -357,9 +356,9 @@ dependencies = [
[[package]] [[package]]
name = "fs_extra" name = "fs_extra"
version = "1.1.0" version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f2a4a2034423744d2cc7ca2068453168dcdb82c438419e639a26bd87839c674" checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394"
[[package]] [[package]]
name = "gc" name = "gc"
@ -390,7 +389,7 @@ checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"libc", "libc",
"wasi", "wasi 0.9.0+wasi-snapshot-preview1",
] ]
[[package]] [[package]]
@ -743,9 +742,9 @@ dependencies = [
[[package]] [[package]]
name = "rayon" name = "rayon"
version = "1.3.1" version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62f02856753d04e03e26929f820d0a0a337ebe71f849801eea335d464b349080" checksum = "cfd016f0c045ad38b5251be2c9c0ab806917f82da4d36b2a327e5166adad9270"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"crossbeam-deque", "crossbeam-deque",
@ -755,12 +754,12 @@ dependencies = [
[[package]] [[package]]
name = "rayon-core" name = "rayon-core"
version = "1.7.1" version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e92e15d89083484e11353891f1af602cc661426deb9564c298b270c726973280" checksum = "91739a34c4355b5434ce54c9086c5895604a9c278586d1f1aa95e04f66b525a0"
dependencies = [ dependencies = [
"crossbeam-channel",
"crossbeam-deque", "crossbeam-deque",
"crossbeam-queue",
"crossbeam-utils", "crossbeam-utils",
"lazy_static", "lazy_static",
"num_cpus", "num_cpus",
@ -774,9 +773,9 @@ checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
[[package]] [[package]]
name = "redox_users" name = "redox_users"
version = "0.3.4" version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09b23093265f8d200fa7b4c2c76297f47e681c655f6f1285a8780d6a022f7431" checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d"
dependencies = [ dependencies = [
"getrandom", "getrandom",
"redox_syscall", "redox_syscall",
@ -812,9 +811,9 @@ checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8"
[[package]] [[package]]
name = "rust-argon2" name = "rust-argon2"
version = "0.7.0" version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bc8af4bda8e1ff4932523b94d3dd20ee30a87232323eda55903ffd71d2fb017" checksum = "9dab61250775933275e84053ac235621dfb739556d5c54a2f2e9313b7cf43a19"
dependencies = [ dependencies = [
"base64", "base64",
"blake2b_simd", "blake2b_simd",
@ -956,9 +955,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]] [[package]]
name = "structopt" name = "structopt"
version = "0.3.16" version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de5472fb24d7e80ae84a7801b7978f95a19ec32cb1876faea59ab711eb901976" checksum = "6cc388d94ffabf39b5ed5fadddc40147cb21e605f53db6f8f36a625d27489ac5"
dependencies = [ dependencies = [
"clap", "clap",
"lazy_static", "lazy_static",
@ -967,9 +966,9 @@ dependencies = [
[[package]] [[package]]
name = "structopt-derive" name = "structopt-derive"
version = "0.4.9" version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e0eb37335aeeebe51be42e2dc07f031163fbabfa6ac67d7ea68b5c2f68d5f99" checksum = "5e2513111825077552a6751dfad9e11ce0fba07d7276a3943a037d7e93e64c5f"
dependencies = [ dependencies = [
"heck", "heck",
"proc-macro-error", "proc-macro-error",
@ -980,9 +979,9 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.38" version = "1.0.39"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e69abc24912995b3038597a7a593be5053eb0fb44f3cc5beec0deb421790c1f4" checksum = "891d8d6567fe7c7f8835a3a98af4208f3846fba258c1bc3c31d6e506239f11f9"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -1021,11 +1020,12 @@ dependencies = [
[[package]] [[package]]
name = "time" name = "time"
version = "0.1.43" version = "0.1.44"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
dependencies = [ dependencies = [
"libc", "libc",
"wasi 0.10.0+wasi-snapshot-preview1",
"winapi", "winapi",
] ]
@ -1098,6 +1098,12 @@ version = "0.9.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
[[package]]
name = "wasi"
version = "0.10.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
[[package]] [[package]]
name = "wasm-bindgen" name = "wasm-bindgen"
version = "0.2.67" version = "0.2.67"

14
Makefile

@ -1,14 +0,0 @@
docker-build:
docker build --tag boa .
docker-container:
docker create --tty --interactive \
--name boa \
--hostname boa \
--volume ${PWD}/:/usr/src/myapp \
--publish 9228:9228 \
boa
docker-clean:
docker rm boa || echo "no container"
docker rmi boa || echo "no image"

1
README.md

@ -19,7 +19,6 @@ Currently, it has support for some of the language.
[build_badge]: https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fboa-dev%2Fboa%2Fbadge&style=flat [build_badge]: https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fboa-dev%2Fboa%2Fbadge&style=flat
[build_link]: https://actions-badge.atrox.dev/boa-dev/boa/goto [build_link]: https://actions-badge.atrox.dev/boa-dev/boa/goto
## Live Demo (WASM) ## Live Demo (WASM)
<https://boa-dev.github.io/boa/> <https://boa-dev.github.io/boa/>

7
boa/benches/README.md

@ -1,9 +1,10 @@
# Boa Benchmarks. # Boa Benchmarks.
We divide the benchmarks in 3 sections: We divide the benchmarks in 3 sections:
- Full engine benchmarks (lexing + parsing + realm creation + execution)
- Execution benchmarks - Full engine benchmarks (lexing + parsing + realm creation + execution)
- Parsing benchmarks (lexing + parse - these are tightly coupled so must be benchmarked together) - Execution benchmarks
- Parsing benchmarks (lexing + parse - these are tightly coupled so must be benchmarked together)
The idea is to check the performance of Boa in different scenarios and dividing the Boa execution The idea is to check the performance of Boa in different scenarios and dividing the Boa execution
process in its different parts. process in its different parts.

2
boa/benches/bench_scripts/arithmetic_operations.js

@ -1 +1 @@
((2 + 2) ** 3 / 100 - 5 ** 3 * -1000) ** 2 + 100 - 8 ((2 + 2) ** 3 / 100 - 5 ** 3 * -1000) ** 2 + 100 - 8;

6
boa/benches/bench_scripts/array_access.js

@ -1,7 +1,7 @@
(function () { (function () {
let testArr = [1,2,3,4,5]; let testArr = [1, 2, 3, 4, 5];
let res = testArr[2]; let res = testArr[2];
return res; return res;
})(); })();

12
boa/benches/bench_scripts/array_create.js

@ -1,8 +1,8 @@
(function(){ (function () {
let testArr = []; let testArr = [];
for (let a = 0; a <= 500; a++) { for (let a = 0; a <= 500; a++) {
testArr[a] = ('p' + a); testArr[a] = "p" + a;
} }
return testArr; return testArr;
})(); })();

239
boa/benches/bench_scripts/array_pop.js

@ -1,24 +1,221 @@
(function(){ (function () {
let testArray = [83, 93, 27, 29, 2828, 234, 23, 56, 32, 56, 67, 77, 32, let testArray = [
45, 93, 17, 28, 83, 62, 99, 36, 28, 93, 27, 29, 2828, 83,
234, 23, 56, 32, 56, 67, 77, 32, 45, 93, 17, 28, 83, 62, 93,
99, 36, 28, 93, 27, 29, 2828, 234, 23, 56, 32, 56, 67, 27,
77, 32, 45, 93, 17, 28, 83, 62, 99, 36, 28, 93, 27, 29, 29,
2828, 234, 23, 56, 32, 56, 67, 77, 32, 45, 93, 17, 28, 2828,
83, 62, 99, 36, 28, 93, 27, 29, 2828, 234, 23, 56, 32, 234,
56, 67, 77, 32, 45, 93, 17, 28, 83, 62, 99, 36, 28, 93, 23,
27, 29, 2828, 234, 23, 56, 32, 56, 67, 77, 32, 45, 93, 56,
17, 28, 83, 62, 99, 36, 28, 93, 27, 29, 2828, 234, 23, 32,
56, 32, 56, 67, 77, 32, 45, 93, 17, 28, 83, 62, 99, 36, 56,
28, 93, 27, 29, 2828, 234, 23, 56, 32, 56, 67, 77, 32, 67,
45, 93, 17, 28, 83, 62, 99, 36, 28, 93, 27, 29, 2828, 234, 77,
23, 56, 32, 56, 67, 77, 32, 45, 93, 17, 28, 83, 62, 99, 32,
36, 28, 93, 27, 29, 2828, 234, 23, 56, 32, 56, 67, 77, 32, 45,
45, 93, 17, 28, 83, 62, 99, 36, 28]; 93,
17,
28,
83,
62,
99,
36,
28,
93,
27,
29,
2828,
234,
23,
56,
32,
56,
67,
77,
32,
45,
93,
17,
28,
83,
62,
99,
36,
28,
93,
27,
29,
2828,
234,
23,
56,
32,
56,
67,
77,
32,
45,
93,
17,
28,
83,
62,
99,
36,
28,
93,
27,
29,
2828,
234,
23,
56,
32,
56,
67,
77,
32,
45,
93,
17,
28,
83,
62,
99,
36,
28,
93,
27,
29,
2828,
234,
23,
56,
32,
56,
67,
77,
32,
45,
93,
17,
28,
83,
62,
99,
36,
28,
93,
27,
29,
2828,
234,
23,
56,
32,
56,
67,
77,
32,
45,
93,
17,
28,
83,
62,
99,
36,
28,
93,
27,
29,
2828,
234,
23,
56,
32,
56,
67,
77,
32,
45,
93,
17,
28,
83,
62,
99,
36,
28,
93,
27,
29,
2828,
234,
23,
56,
32,
56,
67,
77,
32,
45,
93,
17,
28,
83,
62,
99,
36,
28,
93,
27,
29,
2828,
234,
23,
56,
32,
56,
67,
77,
32,
45,
93,
17,
28,
83,
62,
99,
36,
28,
93,
27,
29,
2828,
234,
23,
56,
32,
56,
67,
77,
32,
45,
93,
17,
28,
83,
62,
99,
36,
28,
];
while (testArray.length > 0) { while (testArray.length > 0) {
testArray.pop(); testArray.pop();
} }
return testArray; return testArray;
})(); })();

10
boa/benches/bench_scripts/boolean_object_access.js

@ -1,7 +1,7 @@
new Boolean( new Boolean(
!new Boolean( !new Boolean(
new Boolean( new Boolean(
!(new Boolean(false).valueOf()) && (new Boolean(true).valueOf()) !new Boolean(false).valueOf() && new Boolean(true).valueOf()
).valueOf()
).valueOf() ).valueOf()
).valueOf() ).valueOf()
).valueOf();

12
boa/benches/bench_scripts/fibonacci.js

@ -1,10 +1,10 @@
(function () { (function () {
let num = 12; let num = 12;
function fib(n) { function fib(n) {
if (n <= 1) return 1; if (n <= 1) return 1;
return fib(n - 1) + fib(n - 2); return fib(n - 1) + fib(n - 2);
} }
return fib(num); return fib(num);
})(); })();

12
boa/benches/bench_scripts/for_loop.js

@ -1,10 +1,10 @@
(function () { (function () {
let b = "hello"; let b = "hello";
for (let a = 10; a < 100; a += 5) { for (let a = 10; a < 100; a += 5) {
if (a < 50) { if (a < 50) {
b += "world"; b += "world";
}
} }
}
return b; return b;
})(); })();

4
boa/benches/bench_scripts/goal_symbol_switch.js

@ -2,6 +2,6 @@ function foo(regex, num) {}
let i = 0; let i = 0;
while (i < 1000000) { while (i < 1000000) {
foo(/ab+c/, 5.0/5); foo(/ab+c/, 5.0 / 5);
i++; i++;
} }

3
boa/benches/bench_scripts/hello_world.js

@ -1 +1,2 @@
let foo = 'hello world!'; foo; let foo = "hello world!";
foo;

14
boa/benches/bench_scripts/long_repetition.js

@ -1,9 +1,9 @@
for (let a = 10; a < 100; a++) { for (let a = 10; a < 100; a++) {
if (a < 10) { if (a < 10) {
console.log("impossible D:"); console.log("impossible D:");
} else if (a < 50) { } else if (a < 50) {
console.log("starting"); console.log("starting");
} else { } else {
console.log("finishing"); console.log("finishing");
} }
} }

10
boa/benches/bench_scripts/number_object_access.js

@ -1,7 +1,5 @@
new Number( new Number(
new Number( new Number(
new Number( new Number(new Number(100).valueOf() - 10.5).valueOf() + 100
new Number(100).valueOf() - 10.5 ).valueOf() * 1.6
).valueOf() + 100 );
).valueOf() * 1.6
)

10
boa/benches/bench_scripts/object_creation.js

@ -1,8 +1,8 @@
(function () { (function () {
let test = { let test = {
my_prop: "hello", my_prop: "hello",
another: 65, another: 65,
}; };
return test; return test;
})(); })();

10
boa/benches/bench_scripts/object_prop_access_const.js

@ -1,8 +1,8 @@
(function () { (function () {
let test = { let test = {
my_prop: "hello", my_prop: "hello",
another: 65, another: 65,
}; };
return test.my_prop; return test.my_prop;
})(); })();

10
boa/benches/bench_scripts/object_prop_access_dyn.js

@ -1,8 +1,8 @@
(function () { (function () {
let test = { let test = {
my_prop: "hello", my_prop: "hello",
another: 65, another: 65,
}; };
return test["my" + "_prop"]; return test["my" + "_prop"];
})(); })();

4
boa/benches/bench_scripts/regexp.js

@ -1,5 +1,5 @@
(function () { (function () {
let regExp = new RegExp('hello', 'i'); let regExp = new RegExp("hello", "i");
return regExp.test("Hello World"); return regExp.test("Hello World");
})(); })();

4
boa/benches/bench_scripts/regexp_creation.js

@ -1,5 +1,5 @@
(function () { (function () {
let regExp = new RegExp('hello', 'i'); let regExp = new RegExp("hello", "i");
return regExp; return regExp;
})(); })();

4
boa/benches/bench_scripts/regexp_literal.js

@ -1,5 +1,5 @@
(function () { (function () {
let regExp = /hello/i; let regExp = /hello/i;
return regExp.test("Hello World"); return regExp.test("Hello World");
})(); })();

4
boa/benches/bench_scripts/regexp_literal_creation.js

@ -1,5 +1,5 @@
(function () { (function () {
let regExp = /hello/i; let regExp = /hello/i;
return regExp; return regExp;
})(); })();

12
boa/benches/bench_scripts/string_compare.js

@ -1,9 +1,9 @@
(function(){ (function () {
var a = "hello"; var a = "hello";
var b = "world"; var b = "world";
var c = a == b; var c = a == b;
var d = b; var d = b;
var e = d == b; var e = d == b;
})(); })();

8
boa/benches/bench_scripts/string_concat.js

@ -1,6 +1,6 @@
(function(){ (function () {
var a = "hello"; var a = "hello";
var b = "world"; var b = "world";
var c = a + b; var c = a + b;
})(); })();

6
boa/benches/bench_scripts/string_copy.js

@ -1,4 +1,4 @@
(function(){ (function () {
var a = "hello"; var a = "hello";
var b = a; var b = a;
})(); })();

10
boa/benches/bench_scripts/string_object_access.js

@ -1,7 +1,7 @@
new String( new String(
new String(
new String( new String(
new String( new String("Hello").valueOf() + new String(", world").valueOf()
new String('Hello').valueOf() + new String(", world").valueOf() ).valueOf() + "!"
).valueOf() + '!' ).valueOf()
).valueOf() ).valueOf();
).valueOf()

2
boa/benches/bench_scripts/symbol_creation.js

@ -1,3 +1,3 @@
(function () { (function () {
return Symbol(); return Symbol();
})(); })();

4
boa/src/syntax/parser/tests.rs

@ -13,7 +13,7 @@ use crate::syntax::ast::{
/// Checks that the given JavaScript string gives the expected expression. /// Checks that the given JavaScript string gives the expected expression.
#[allow(clippy::unwrap_used)] #[allow(clippy::unwrap_used)]
// TODO: #[track_caller]: https://github.com/rust-lang/rust/issues/47809 #[track_caller]
pub(super) fn check_parser<L>(js: &str, expr: L) pub(super) fn check_parser<L>(js: &str, expr: L)
where where
L: Into<Box<[Node]>>, L: Into<Box<[Node]>>,
@ -27,7 +27,7 @@ where
} }
/// Checks that the given javascript string creates a parse error. /// Checks that the given javascript string creates a parse error.
// TODO: #[track_caller]: https://github.com/rust-lang/rust/issues/47809 #[track_caller]
pub(super) fn check_invalid(js: &str) { pub(super) fn check_invalid(js: &str) {
assert!(Parser::new(js.as_bytes()).parse_all().is_err()); assert!(Parser::new(js.as_bytes()).parse_all().is_err());
} }

5
docs/debugging.md

@ -23,14 +23,17 @@ To print the tokens to stdout, you can use the `boa_cli` command-line flag
`--dump-tokens` or `-t`, which can optionally take a format type. Supports `--dump-tokens` or `-t`, which can optionally take a format type. Supports
these formats: `Debug`, `Json`, `JsonPretty`. By default it is the `Debug` these formats: `Debug`, `Json`, `JsonPretty`. By default it is the `Debug`
format. format.
```bash ```bash
cargo run -- test.js --dump-tokens # token dump format is Debug by default. cargo run -- test.js --dump-tokens # token dump format is Debug by default.
``` ```
or with interactive mode (REPL): or with interactive mode (REPL):
```bash ```bash
cargo run -- --dump-tokens # token dump format is Debug by default. cargo run -- --dump-tokens # token dump format is Debug by default.
``` ```
Seeing the order of tokens can be a big help to understanding what the parser Seeing the order of tokens can be a big help to understanding what the parser
is working with. is working with.
@ -45,11 +48,13 @@ format type. Supports these formats: `Debug`, `Json`, `JsonPretty`. By default
it is the `Debug` format. it is the `Debug` format.
Dumping the AST of a file: Dumping the AST of a file:
```bash ```bash
cargo run -- test.js --dump-ast # AST dump format is Debug by default. cargo run -- test.js --dump-ast # AST dump format is Debug by default.
``` ```
or with interactive mode (REPL): or with interactive mode (REPL):
```bash ```bash
cargo run -- --dump-ast # AST dump format is Debug by default. cargo run -- --dump-ast # AST dump format is Debug by default.
``` ```

1
docs/profiling.md

@ -57,7 +57,6 @@ This is the same as above except instead of calling `$ crox my_trace` you call `
+---------------------------------------+-----------+-----------------+----------+------------+ +---------------------------------------+-----------+-----------------+----------+------------+
``` ```
## More Info ## More Info
- https://blog.rust-lang.org/inside-rust/2020/02/25/intro-rustc-self-profile.html - https://blog.rust-lang.org/inside-rust/2020/02/25/intro-rustc-self-profile.html

2
index.js

@ -63,6 +63,6 @@ function inputHandler(evt) {
p.textContent = `> ${result}`; p.textContent = `> ${result}`;
} catch (err) { } catch (err) {
console.error(err); console.error(err);
p.innerHTML = `<span style="color:red">${err}</span>` p.innerHTML = `<span style="color:red">${err}</span>`;
} }
} }

9
package.json

@ -5,15 +5,16 @@
}, },
"devDependencies": { "devDependencies": {
"@wasm-tool/wasm-pack-plugin": "^1.3.1", "@wasm-tool/wasm-pack-plugin": "^1.3.1",
"bootstrap": "^4.5.0", "bootstrap": "^4.5.2",
"clean-webpack-plugin": "^3.0.0", "clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^5.1.1", "copy-webpack-plugin": "^6.0.3",
"css-loader": "^3.6.0", "css-loader": "^4.2.2",
"file-loader": "^6.0.0", "file-loader": "^6.0.0",
"html-webpack-plugin": "^4.3.0", "html-webpack-plugin": "^4.3.0",
"prettier": "2.1.1",
"style-loader": "^1.2.1", "style-loader": "^1.2.1",
"text-encoding": "^0.7.0", "text-encoding": "^0.7.0",
"webpack": "^4.43.0", "webpack": "^4.44.1",
"webpack-cli": "^3.3.12", "webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0" "webpack-dev-server": "^3.11.0"
}, },

36
webpack.config.js

@ -8,11 +8,11 @@ const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin");
module.exports = { module.exports = {
entry: { entry: {
app: "./index.js", app: "./index.js",
"editor.worker": 'monaco-editor/esm/vs/editor/editor.worker.js', "editor.worker": "monaco-editor/esm/vs/editor/editor.worker.js",
"json.worker": 'monaco-editor/esm/vs/language/json/json.worker', "json.worker": "monaco-editor/esm/vs/language/json/json.worker",
"css.worker": 'monaco-editor/esm/vs/language/css/css.worker', "css.worker": "monaco-editor/esm/vs/language/css/css.worker",
"html.worker": 'monaco-editor/esm/vs/language/html/html.worker', "html.worker": "monaco-editor/esm/vs/language/html/html.worker",
"ts.worker": 'monaco-editor/esm/vs/language/typescript/ts.worker', "ts.worker": "monaco-editor/esm/vs/language/typescript/ts.worker",
}, },
output: { output: {
path: path.resolve(__dirname, "dist"), path: path.resolve(__dirname, "dist"),
@ -20,23 +20,23 @@ module.exports = {
}, },
plugins: [ plugins: [
new CleanWebpackPlugin(), new CleanWebpackPlugin(),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({ template: "index.html" }),
template: "index.html",
}),
new WasmPackPlugin({ new WasmPackPlugin({
crateDirectory: path.resolve(__dirname, "./boa_wasm/"), crateDirectory: path.resolve(__dirname, "./boa_wasm/"),
outDir: path.resolve(__dirname, "./boa_wasm/pkg/"), outDir: path.resolve(__dirname, "./boa_wasm/pkg/"),
}), }),
new CopyWebpackPlugin([ new CopyWebpackPlugin({
{ patterns: [
from: "./assets/*", {
to: ".", from: "./assets/*",
}, to: ".",
{ },
from: "./node_modules/bootstrap/dist/css/bootstrap.min.css", {
to: "./assets", from: "./node_modules/bootstrap/dist/css/bootstrap.min.css",
}, to: "./assets",
]), },
],
}),
// Have this example work in Edge which doesn't ship `TextEncoder` or // Have this example work in Edge which doesn't ship `TextEncoder` or
// `TextDecoder` at this time. // `TextDecoder` at this time.
new webpack.ProvidePlugin({ new webpack.ProvidePlugin({

646
yarn.lock

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save