Browse Source

Remove references to dev docs and npm dependencies (#3787)

* Remove references to dev docs and npm dependencies

* Remove webpack config
pull/3788/head
José Julián Espina 8 months ago committed by GitHub
parent
commit
ffbf794577
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      .github/dependabot.yml
  2. 55
      .github/workflows/main.yml
  3. 41
      .github/workflows/release.yml
  4. 22
      .github/workflows/webassembly.yml
  5. 23
      ABOUT.md
  6. 14
      CONTRIBUTING.md
  7. 44
      Cargo.lock
  8. 4
      README.md
  9. 20
      cli/ABOUT.md
  10. 23
      core/ast/ABOUT.md
  11. 23
      core/engine/ABOUT.md
  12. 23
      core/gc/ABOUT.md
  13. 23
      core/icu_provider/ABOUT.md
  14. 23
      core/interner/ABOUT.md
  15. 23
      core/interop/ABOUT.md
  16. 23
      core/macros/ABOUT.md
  17. 23
      core/parser/ABOUT.md
  18. 23
      core/profiler/ABOUT.md
  19. 23
      core/runtime/ABOUT.md
  20. 3
      ffi/wasm/Cargo.toml
  21. 25
      ffi/wasm/e2e_test/boa_demo.spec.ts
  22. 71
      ffi/wasm/e2e_test/playwright.config.ts
  23. 23
      ffi/wasm/e2e_test/server.mjs
  24. 3
      ffi/wasm/src/lib.rs
  25. 19
      ffi/wasm/tests/web.rs
  26. 77
      index.html
  27. 46
      index.js
  28. 5428
      package-lock.json
  29. 29
      package.json
  30. 89
      webpack.config.js

4
.github/dependabot.yml

@ -1,9 +1,5 @@
version: 2 version: 2
updates: updates:
- package-ecosystem: npm
directory: /
schedule:
interval: weekly
- package-ecosystem: github-actions - package-ecosystem: github-actions
directory: / directory: /
schedule: schedule:

55
.github/workflows/main.yml

@ -1,55 +0,0 @@
name: Main workflows
on:
push:
branches:
- main
jobs:
benchmark:
if: ${{ github.actor != 'dependabot[bot]' }}
name: Upload docs and run benchmarks
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1.0.7
with:
toolchain: stable
override: true
profile: minimal
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
target
!target/doc_upload
~/.cargo/git
~/.cargo/registry
key: ${{ runner.os }}-cargo-doc-bench-${{ hashFiles('**/Cargo.lock') }}
- name: Generate documentation
uses: actions-rs/cargo@v1
with:
command: doc
args: -v --document-private-items --all-features --workspace --no-deps --exclude boa_examples
- run: echo "<meta http-equiv=refresh content=0;url=boa_engine/index.html>" > target/doc/index.html
- run: |
if [ -d target/doc_upload ]; then rm -rf target/doc_upload; fi
mkdir target/doc_upload && mv target/doc target/doc_upload/doc
- name: Upload documentation
uses: crazy-max/ghaction-github-pages@v4.0.0
with:
target_branch: gh-pages
keep_history: true
build_dir: target/doc_upload
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run benchmark
run: cargo bench -p boa_engine -- --output-format bencher | tee output.txt
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1.19.3
with:
name: Boa Benchmarks
tool: "cargo"
output-file-path: output.txt
auto-push: true
github-token: ${{ secrets.GITHUB_TOKEN }}

41
.github/workflows/release.yml

@ -75,47 +75,6 @@ jobs:
- name: Publish to npm - name: Publish to npm
run: npm publish ./ffi/wasm/pkg --access=public run: npm publish ./ffi/wasm/pkg --access=public
doc-publish:
name: Publish documentation
needs: publish
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Install wasm-pack
uses: baptiste0928/cargo-install@v3.0.1
with:
crate: wasm-pack
- uses: actions/setup-node@v4
with:
node-version: "20"
- run: npm ci
- name: Cache npm build
uses: actions/cache@v4
with:
path: |
node_modules
target
ffi/wasm/pkg
~/.cargo/git
~/.cargo/registry
key: ${{ runner.os }}-npm-build-target-${{ hashFiles('**/package-lock.json') }}
- run: wasm-pack build ./ffi/wasm
- run: npm run build:prod
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
publish_dir: ./dist
destination_dir: playground
github_token: ${{ secrets.GITHUB_TOKEN }}
release-binaries: release-binaries:
name: Publish binaries name: Publish binaries
needs: publish needs: publish

22
.github/workflows/webassembly.yml

@ -36,25 +36,13 @@ jobs:
override: true override: true
profile: minimal profile: minimal
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- name: Cache npm build
uses: actions/cache@v4
with:
path: |
node_modules
key: ${{ runner.os }}-npm-build-target-${{ hashFiles('**/package-lock.json') }}
- name: Install wasm-pack - name: Install wasm-pack
uses: baptiste0928/cargo-install@v3.0.1 uses: baptiste0928/cargo-install@v3.0.1
with: with:
crate: wasm-pack crate: wasm-pack
- uses: actions/setup-node@v4
with:
node-version: "16"
- run: npm ci
- name: Build Playground - name: Build Playground
run: | run: wasm-pack build ./ffi/wasm --verbose
wasm-pack build ./ffi/wasm --verbose - name: Test (Chrome)
npm run build run: wasm-pack test --headless --chrome ./ffi/wasm --verbose
- name: Install Playwright Browsers - name: Test (Firefox)
run: npx playwright install --with-deps run: wasm-pack test --headless --firefox ./ffi/wasm --verbose
- name: Run Playwright test
run: npm run e2e

23
ABOUT.md

@ -11,8 +11,7 @@ Try out the most recent release with Boa's live demo
## Boa Crates ## Boa Crates
- [**`boa_ast`**][ast] - Boa's ECMAScript Abstract Syntax Tree. - [**`boa_ast`**][ast] - Boa's ECMAScript Abstract Syntax Tree.
- [**`boa_engine`**][engine] - Boa's implementation of ECMAScript builtin objects and - [**`boa_engine`**][engine] - Boa's implementation of ECMAScript builtin objects and execution.
execution.
- [**`boa_gc`**][gc] - Boa's garbage collector. - [**`boa_gc`**][gc] - Boa's garbage collector.
- [**`boa_interner`**][interner] - Boa's string interner. - [**`boa_interner`**][interner] - Boa's string interner.
- [**`boa_parser`**][parser] - Boa's lexer and parser. - [**`boa_parser`**][parser] - Boa's lexer and parser.
@ -20,14 +19,14 @@ Try out the most recent release with Boa's live demo
- [**`boa_icu_provider`**][icu] - Boa's ICU4X data provider. - [**`boa_icu_provider`**][icu] - Boa's ICU4X data provider.
- [**`boa_runtime`**][runtime] - Boa's WebAPI features. - [**`boa_runtime`**][runtime] - Boa's WebAPI features.
[boa-conformance]: https://boajs.dev/boa/test262/ [boa-conformance]: https://boajs.dev/conformance
[boa-web]: https://boajs.dev/ [boa-web]: https://boajs.dev/
[boa-playground]: https://boajs.dev/boa/playground/ [boa-playground]: https://boajs.dev/playground
[ast]: https://boajs.dev/boa/doc/boa_ast/index.html [ast]: https://docs.rs/boa_ast/latest/boa_ast/index.html
[engine]: https://boajs.dev/boa/doc/boa_engine/index.html [engine]: https://docs.rs/boa_engine/latest/boa_engine/index.html
[gc]: https://boajs.dev/boa/doc/boa_gc/index.html [gc]: https://docs.rs/boa_gc/latest/boa_gc/index.html
[interner]: https://boajs.dev/boa/doc/boa_interner/index.html [interner]: https://docs.rs/boa_interner/latest/boa_interner/index.html
[parser]: https://boajs.dev/boa/doc/boa_parser/index.html [parser]: https://docs.rs/boa_parser/latest/boa_parser/index.html
[profiler]: https://boajs.dev/boa/doc/boa_profiler/index.html [profiler]: https://docs.rs/boa_profiler/latest/boa_profiler/index.html
[icu]: https://boajs.dev/boa/doc/boa_icu_provider/index.html [icu]: https://docs.rs/boa_icu_provider/latest/boa_icu_provider/index.html
[runtime]: https://boajs.dev/boa/doc/boa_runtime/index.html [runtime]: https://docs.rs/boa_runtime/latest/boa_runtime/index.html

14
CONTRIBUTING.md

@ -96,8 +96,18 @@ cargo run --release --bin boa_tester -- run -vv -d -s test/language/types/number
## Documentation ## Documentation
We have specific documentation for development, updated on each commit to the `main` branch, with all the private To build the development documentation, run:
methods visible here: <https://boajs.dev/boa/doc/>
```shell
cargo doc --all-features --document-private-items --workspace
```
This will also document all the dependencies on the workspace, which could be heavier in size.
To only generate documentation for the workspace members, just add the `--no-deps` flag:
```shell
cargo doc --all-features --document-private-items --workspace --no-deps
```
## Communication ## Communication

44
Cargo.lock generated

@ -600,6 +600,7 @@ dependencies = [
"console_error_panic_hook", "console_error_panic_hook",
"getrandom", "getrandom",
"wasm-bindgen", "wasm-bindgen",
"wasm-bindgen-test",
] ]
[[package]] [[package]]
@ -3279,6 +3280,12 @@ dependencies = [
"windows-sys 0.52.0", "windows-sys 0.52.0",
] ]
[[package]]
name = "scoped-tls"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"
[[package]] [[package]]
name = "scopeguard" name = "scopeguard"
version = "1.2.0" version = "1.2.0"
@ -4201,6 +4208,18 @@ dependencies = [
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
[[package]]
name = "wasm-bindgen-futures"
version = "0.4.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0"
dependencies = [
"cfg-if",
"js-sys",
"wasm-bindgen",
"web-sys",
]
[[package]] [[package]]
name = "wasm-bindgen-macro" name = "wasm-bindgen-macro"
version = "0.2.92" version = "0.2.92"
@ -4230,6 +4249,31 @@ version = "0.2.92"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96"
[[package]]
name = "wasm-bindgen-test"
version = "0.3.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9bf62a58e0780af3e852044583deee40983e5886da43a271dd772379987667b"
dependencies = [
"console_error_panic_hook",
"js-sys",
"scoped-tls",
"wasm-bindgen",
"wasm-bindgen-futures",
"wasm-bindgen-test-macro",
]
[[package]]
name = "wasm-bindgen-test-macro"
version = "0.3.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7f89739351a2e03cb94beb799d47fb2cac01759b40ec441f7de39b00cbf7ef0"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.57",
]
[[package]] [[package]]
name = "wasmer" name = "wasmer"
version = "2.3.0" version = "2.3.0"

4
README.md

@ -90,9 +90,7 @@ Congrats! You've executed your first `JavaScript` using `Boa`!
For more information on `Boa`'s API. Feel free to check out our documentation. For more information on `Boa`'s API. Feel free to check out our documentation.
[**Release Documentation**](https://docs.rs/boa_engine/latest/boa_engine/) [**API Documentation**](https://docs.rs/boa_engine/latest/boa_engine/)
[**Dev `main` Documentation**](https://boajs.dev/boa/doc/boa_engine/index.html)
## Conformance ## Conformance

20
cli/ABOUT.md

@ -19,14 +19,14 @@ Try out the most recent release with Boa's live demo
- [**`boa_icu_provider`**][icu] - Boa's ICU4X data provider. - [**`boa_icu_provider`**][icu] - Boa's ICU4X data provider.
- [**`boa_runtime`**][runtime] - Boa's WebAPI features. - [**`boa_runtime`**][runtime] - Boa's WebAPI features.
[boa-conformance]: https://boajs.dev/boa/test262/ [boa-conformance]: https://boajs.dev/conformance
[boa-web]: https://boajs.dev/ [boa-web]: https://boajs.dev/
[boa-playground]: https://boajs.dev/boa/playground/ [boa-playground]: https://boajs.dev/playground
[ast]: https://boajs.dev/boa/doc/boa_ast/index.html [ast]: https://docs.rs/boa_ast/latest/boa_ast/index.html
[engine]: https://boajs.dev/boa/doc/boa_engine/index.html [engine]: https://docs.rs/boa_engine/latest/boa_engine/index.html
[gc]: https://boajs.dev/boa/doc/boa_gc/index.html [gc]: https://docs.rs/boa_gc/latest/boa_gc/index.html
[interner]: https://boajs.dev/boa/doc/boa_interner/index.html [interner]: https://docs.rs/boa_interner/latest/boa_interner/index.html
[parser]: https://boajs.dev/boa/doc/boa_parser/index.html [parser]: https://docs.rs/boa_parser/latest/boa_parser/index.html
[profiler]: https://boajs.dev/boa/doc/boa_profiler/index.html [profiler]: https://docs.rs/boa_profiler/latest/boa_profiler/index.html
[icu]: https://boajs.dev/boa/doc/boa_icu_provider/index.html [icu]: https://docs.rs/boa_icu_provider/latest/boa_icu_provider/index.html
[runtime]: https://boajs.dev/boa/doc/boa_runtime/index.html [runtime]: https://docs.rs/boa_runtime/latest/boa_runtime/index.html

23
core/ast/ABOUT.md

@ -11,8 +11,7 @@ Try out the most recent release with Boa's live demo
## Boa Crates ## Boa Crates
- [**`boa_ast`**][ast] - Boa's ECMAScript Abstract Syntax Tree. - [**`boa_ast`**][ast] - Boa's ECMAScript Abstract Syntax Tree.
- [**`boa_engine`**][engine] - Boa's implementation of ECMAScript builtin objects and - [**`boa_engine`**][engine] - Boa's implementation of ECMAScript builtin objects and execution.
execution.
- [**`boa_gc`**][gc] - Boa's garbage collector. - [**`boa_gc`**][gc] - Boa's garbage collector.
- [**`boa_interner`**][interner] - Boa's string interner. - [**`boa_interner`**][interner] - Boa's string interner.
- [**`boa_parser`**][parser] - Boa's lexer and parser. - [**`boa_parser`**][parser] - Boa's lexer and parser.
@ -20,14 +19,14 @@ Try out the most recent release with Boa's live demo
- [**`boa_icu_provider`**][icu] - Boa's ICU4X data provider. - [**`boa_icu_provider`**][icu] - Boa's ICU4X data provider.
- [**`boa_runtime`**][runtime] - Boa's WebAPI features. - [**`boa_runtime`**][runtime] - Boa's WebAPI features.
[boa-conformance]: https://boajs.dev/boa/test262/ [boa-conformance]: https://boajs.dev/conformance
[boa-web]: https://boajs.dev/ [boa-web]: https://boajs.dev/
[boa-playground]: https://boajs.dev/boa/playground/ [boa-playground]: https://boajs.dev/playground
[ast]: https://boajs.dev/boa/doc/boa_ast/index.html [ast]: https://docs.rs/boa_ast/latest/boa_ast/index.html
[engine]: https://boajs.dev/boa/doc/boa_engine/index.html [engine]: https://docs.rs/boa_engine/latest/boa_engine/index.html
[gc]: https://boajs.dev/boa/doc/boa_gc/index.html [gc]: https://docs.rs/boa_gc/latest/boa_gc/index.html
[interner]: https://boajs.dev/boa/doc/boa_interner/index.html [interner]: https://docs.rs/boa_interner/latest/boa_interner/index.html
[parser]: https://boajs.dev/boa/doc/boa_parser/index.html [parser]: https://docs.rs/boa_parser/latest/boa_parser/index.html
[profiler]: https://boajs.dev/boa/doc/boa_profiler/index.html [profiler]: https://docs.rs/boa_profiler/latest/boa_profiler/index.html
[icu]: https://boajs.dev/boa/doc/boa_icu_provider/index.html [icu]: https://docs.rs/boa_icu_provider/latest/boa_icu_provider/index.html
[runtime]: https://boajs.dev/boa/doc/boa_runtime/index.html [runtime]: https://docs.rs/boa_runtime/latest/boa_runtime/index.html

23
core/engine/ABOUT.md

@ -11,8 +11,7 @@ Try out the most recent release with Boa's live demo
## Boa Crates ## Boa Crates
- [**`boa_ast`**][ast] - Boa's ECMAScript Abstract Syntax Tree. - [**`boa_ast`**][ast] - Boa's ECMAScript Abstract Syntax Tree.
- [**`boa_engine`**][engine] - Boa's implementation of ECMAScript builtin objects and - [**`boa_engine`**][engine] - Boa's implementation of ECMAScript builtin objects and execution.
execution.
- [**`boa_gc`**][gc] - Boa's garbage collector. - [**`boa_gc`**][gc] - Boa's garbage collector.
- [**`boa_interner`**][interner] - Boa's string interner. - [**`boa_interner`**][interner] - Boa's string interner.
- [**`boa_parser`**][parser] - Boa's lexer and parser. - [**`boa_parser`**][parser] - Boa's lexer and parser.
@ -20,14 +19,14 @@ Try out the most recent release with Boa's live demo
- [**`boa_icu_provider`**][icu] - Boa's ICU4X data provider. - [**`boa_icu_provider`**][icu] - Boa's ICU4X data provider.
- [**`boa_runtime`**][runtime] - Boa's WebAPI features. - [**`boa_runtime`**][runtime] - Boa's WebAPI features.
[boa-conformance]: https://boajs.dev/boa/test262/ [boa-conformance]: https://boajs.dev/conformance
[boa-web]: https://boajs.dev/ [boa-web]: https://boajs.dev/
[boa-playground]: https://boajs.dev/boa/playground/ [boa-playground]: https://boajs.dev/playground
[ast]: https://boajs.dev/boa/doc/boa_ast/index.html [ast]: https://docs.rs/boa_ast/latest/boa_ast/index.html
[engine]: https://boajs.dev/boa/doc/boa_engine/index.html [engine]: https://docs.rs/boa_engine/latest/boa_engine/index.html
[gc]: https://boajs.dev/boa/doc/boa_gc/index.html [gc]: https://docs.rs/boa_gc/latest/boa_gc/index.html
[interner]: https://boajs.dev/boa/doc/boa_interner/index.html [interner]: https://docs.rs/boa_interner/latest/boa_interner/index.html
[parser]: https://boajs.dev/boa/doc/boa_parser/index.html [parser]: https://docs.rs/boa_parser/latest/boa_parser/index.html
[profiler]: https://boajs.dev/boa/doc/boa_profiler/index.html [profiler]: https://docs.rs/boa_profiler/latest/boa_profiler/index.html
[icu]: https://boajs.dev/boa/doc/boa_icu_provider/index.html [icu]: https://docs.rs/boa_icu_provider/latest/boa_icu_provider/index.html
[runtime]: https://boajs.dev/boa/doc/boa_runtime/index.html [runtime]: https://docs.rs/boa_runtime/latest/boa_runtime/index.html

23
core/gc/ABOUT.md

@ -11,8 +11,7 @@ Try out the most recent release with Boa's live demo
## Boa Crates ## Boa Crates
- [**`boa_ast`**][ast] - Boa's ECMAScript Abstract Syntax Tree. - [**`boa_ast`**][ast] - Boa's ECMAScript Abstract Syntax Tree.
- [**`boa_engine`**][engine] - Boa's implementation of ECMAScript builtin objects and - [**`boa_engine`**][engine] - Boa's implementation of ECMAScript builtin objects and execution.
execution.
- [**`boa_gc`**][gc] - Boa's garbage collector. - [**`boa_gc`**][gc] - Boa's garbage collector.
- [**`boa_interner`**][interner] - Boa's string interner. - [**`boa_interner`**][interner] - Boa's string interner.
- [**`boa_parser`**][parser] - Boa's lexer and parser. - [**`boa_parser`**][parser] - Boa's lexer and parser.
@ -20,14 +19,14 @@ Try out the most recent release with Boa's live demo
- [**`boa_icu_provider`**][icu] - Boa's ICU4X data provider. - [**`boa_icu_provider`**][icu] - Boa's ICU4X data provider.
- [**`boa_runtime`**][runtime] - Boa's WebAPI features. - [**`boa_runtime`**][runtime] - Boa's WebAPI features.
[boa-conformance]: https://boajs.dev/boa/test262/ [boa-conformance]: https://boajs.dev/conformance
[boa-web]: https://boajs.dev/ [boa-web]: https://boajs.dev/
[boa-playground]: https://boajs.dev/boa/playground/ [boa-playground]: https://boajs.dev/playground
[ast]: https://boajs.dev/boa/doc/boa_ast/index.html [ast]: https://docs.rs/boa_ast/latest/boa_ast/index.html
[engine]: https://boajs.dev/boa/doc/boa_engine/index.html [engine]: https://docs.rs/boa_engine/latest/boa_engine/index.html
[gc]: https://boajs.dev/boa/doc/boa_gc/index.html [gc]: https://docs.rs/boa_gc/latest/boa_gc/index.html
[interner]: https://boajs.dev/boa/doc/boa_interner/index.html [interner]: https://docs.rs/boa_interner/latest/boa_interner/index.html
[parser]: https://boajs.dev/boa/doc/boa_parser/index.html [parser]: https://docs.rs/boa_parser/latest/boa_parser/index.html
[profiler]: https://boajs.dev/boa/doc/boa_profiler/index.html [profiler]: https://docs.rs/boa_profiler/latest/boa_profiler/index.html
[icu]: https://boajs.dev/boa/doc/boa_icu_provider/index.html [icu]: https://docs.rs/boa_icu_provider/latest/boa_icu_provider/index.html
[runtime]: https://boajs.dev/boa/doc/boa_runtime/index.html [runtime]: https://docs.rs/boa_runtime/latest/boa_runtime/index.html

23
core/icu_provider/ABOUT.md

@ -11,8 +11,7 @@ Try out the most recent release with Boa's live demo
## Boa Crates ## Boa Crates
- [**`boa_ast`**][ast] - Boa's ECMAScript Abstract Syntax Tree. - [**`boa_ast`**][ast] - Boa's ECMAScript Abstract Syntax Tree.
- [**`boa_engine`**][engine] - Boa's implementation of ECMAScript builtin objects and - [**`boa_engine`**][engine] - Boa's implementation of ECMAScript builtin objects and execution.
execution.
- [**`boa_gc`**][gc] - Boa's garbage collector. - [**`boa_gc`**][gc] - Boa's garbage collector.
- [**`boa_interner`**][interner] - Boa's string interner. - [**`boa_interner`**][interner] - Boa's string interner.
- [**`boa_parser`**][parser] - Boa's lexer and parser. - [**`boa_parser`**][parser] - Boa's lexer and parser.
@ -20,14 +19,14 @@ Try out the most recent release with Boa's live demo
- [**`boa_icu_provider`**][icu] - Boa's ICU4X data provider. - [**`boa_icu_provider`**][icu] - Boa's ICU4X data provider.
- [**`boa_runtime`**][runtime] - Boa's WebAPI features. - [**`boa_runtime`**][runtime] - Boa's WebAPI features.
[boa-conformance]: https://boajs.dev/boa/test262/ [boa-conformance]: https://boajs.dev/conformance
[boa-web]: https://boajs.dev/ [boa-web]: https://boajs.dev/
[boa-playground]: https://boajs.dev/boa/playground/ [boa-playground]: https://boajs.dev/playground
[ast]: https://boajs.dev/boa/doc/boa_ast/index.html [ast]: https://docs.rs/boa_ast/latest/boa_ast/index.html
[engine]: https://boajs.dev/boa/doc/boa_engine/index.html [engine]: https://docs.rs/boa_engine/latest/boa_engine/index.html
[gc]: https://boajs.dev/boa/doc/boa_gc/index.html [gc]: https://docs.rs/boa_gc/latest/boa_gc/index.html
[interner]: https://boajs.dev/boa/doc/boa_interner/index.html [interner]: https://docs.rs/boa_interner/latest/boa_interner/index.html
[parser]: https://boajs.dev/boa/doc/boa_parser/index.html [parser]: https://docs.rs/boa_parser/latest/boa_parser/index.html
[profiler]: https://boajs.dev/boa/doc/boa_profiler/index.html [profiler]: https://docs.rs/boa_profiler/latest/boa_profiler/index.html
[icu]: https://boajs.dev/boa/doc/boa_icu_provider/index.html [icu]: https://docs.rs/boa_icu_provider/latest/boa_icu_provider/index.html
[runtime]: https://boajs.dev/boa/doc/boa_runtime/index.html [runtime]: https://docs.rs/boa_runtime/latest/boa_runtime/index.html

23
core/interner/ABOUT.md

@ -11,8 +11,7 @@ Try out the most recent release with Boa's live demo
## Boa Crates ## Boa Crates
- [**`boa_ast`**][ast] - Boa's ECMAScript Abstract Syntax Tree. - [**`boa_ast`**][ast] - Boa's ECMAScript Abstract Syntax Tree.
- [**`boa_engine`**][engine] - Boa's implementation of ECMAScript builtin objects and - [**`boa_engine`**][engine] - Boa's implementation of ECMAScript builtin objects and execution.
execution.
- [**`boa_gc`**][gc] - Boa's garbage collector. - [**`boa_gc`**][gc] - Boa's garbage collector.
- [**`boa_interner`**][interner] - Boa's string interner. - [**`boa_interner`**][interner] - Boa's string interner.
- [**`boa_parser`**][parser] - Boa's lexer and parser. - [**`boa_parser`**][parser] - Boa's lexer and parser.
@ -20,14 +19,14 @@ Try out the most recent release with Boa's live demo
- [**`boa_icu_provider`**][icu] - Boa's ICU4X data provider. - [**`boa_icu_provider`**][icu] - Boa's ICU4X data provider.
- [**`boa_runtime`**][runtime] - Boa's WebAPI features. - [**`boa_runtime`**][runtime] - Boa's WebAPI features.
[boa-conformance]: https://boajs.dev/boa/test262/ [boa-conformance]: https://boajs.dev/conformance
[boa-web]: https://boajs.dev/ [boa-web]: https://boajs.dev/
[boa-playground]: https://boajs.dev/boa/playground/ [boa-playground]: https://boajs.dev/playground
[ast]: https://boajs.dev/boa/doc/boa_ast/index.html [ast]: https://docs.rs/boa_ast/latest/boa_ast/index.html
[engine]: https://boajs.dev/boa/doc/boa_engine/index.html [engine]: https://docs.rs/boa_engine/latest/boa_engine/index.html
[gc]: https://boajs.dev/boa/doc/boa_gc/index.html [gc]: https://docs.rs/boa_gc/latest/boa_gc/index.html
[interner]: https://boajs.dev/boa/doc/boa_interner/index.html [interner]: https://docs.rs/boa_interner/latest/boa_interner/index.html
[parser]: https://boajs.dev/boa/doc/boa_parser/index.html [parser]: https://docs.rs/boa_parser/latest/boa_parser/index.html
[profiler]: https://boajs.dev/boa/doc/boa_profiler/index.html [profiler]: https://docs.rs/boa_profiler/latest/boa_profiler/index.html
[icu]: https://boajs.dev/boa/doc/boa_icu_provider/index.html [icu]: https://docs.rs/boa_icu_provider/latest/boa_icu_provider/index.html
[runtime]: https://boajs.dev/boa/doc/boa_runtime/index.html [runtime]: https://docs.rs/boa_runtime/latest/boa_runtime/index.html

23
core/interop/ABOUT.md

@ -11,8 +11,7 @@ Try out the most recent release with Boa's live demo
## Boa Crates ## Boa Crates
- [**`boa_ast`**][ast] - Boa's ECMAScript Abstract Syntax Tree. - [**`boa_ast`**][ast] - Boa's ECMAScript Abstract Syntax Tree.
- [**`boa_engine`**][engine] - Boa's implementation of ECMAScript builtin objects and - [**`boa_engine`**][engine] - Boa's implementation of ECMAScript builtin objects and execution.
execution.
- [**`boa_gc`**][gc] - Boa's garbage collector. - [**`boa_gc`**][gc] - Boa's garbage collector.
- [**`boa_interner`**][interner] - Boa's string interner. - [**`boa_interner`**][interner] - Boa's string interner.
- [**`boa_parser`**][parser] - Boa's lexer and parser. - [**`boa_parser`**][parser] - Boa's lexer and parser.
@ -20,14 +19,14 @@ Try out the most recent release with Boa's live demo
- [**`boa_icu_provider`**][icu] - Boa's ICU4X data provider. - [**`boa_icu_provider`**][icu] - Boa's ICU4X data provider.
- [**`boa_runtime`**][runtime] - Boa's WebAPI features. - [**`boa_runtime`**][runtime] - Boa's WebAPI features.
[boa-conformance]: https://boajs.dev/boa/test262/ [boa-conformance]: https://boajs.dev/conformance
[boa-web]: https://boajs.dev/ [boa-web]: https://boajs.dev/
[boa-playground]: https://boajs.dev/boa/playground/ [boa-playground]: https://boajs.dev/playground
[ast]: https://boajs.dev/boa/doc/boa_ast/index.html [ast]: https://docs.rs/boa_ast/latest/boa_ast/index.html
[engine]: https://boajs.dev/boa/doc/boa_engine/index.html [engine]: https://docs.rs/boa_engine/latest/boa_engine/index.html
[gc]: https://boajs.dev/boa/doc/boa_gc/index.html [gc]: https://docs.rs/boa_gc/latest/boa_gc/index.html
[interner]: https://boajs.dev/boa/doc/boa_interner/index.html [interner]: https://docs.rs/boa_interner/latest/boa_interner/index.html
[parser]: https://boajs.dev/boa/doc/boa_parser/index.html [parser]: https://docs.rs/boa_parser/latest/boa_parser/index.html
[profiler]: https://boajs.dev/boa/doc/boa_profiler/index.html [profiler]: https://docs.rs/boa_profiler/latest/boa_profiler/index.html
[icu]: https://boajs.dev/boa/doc/boa_icu_provider/index.html [icu]: https://docs.rs/boa_icu_provider/latest/boa_icu_provider/index.html
[runtime]: https://boajs.dev/boa/doc/boa_runtime/index.html [runtime]: https://docs.rs/boa_runtime/latest/boa_runtime/index.html

23
core/macros/ABOUT.md

@ -11,8 +11,7 @@ Try out the most recent release with Boa's live demo
## Boa Crates ## Boa Crates
- [**`boa_ast`**][ast] - Boa's ECMAScript Abstract Syntax Tree. - [**`boa_ast`**][ast] - Boa's ECMAScript Abstract Syntax Tree.
- [**`boa_engine`**][engine] - Boa's implementation of ECMAScript builtin objects and - [**`boa_engine`**][engine] - Boa's implementation of ECMAScript builtin objects and execution.
execution.
- [**`boa_gc`**][gc] - Boa's garbage collector. - [**`boa_gc`**][gc] - Boa's garbage collector.
- [**`boa_interner`**][interner] - Boa's string interner. - [**`boa_interner`**][interner] - Boa's string interner.
- [**`boa_parser`**][parser] - Boa's lexer and parser. - [**`boa_parser`**][parser] - Boa's lexer and parser.
@ -20,14 +19,14 @@ Try out the most recent release with Boa's live demo
- [**`boa_icu_provider`**][icu] - Boa's ICU4X data provider. - [**`boa_icu_provider`**][icu] - Boa's ICU4X data provider.
- [**`boa_runtime`**][runtime] - Boa's WebAPI features. - [**`boa_runtime`**][runtime] - Boa's WebAPI features.
[boa-conformance]: https://boajs.dev/boa/test262/ [boa-conformance]: https://boajs.dev/conformance
[boa-web]: https://boajs.dev/ [boa-web]: https://boajs.dev/
[boa-playground]: https://boajs.dev/boa/playground/ [boa-playground]: https://boajs.dev/playground
[ast]: https://boajs.dev/boa/doc/boa_ast/index.html [ast]: https://docs.rs/boa_ast/latest/boa_ast/index.html
[engine]: https://boajs.dev/boa/doc/boa_engine/index.html [engine]: https://docs.rs/boa_engine/latest/boa_engine/index.html
[gc]: https://boajs.dev/boa/doc/boa_gc/index.html [gc]: https://docs.rs/boa_gc/latest/boa_gc/index.html
[interner]: https://boajs.dev/boa/doc/boa_interner/index.html [interner]: https://docs.rs/boa_interner/latest/boa_interner/index.html
[parser]: https://boajs.dev/boa/doc/boa_parser/index.html [parser]: https://docs.rs/boa_parser/latest/boa_parser/index.html
[profiler]: https://boajs.dev/boa/doc/boa_profiler/index.html [profiler]: https://docs.rs/boa_profiler/latest/boa_profiler/index.html
[icu]: https://boajs.dev/boa/doc/boa_icu_provider/index.html [icu]: https://docs.rs/boa_icu_provider/latest/boa_icu_provider/index.html
[runtime]: https://boajs.dev/boa/doc/boa_runtime/index.html [runtime]: https://docs.rs/boa_runtime/latest/boa_runtime/index.html

23
core/parser/ABOUT.md

@ -11,8 +11,7 @@ Try out the most recent release with Boa's live demo
## Boa Crates ## Boa Crates
- [**`boa_ast`**][ast] - Boa's ECMAScript Abstract Syntax Tree. - [**`boa_ast`**][ast] - Boa's ECMAScript Abstract Syntax Tree.
- [**`boa_engine`**][engine] - Boa's implementation of ECMAScript builtin objects and - [**`boa_engine`**][engine] - Boa's implementation of ECMAScript builtin objects and execution.
execution.
- [**`boa_gc`**][gc] - Boa's garbage collector. - [**`boa_gc`**][gc] - Boa's garbage collector.
- [**`boa_interner`**][interner] - Boa's string interner. - [**`boa_interner`**][interner] - Boa's string interner.
- [**`boa_parser`**][parser] - Boa's lexer and parser. - [**`boa_parser`**][parser] - Boa's lexer and parser.
@ -20,14 +19,14 @@ Try out the most recent release with Boa's live demo
- [**`boa_icu_provider`**][icu] - Boa's ICU4X data provider. - [**`boa_icu_provider`**][icu] - Boa's ICU4X data provider.
- [**`boa_runtime`**][runtime] - Boa's WebAPI features. - [**`boa_runtime`**][runtime] - Boa's WebAPI features.
[boa-conformance]: https://boajs.dev/boa/test262/ [boa-conformance]: https://boajs.dev/conformance
[boa-web]: https://boajs.dev/ [boa-web]: https://boajs.dev/
[boa-playground]: https://boajs.dev/boa/playground/ [boa-playground]: https://boajs.dev/playground
[ast]: https://boajs.dev/boa/doc/boa_ast/index.html [ast]: https://docs.rs/boa_ast/latest/boa_ast/index.html
[engine]: https://boajs.dev/boa/doc/boa_engine/index.html [engine]: https://docs.rs/boa_engine/latest/boa_engine/index.html
[gc]: https://boajs.dev/boa/doc/boa_gc/index.html [gc]: https://docs.rs/boa_gc/latest/boa_gc/index.html
[interner]: https://boajs.dev/boa/doc/boa_interner/index.html [interner]: https://docs.rs/boa_interner/latest/boa_interner/index.html
[parser]: https://boajs.dev/boa/doc/boa_parser/index.html [parser]: https://docs.rs/boa_parser/latest/boa_parser/index.html
[profiler]: https://boajs.dev/boa/doc/boa_profiler/index.html [profiler]: https://docs.rs/boa_profiler/latest/boa_profiler/index.html
[icu]: https://boajs.dev/boa/doc/boa_icu_provider/index.html [icu]: https://docs.rs/boa_icu_provider/latest/boa_icu_provider/index.html
[runtime]: https://boajs.dev/boa/doc/boa_runtime/index.html [runtime]: https://docs.rs/boa_runtime/latest/boa_runtime/index.html

23
core/profiler/ABOUT.md

@ -11,8 +11,7 @@ Try out the most recent release with Boa's live demo
## Boa Crates ## Boa Crates
- [**`boa_ast`**][ast] - Boa's ECMAScript Abstract Syntax Tree. - [**`boa_ast`**][ast] - Boa's ECMAScript Abstract Syntax Tree.
- [**`boa_engine`**][engine] - Boa's implementation of ECMAScript builtin objects and - [**`boa_engine`**][engine] - Boa's implementation of ECMAScript builtin objects and execution.
execution.
- [**`boa_gc`**][gc] - Boa's garbage collector. - [**`boa_gc`**][gc] - Boa's garbage collector.
- [**`boa_interner`**][interner] - Boa's string interner. - [**`boa_interner`**][interner] - Boa's string interner.
- [**`boa_parser`**][parser] - Boa's lexer and parser. - [**`boa_parser`**][parser] - Boa's lexer and parser.
@ -20,14 +19,14 @@ Try out the most recent release with Boa's live demo
- [**`boa_icu_provider`**][icu] - Boa's ICU4X data provider. - [**`boa_icu_provider`**][icu] - Boa's ICU4X data provider.
- [**`boa_runtime`**][runtime] - Boa's WebAPI features. - [**`boa_runtime`**][runtime] - Boa's WebAPI features.
[boa-conformance]: https://boajs.dev/boa/test262/ [boa-conformance]: https://boajs.dev/conformance
[boa-web]: https://boajs.dev/ [boa-web]: https://boajs.dev/
[boa-playground]: https://boajs.dev/boa/playground/ [boa-playground]: https://boajs.dev/playground
[ast]: https://boajs.dev/boa/doc/boa_ast/index.html [ast]: https://docs.rs/boa_ast/latest/boa_ast/index.html
[engine]: https://boajs.dev/boa/doc/boa_engine/index.html [engine]: https://docs.rs/boa_engine/latest/boa_engine/index.html
[gc]: https://boajs.dev/boa/doc/boa_gc/index.html [gc]: https://docs.rs/boa_gc/latest/boa_gc/index.html
[interner]: https://boajs.dev/boa/doc/boa_interner/index.html [interner]: https://docs.rs/boa_interner/latest/boa_interner/index.html
[parser]: https://boajs.dev/boa/doc/boa_parser/index.html [parser]: https://docs.rs/boa_parser/latest/boa_parser/index.html
[profiler]: https://boajs.dev/boa/doc/boa_profiler/index.html [profiler]: https://docs.rs/boa_profiler/latest/boa_profiler/index.html
[icu]: https://boajs.dev/boa/doc/boa_icu_provider/index.html [icu]: https://docs.rs/boa_icu_provider/latest/boa_icu_provider/index.html
[runtime]: https://boajs.dev/boa/doc/boa_runtime/index.html [runtime]: https://docs.rs/boa_runtime/latest/boa_runtime/index.html

23
core/runtime/ABOUT.md

@ -11,8 +11,7 @@ Try out the most recent release with Boa's live demo
## Boa Crates ## Boa Crates
- [**`boa_ast`**][ast] - Boa's ECMAScript Abstract Syntax Tree. - [**`boa_ast`**][ast] - Boa's ECMAScript Abstract Syntax Tree.
- [**`boa_engine`**][engine] - Boa's implementation of ECMAScript builtin objects and - [**`boa_engine`**][engine] - Boa's implementation of ECMAScript builtin objects and execution.
execution.
- [**`boa_gc`**][gc] - Boa's garbage collector. - [**`boa_gc`**][gc] - Boa's garbage collector.
- [**`boa_interner`**][interner] - Boa's string interner. - [**`boa_interner`**][interner] - Boa's string interner.
- [**`boa_parser`**][parser] - Boa's lexer and parser. - [**`boa_parser`**][parser] - Boa's lexer and parser.
@ -20,14 +19,14 @@ Try out the most recent release with Boa's live demo
- [**`boa_icu_provider`**][icu] - Boa's ICU4X data provider. - [**`boa_icu_provider`**][icu] - Boa's ICU4X data provider.
- [**`boa_runtime`**][runtime] - Boa's WebAPI features. - [**`boa_runtime`**][runtime] - Boa's WebAPI features.
[boa-conformance]: https://boajs.dev/boa/test262/ [boa-conformance]: https://boajs.dev/conformance
[boa-web]: https://boajs.dev/ [boa-web]: https://boajs.dev/
[boa-playground]: https://boajs.dev/boa/playground/ [boa-playground]: https://boajs.dev/playground
[ast]: https://boajs.dev/boa/doc/boa_ast/index.html [ast]: https://docs.rs/boa_ast/latest/boa_ast/index.html
[engine]: https://boajs.dev/boa/doc/boa_engine/index.html [engine]: https://docs.rs/boa_engine/latest/boa_engine/index.html
[gc]: https://boajs.dev/boa/doc/boa_gc/index.html [gc]: https://docs.rs/boa_gc/latest/boa_gc/index.html
[interner]: https://boajs.dev/boa/doc/boa_interner/index.html [interner]: https://docs.rs/boa_interner/latest/boa_interner/index.html
[parser]: https://boajs.dev/boa/doc/boa_parser/index.html [parser]: https://docs.rs/boa_parser/latest/boa_parser/index.html
[profiler]: https://boajs.dev/boa/doc/boa_profiler/index.html [profiler]: https://docs.rs/boa_profiler/latest/boa_profiler/index.html
[icu]: https://boajs.dev/boa/doc/boa_icu_provider/index.html [icu]: https://docs.rs/boa_icu_provider/latest/boa_icu_provider/index.html
[runtime]: https://boajs.dev/boa/doc/boa_runtime/index.html [runtime]: https://docs.rs/boa_runtime/latest/boa_runtime/index.html

3
ffi/wasm/Cargo.toml

@ -17,6 +17,9 @@ wasm-bindgen = { version = "0.2.91", default-features = false }
getrandom = { version = "0.2.12", features = ["js"] } getrandom = { version = "0.2.12", features = ["js"] }
console_error_panic_hook = "0.1.7" console_error_panic_hook = "0.1.7"
[dev-dependencies]
wasm-bindgen-test = "0.3.42"
[features] [features]
default = ["boa_engine/annex-b", "boa_engine/intl_bundled", "boa_engine/experimental"] default = ["boa_engine/annex-b", "boa_engine/intl_bundled", "boa_engine/experimental"]

25
ffi/wasm/e2e_test/boa_demo.spec.ts

@ -1,25 +0,0 @@
import { expect, test } from "@playwright/test";
test.beforeEach(async ({ page }) => {
page.on("console", (msg) => {
let msgText = "";
for (let i = 0; i < msg.args().length; ++i) {
msgText += `${msg.args()[i]}`;
}
// eslint-disable-next-line no-console
console.log(msgText);
});
});
test("boa demo", async ({ page }) => {
await page.goto("/", {
// wait until all content is loaded
waitUntil: "networkidle",
});
// wait for the code evaluate
await page.waitForTimeout(2000);
const output = page.getByTestId("output");
const result = await output.innerHTML();
console.log("eval result: ", result);
await expect(result.match("Hello, World")?.length).toEqual(1);
});

71
ffi/wasm/e2e_test/playwright.config.ts

@ -1,71 +0,0 @@
import { defineConfig, devices } from "@playwright/test";
/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config();
/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: "./",
/* Maximum time one test can run for. */
timeout: 300 * 1000,
expect: {
/**
* Maximum time expect() should wait for the condition to be met.
* For example in `await expect(locator).toHaveText();`
*/
timeout: 5000,
},
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: "html",
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
actionTimeout: 0,
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://localhost:3000',
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: "on-first-retry",
baseURL: "http://localhost:8081/",
},
webServer: {
command: "node ./server.mjs",
cwd: "./",
url: "http://localhost:8081",
timeout: 60 * 1000,
reuseExistingServer: !process.env.CI,
stdout: "pipe",
stderr: "pipe",
},
/* Configure projects for major browsers */
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},
{
name: "firefox",
use: { ...devices["Desktop Firefox"] },
},
{
name: "webkit",
use: { ...devices["Desktop Safari"] },
},
],
});

23
ffi/wasm/e2e_test/server.mjs

@ -1,23 +0,0 @@
import { createServer } from "http";
import { readFile, readFileSync } from "fs";
import { dirname, join } from "path";
import { fileURLToPath, parse } from "url";
import { lookup } from "mime-types";
const __filename = fileURLToPath(import.meta.url);
createServer((req, res) => {
const __dirname = dirname(__filename);
const path = join(__dirname, "../../../dist", parse(req.url, true).path);
readFile(path, (err, data) => {
if (err) {
res.writeHead(200, { "Content-Type": "text/html" });
res.end(readFileSync(join(__dirname, "../../../dist/index.html")));
} else {
res.writeHead(200, { "Content-Type": lookup(path) });
res.end(data);
}
});
}).listen(8081, () => {
console.log("Server running at http://localhost:8081/");
});

3
ffi/wasm/src/lib.rs

@ -1,12 +1,13 @@
//! An ECMAScript WASM implementation based on `boa_engine`. //! An ECMAScript WASM implementation based on `boa_engine`.
#![cfg_attr(not(test), forbid(clippy::unwrap_used))] #![cfg_attr(not(test), forbid(clippy::unwrap_used))]
#![allow(unused_crate_dependencies)]
use boa_engine::{Context, Source}; use boa_engine::{Context, Source};
use getrandom as _; use getrandom as _;
use wasm_bindgen::prelude::*; use wasm_bindgen::prelude::*;
#[wasm_bindgen(start)] #[wasm_bindgen(start)]
fn main() { fn main_js() {
console_error_panic_hook::set_once(); console_error_panic_hook::set_once();
} }

19
ffi/wasm/tests/web.rs

@ -0,0 +1,19 @@
#![allow(unused_crate_dependencies)]
use wasm_bindgen_test::*;
wasm_bindgen_test_configure!(run_in_browser);
#[wasm_bindgen_test]
fn simple() {
const CODE: &str = r"
function greet(targetName) {
return 'Hello, ' + targetName + '!';
}
greet('World')
";
let result = boa_wasm::evaluate(CODE).unwrap();
assert_eq!(result, "\"Hello, World!\"");
}

77
index.html

@ -1,77 +0,0 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Boa Playground</title>
<link href="assets/bootstrap.min.css" rel="stylesheet" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<style>
header {
display: flex;
align-items: center;
}
.demo__img {
width: 170px;
display: block;
margin-bottom: 16px;
margin-right: 3rem;
}
.textbox {
height: 250px;
border: 1px solid #8db5e4;
margin-bottom: 16px;
flex: 2;
margin-right: 16px;
}
.container {
margin: 0 auto;
}
.demo__repl {
display: flex;
font-family: monospace;
}
.output {
flex: 1;
border: 1px solid black;
padding: 8px;
font-size: 2rem;
}
@media (min-width: 320px) and (max-width: 1024px) {
.demo__img {
max-width: 100%;
}
.demo__repl {
flex-direction: column;
}
.textbox {
min-height: 279px;
}
.output {
min-height: 100px;
}
}
</style>
<body>
<div class="container">
<header>
<img class="demo__img" src="./assets/logo.svg" />
<h1>Boa Playground</h1>
</header>
<div class="demo__repl">
<div class="textbox"></div>
<p data-testid="output" class="output"></p>
</div>
</div>
</body>
</html>

46
index.js

@ -1,46 +0,0 @@
import { evaluate } from "./ffi/wasm/pkg";
import * as monaco from "monaco-editor/esm/vs/editor/editor.api";
const initialCode = `\
function greet(targetName) {
return 'Hello, ' + targetName + '!';
}
greet('World')
`;
const editor = monaco.editor.create(
document.getElementsByClassName("textbox")[0],
{
value: initialCode,
language: "javascript",
theme: "vs",
minimap: {
enabled: false,
},
},
);
// Fix size of Monaco Editor when window resize
window.addEventListener("resize", () => {
editor.layout();
});
window.evaluate = evaluate;
editor.getModel().onDidChangeContent(inputHandler);
inputHandler(); // Evaluate initial code
function inputHandler(evt) {
const text = editor.getValue();
let p = document.querySelector("p.output");
try {
let result = window.evaluate(text);
p.textContent = `> ${result}`;
} catch (err) {
console.error(err);
p.innerHTML = `<span style="color:red">${err}</span>`;
}
}

5428
package-lock.json generated

File diff suppressed because it is too large Load Diff

29
package.json

@ -1,29 +0,0 @@
{
"scripts": {
"build": "webpack",
"serve": "webpack-dev-server",
"e2e": "playwright test -c ./ffi/wasm/e2e_test/playwright.config.ts",
"build:prod": "webpack --mode=production"
},
"devDependencies": {
"@playwright/test": "^1.42.1",
"@wasm-tool/wasm-pack-plugin": "^1.7.0",
"bootstrap": "^5.3.3",
"clean-webpack-plugin": "^4.0.0",
"copy-webpack-plugin": "^12.0.2",
"css-loader": "^6.10.0",
"file-loader": "^6.2.0",
"html-webpack-plugin": "^5.6.0",
"monaco-editor-webpack-plugin": "^7.1.0",
"prettier": "^3.2.5",
"style-loader": "^3.3.4",
"terser-webpack-plugin": "^5.3.10",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.0.4"
},
"dependencies": {
"mime-types": "^2.1.35",
"monaco-editor": "^0.47.0"
}
}

89
webpack.config.js

@ -1,89 +0,0 @@
const path = require("path");
const fs = require("fs");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const webpack = require("webpack");
const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin");
const TerserPlugin = require("terser-webpack-plugin");
const MonacoWebpackPlugin = require("monaco-editor-webpack-plugin");
const outdir = path.resolve(__dirname, "./dist");
if (fs.existsSync(outdir)) {
fs.rmSync(outdir, { recursive: true });
}
module.exports = {
experiments: {
asyncWebAssembly: true,
},
entry: {
app: "./index.js",
},
output: {
path: outdir,
filename: "[name].js",
},
plugins: [
new MonacoWebpackPlugin({
languages: ["javascript", "typescript"],
features: [
"browser",
"find",
"inlayHints",
"documentSymbols",
"inlineCompletions",
"parameterHints",
"snippet",
"suggest",
"wordHighlighter",
"codelens",
"hover",
"bracketMatching",
],
}),
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({ template: "index.html" }),
// WasmPackPlugin doesn't work in CI environment
// thanks to https://github.com/wasm-tool/wasm-pack-plugin/issues/90
...(!process.env.CI
? [
new WasmPackPlugin({
crateDirectory: path.resolve(__dirname, "./ffi/wasm/"),
outDir: path.resolve(__dirname, "./ffi/wasm/pkg/"),
forceMode: "production",
}),
]
: []),
new CopyWebpackPlugin({
patterns: [
{
from: "./assets/*",
to: ".",
},
{
from: "./node_modules/bootstrap/dist/css/bootstrap.min.css",
to: "./assets",
},
],
}),
],
module: {
rules: [
{
test: /\.css$/,
use: ["style-loader", "css-loader"],
},
{
test: /\.ttf$/,
use: ["file-loader"],
},
],
},
optimization: {
minimize: true,
minimizer: [new TerserPlugin()],
},
mode: "development",
};
Loading…
Cancel
Save